code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 3 1.01M |
|---|---|---|---|---|---|
/**
* 'highlight.js' instance with plugins
*
* @var {highlight.js} $markdown
*/
var $hljs = require('highlight.js');
module.exports = $hljs | bb-drummer/node-patternlibrary | lib/vendor/highlightjs.js | JavaScript | apache-2.0 | 146 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 IBM Corporation
# Copyright 2015 Lenovo
#
# 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.
# This module implements client/server messages emitted from plugins.
# Things are defined here to 'encourage' developers to coordinate information
# format. This is also how different data formats are supported
import confluent.exceptions as exc
import json
def _htmlify_structure(indict):
ret = "<ul>"
if isinstance(indict, dict):
for key in indict.iterkeys():
ret += "<li>{0}: ".format(key)
if type(indict[key]) in (str, unicode, float, int):
ret += str(indict[key])
else:
ret += _htmlify_structure(indict[key])
elif isinstance(indict, list):
if len(indict) > 0:
if type(indict[0]) in (str, unicode):
ret += ",".join(indict)
else:
for v in indict:
ret += _htmlify_structure(v)
return ret + '</ul>'
class ConfluentMessage(object):
readonly = False
defaultvalue = ''
defaulttype = 'text'
def __init__(self):
self.desc = ''
self.stripped = False
self.kvpairs = {}
raise NotImplementedError("Must be subclassed!")
def json(self):
# This will create the canonical json representation of this message
if hasattr(self, 'stripped') and self.stripped:
datasource = self.kvpairs
else:
datasource = {'databynode': self.kvpairs}
jsonsnippet = json.dumps(datasource, separators=(',', ':'))[1:-1]
return jsonsnippet
def raw(self):
"""Return pythonic representation of the response.
Used by httpapi while assembling data prior to json serialization"""
if hasattr(self, 'stripped') and self.stripped:
return self.kvpairs
return {'databynode': self.kvpairs}
def strip_node(self, node):
self.stripped = True
if self.kvpairs is not None:
self.kvpairs = self.kvpairs[node]
def html(self, extension=''):
#this is used to facilitate the api explorer feature
if not hasattr(self, 'stripped'):
self.stripped = False
if not hasattr(self, 'notnode'):
self.notnode = False
if self.stripped or self.notnode:
return self._generic_html_value(self.kvpairs)
if not self.stripped:
htmlout = ''
for node in self.kvpairs.iterkeys():
htmlout += '{0}:{1}\n'.format(
node, self._generic_html_value(self.kvpairs[node]))
return htmlout
def _generic_html_value(self, pairs):
snippet = ""
for key in pairs.iterkeys():
val = pairs[key]
value = self.defaultvalue
valtype = self.defaulttype
notes = []
if val is not None and 'value' in val:
value = val['value']
if 'inheritedfrom' in val:
notes.append('Inherited from %s' % val['inheritedfrom'])
if 'expression' in val:
notes.append(
'Derived from expression "%s"' % val['expression'])
elif val is not None and 'expression' in val and 'broken' in val:
value = "*BROKEN*"
notes.append(
'Derived from expression "%s"' % val['expression'])
notes.append('Broken because of %s' % val['broken'])
elif val is not None and 'expression' in val:
value = val['expression']
if value is None:
value = ''
if val is not None and value == '' and 'isset' in val and val[
'isset'] is True:
# an encrypted value, put some *** to show it is set
# in the explorer
if 'inheritedfrom' in val:
notes.append('Inherited from %s' % val['inheritedfrom'])
value = '********'
if isinstance(val, list):
snippet += key + ":"
if len(val) == 0 and not self.readonly:
snippet += ('<input type="{0}" name="{1}" value="" '
' "title="{2}">'
).format(valtype, key, self.desc)
for v in val:
if self.readonly:
snippet += _htmlify_structure(v)
else:
snippet += ('<input type="{0}" name="{1}" value="{2}" '
' "title="{3}">'
).format(valtype, key, v, self.desc)
if not self.readonly:
snippet += (
'<input type="{0}" name="{1}" value="" title="{2}">'
'<input type="checkbox" name="restexplorerhonorkey" '
'value="{1}">').format(valtype, key, self.desc)
return snippet
if self.readonly:
snippet += "{0}: {1}".format(key, value)
else:
snippet += (key + ":" +
'<input type="{0}" name="{1}" value="{2}" '
'title="{3}"><input type="checkbox" '
'name="restexplorerhonorkey" value="{1}">'
).format(valtype, key, value, self.desc)
if len(notes) > 0:
snippet += '(' + ','.join(notes) + ')'
return snippet
class ConfluentNodeError(object):
def __init__(self, node, errorstr):
self.node = node
self.error = errorstr
def raw(self):
return {'databynode': {self.node: {'error': self.error}}}
def html(self):
return self.node + ":" + self.error
def strip_node(self, node):
#NOTE(jbjohnso): For single node errors, raise exception to
#trigger what a developer of that medium would expect
raise Exception(self.error)
class ConfluentTargetTimeout(ConfluentNodeError):
def __init__(self, node, errstr='timeout'):
self.node = node
self.error = errstr
def strip_node(self, node):
raise exc.TargetEndpointUnreachable(self.error)
class ConfluentTargetNotFound(ConfluentNodeError):
def __init__(self, node, errorstr='not found'):
self.node = node
self.error = errorstr
def strip_node(self, node):
raise exc.NotFoundException(self.error)
class ConfluentTargetInvalidCredentials(ConfluentNodeError):
def __init__(self, node):
self.node = node
self.error = 'bad credentials'
def strip_node(self, node):
raise exc.TargetEndpointBadCredentials
class DeletedResource(ConfluentMessage):
def __init__(self, resource):
self.kvpairs = {}
class ConfluentChoiceMessage(ConfluentMessage):
valid_values = set()
valid_paramset = {}
def __init__(self, node, state):
self.stripped = False
self.kvpairs = {
node: {
self.keyname: {'value': state},
}
}
def html(self, extension=''):
if hasattr(self, 'stripped') and self.stripped:
return self._create_option(self.kvpairs)
else:
htmlout = ''
for node in self.kvpairs.iterkeys():
htmlout += '{0}:{1}\n'.format(
node, self._create_option(self.kvpairs[node]))
return htmlout
def _create_option(self, pairdata):
snippet = ''
for key in pairdata.iterkeys():
val = pairdata[key]
snippet += key + ':<select name="%s">' % key
valid_values = self.valid_values
if key in self.valid_paramset:
valid_values = self.valid_paramset[key]
for opt in valid_values:
if opt == val['value']:
snippet += '<option value="%s" selected>%s</option>\r' % (
opt, opt)
else:
snippet += '<option value="%s">%s</option>\r' % (opt, opt)
snippet += '</select>'
snippet += '<input type="checkbox" name="restexplorerhonorkey" '
snippet += 'value="{0}"><br>\r'.format(key)
return snippet
class LinkRelation(ConfluentMessage):
kvpairs = None
def __init__(self):
self.href = ''
self.rel = ''
def json(self):
"""Provide json_hal style representation of the relation.
This currently only makes sense for the socket api.
"""
return {self.rel: '{ "href": "%s" }' % self.href}
def raw(self):
"""Provide python structure of the relation.
This currently is only sensible to consume from httpapi.
"""
return {self.rel: {"href": self.href}}
def html(self, extension=''):
"""Provide an html representation of the link relation.
This is used by the API explorer aspect of httpapi"""
return '<a href="{0}{2}" rel="{1}">{0}{2}</a>'.format(self.href,
self.rel,
extension)
# return '<a href="%s" rel="%s">%s</a><input type="submit"
# name="restexprerorop" value="delete:%s"' % (self.href, self.rel,
# self.href, self.href)
class ChildCollection(LinkRelation):
def __init__(self, collname, candelete=False):
self.rel = 'item'
self.href = collname
self.candelete = candelete
def html(self, extension=''):
if self.candelete:
return (
'<a href="{0}{2}" rel="{1}">{0}{2}</a> . . . . . . . . . . . . '
'<button type="submit" name="restexplorerop" '
'value="delete" formaction="{0}">delete'
'</button>').format(self.href, self.rel, extension)
else:
return '<a href="{0}{1}" rel="{0}">{0}{1}</a>'.format(self.href,
extension)
def get_input_message(path, operation, inputdata, nodes=None):
if path[0] == 'power' and path[1] == 'state' and operation != 'retrieve':
return InputPowerMessage(path, nodes, inputdata)
elif path[0] in ('attributes', 'users') and operation != 'retrieve':
return InputAttributes(path, inputdata, nodes)
elif path == ['boot', 'nextdevice'] and operation != 'retrieve':
return InputBootDevice(path, nodes, inputdata)
elif path == ['identify'] and operation != 'retrieve':
return InputIdentifyMessage(path, nodes, inputdata)
elif inputdata:
raise exc.InvalidArgumentException()
class InputAttributes(ConfluentMessage):
def __init__(self, path, inputdata, nodes=None):
self.nodeattribs = {}
nestedmode = False
if not inputdata:
raise exc.InvalidArgumentException('no request data provided')
if nodes is None:
self.attribs = inputdata
for attrib in self.attribs:
if type(self.attribs[attrib]) in (str, unicode):
try:
# ok, try to use format against the string
# store back result to the attribute to
# handle things like '{{' and '}}'
# if any weird sort of error should
# happen, it means the string has something
# that formatter is looking to fulfill, but
# is unable to do so, meaning it is an expression
tv = self.attribs[attrib].format()
self.attribs[attrib] = tv
except (KeyError, IndexError):
# this means format() actually thought there was work
# that suggested parameters, push it in as an
# expression
self.attribs[attrib] = {
'expression': self.attribs[attrib]}
return
for node in nodes:
if node in inputdata:
nestedmode = True
self.nodeattribs[node] = inputdata[node]
if nestedmode:
for key in inputdata:
if key not in nodes:
raise exc.InvalidArgumentException
else:
for node in nodes:
self.nodeattribs[node] = inputdata
def get_attributes(self, node):
if node not in self.nodeattribs:
return {}
nodeattr = self.nodeattribs[node]
for attr in nodeattr:
if type(nodeattr[attr]) in (str, unicode):
try:
# as above, use format() to see if string follows
# expression, store value back in case of escapes
tv = nodeattr[attr].format()
nodeattr[attr] = tv
except (KeyError, IndexError):
# an expression string will error if format() done
# use that as cue to put it into config as an expr
nodeattr[attr] = {'expression': nodeattr[attr]}
return nodeattr
class ConfluentInputMessage(ConfluentMessage):
keyname = 'state'
def __init__(self, path, nodes, inputdata):
self.inputbynode = {}
self.stripped = False
if not inputdata:
raise exc.InvalidArgumentException('missing input data')
if self.keyname not in inputdata:
#assume we have nested information
for key in nodes:
if key not in inputdata:
raise exc.InvalidArgumentException(key + ' not in request')
datum = inputdata[key]
if self.keyname not in datum:
raise exc.InvalidArgumentException(
'missing {0} argument'.format(self.keyname))
elif datum[self.keyname] not in self.valid_values:
raise exc.InvalidArgumentException(
datum[self.keyname] + ' is not one of ' +
','.join(self.valid_values))
self.inputbynode[key] = datum[self.keyname]
else: # we have a state argument not by node
datum = inputdata
if self.keyname not in datum:
raise exc.InvalidArgumentException('missing {0} argument'.format(self.keyname))
elif datum[self.keyname] not in self.valid_values:
raise exc.InvalidArgumentException(datum[self.keyname] +
' is not one of ' +
','.join(self.valid_values))
for node in nodes:
self.inputbynode[node] = datum[self.keyname]
class InputIdentifyMessage(ConfluentInputMessage):
valid_values = set([
'on',
'off',
])
keyname = 'identify'
class InputPowerMessage(ConfluentInputMessage):
valid_values = set([
'on',
'off',
'reset',
'boot',
])
def powerstate(self, node):
return self.inputbynode[node]
class BootDevice(ConfluentChoiceMessage):
valid_values = set([
'network',
'hd',
'setup',
'default',
'cd',
])
valid_bootmodes = set([
'unspecified',
'bios',
'uefi',
])
valid_paramset = {
'bootmode': valid_bootmodes,
}
def __init__(self, node, device, bootmode='unspecified'):
if device not in self.valid_values:
raise Exception("Invalid boot device argument passed in:" +
repr(device))
if bootmode not in self.valid_bootmodes:
raise Exception("Invalid boot mode argument passed in:" +
repr(bootmode))
self.kvpairs = {
node: {
'nextdevice': {'value': device},
'bootmode': {'value': bootmode },
}
}
class InputBootDevice(BootDevice):
def __init__(self, path, nodes, inputdata):
self.bootdevbynode = {}
self.bootmodebynode = {}
if not inputdata:
raise exc.InvalidArgumentException()
if 'nextdevice' not in inputdata:
for key in nodes:
if key not in inputdata:
raise exc.InvalidArgumentException(key + ' not in request')
datum = inputdata[key]
if 'nextdevice' not in datum:
raise exc.InvalidArgumentException(
'missing nextdevice argument')
elif datum['nextdevice'] not in self.valid_values:
raise exc.InvalidArgumentException(
datum['nextdevice'] + ' is not one of ' +
','.join(self.valid_values))
self.bootdevbynode[key] = datum['nextdevice']
if 'bootmode' in datum:
if datum['bootmode'] not in self.valid_bootmodes:
raise exc.InvalidArgumentException(
datum['bootmode'] + ' is not one of ' +
','.join(self.valid_bootmodes))
self.bootmodebynode[key] = datum['bootmode']
else:
datum = inputdata
if 'nextdevice' not in datum:
raise exc.InvalidArgumentException(
'missing nextdevice argument')
elif datum['nextdevice'] not in self.valid_values:
raise exc.InvalidArgumentException(
datum['nextdevice'] + ' is not one of ' +
','.join(self.valid_values))
for node in nodes:
self.bootdevbynode[node] = datum['nextdevice']
if 'bootmode' in datum:
self.bootmodebynode[node] = datum['bootmode']
def bootdevice(self, node):
return self.bootdevbynode[node]
def bootmode(self, node):
return self.bootmodebynode.get(node, 'unspecified')
class IdentifyState(ConfluentChoiceMessage):
valid_values = set([
'', # allowed for output to indicate write-only support
'on',
'off',
])
keyname = 'identify'
class PowerState(ConfluentChoiceMessage):
valid_values = set([
'on',
'off',
'reset',
'boot',
])
keyname = 'state'
class SensorReadings(ConfluentMessage):
readonly = True
def __init__(self, sensors=(), name=None):
readings = []
self.notnode = name is None
for sensor in sensors:
sensordict = {'name': sensor['name']}
if 'value' in sensor:
sensordict['value'] = sensor['value']
if 'units' in sensor:
sensordict['units'] = sensor['units']
if 'states' in sensor:
sensordict['states'] = sensor['states']
if 'health' in sensor:
sensordict['health'] = sensor['health']
readings.append(sensordict)
if self.notnode:
self.kvpairs = {'sensors': readings}
else:
self.kvpairs = {name: {'sensors': readings}}
class HealthSummary(ConfluentMessage):
readonly = True
valid_values = set([
'ok',
'warning',
'critical',
'failed',
])
def __init__(self, health, name=None):
self.stripped = False
self.notnode = name is None
if health not in self.valid_values:
raise ValueError("%d is not a valid health state" % health)
if self.notnode:
self.kvpairs = {'health': {'value': health}}
else:
self.kvpairs = {name: {'health': {'value': health}}}
class Attributes(ConfluentMessage):
def __init__(self, name=None, kv=None, desc=''):
self.desc = desc
nkv = {}
self.notnode = name is None
for key in kv.iterkeys():
if type(kv[key]) in (str, unicode):
nkv[key] = {'value': kv[key]}
else:
nkv[key] = kv[key]
if self.notnode:
self.kvpairs = nkv
else:
self.kvpairs = {
name: nkv
}
class ListAttributes(ConfluentMessage):
def __init__(self, name=None, kv=None, desc=''):
self.desc = desc
self.notnode = name is None
if self.notnode:
self.kvpairs = kv
else:
self.kvpairs = {name: kv}
class CryptedAttributes(Attributes):
defaulttype = 'password'
def __init__(self, name=None, kv=None, desc=''):
# for now, just keep the dictionary keys and discard crypt value
self.desc = desc
nkv = {}
for key in kv.iterkeys():
nkv[key] = {'isset': False}
try:
if kv[key] is not None and kv[key]['cryptvalue'] != '':
nkv[key] = {'isset': True}
nkv[key]['inheritedfrom'] = kv[key]['inheritedfrom']
except KeyError:
pass
self.notnode = name is None
if self.notnode:
self.kvpairs = nkv
else:
self.kvpairs = {
name: nkv
}
| michaelfardu/thinkconfluent | confluent_server/confluent/messages.py | Python | apache-2.0 | 21,993 |
package com.finance.datamodel;
public class Money {
private static final Currency DEFAULT_CURRENCY = Currency.EUR;
public static final Money MONEY0 = new Money(0D, DEFAULT_CURRENCY);
private Double amount;
private final Currency currency;
public Money(final Double amount, final Currency currency) {
super();
this.amount = amount;
this.currency = currency;
}
public Double getAmount() {
return this.amount;
}
public Currency getCurrency() {
return this.currency;
}
public Money plus(final Money money) {
if (money == null) {
return this;
}
if (this.currency == money.getCurrency()) {
this.amount += money.amount;
}
return this;
}
public Money minus(final Money money) {
if (money == null) {
return this;
}
if (this.currency == money.getCurrency()) {
this.amount -= money.amount;
}
return this;
}
}
| arpadszocs/budgetmanager | datamodel/src/main/java/com/finance/datamodel/Money.java | Java | apache-2.0 | 904 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60-ea) on Wed Jan 04 17:08:18 EST 2017 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer (Public javadocs 2017.1.1 API)</title>
<meta name="date" content="2017-01-04">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer (Public javadocs 2017.1.1 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2017.1.1</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/wildfly/swarm/config/infinispan/cache_container/class-use/StateTransferThreadPoolConsumer.html" target="_top">Frames</a></li>
<li><a href="StateTransferThreadPoolConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Interface org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer" class="title">Uses of Interface<br>org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config.infinispan">org.wildfly.swarm.config.infinispan</a></td>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config.infinispan.cache_container">org.wildfly.swarm.config.infinispan.cache_container</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.config.infinispan">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a> in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/package-summary.html">org.wildfly.swarm.config.infinispan</a> with parameters of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html" title="type parameter in CacheContainer">T</a></code></td>
<td class="colLast"><span class="typeNameLabel">CacheContainer.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/CacheContainer.html#stateTransferThreadPool-org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer-">stateTransferThreadPool</a></span>(<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a> consumer)</code>
<div class="block">Defines a thread pool used for for state transfer.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.wildfly.swarm.config.infinispan.cache_container">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a> in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a> that return <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>default <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a><<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="type parameter in StateTransferThreadPoolConsumer">T</a>></code></td>
<td class="colLast"><span class="typeNameLabel">StateTransferThreadPoolConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html#andThen-org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer-">andThen</a></span>(<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a><<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="type parameter in StateTransferThreadPoolConsumer">T</a>> after)</code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/package-summary.html">org.wildfly.swarm.config.infinispan.cache_container</a> with parameters of type <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>default <a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a><<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="type parameter in StateTransferThreadPoolConsumer">T</a>></code></td>
<td class="colLast"><span class="typeNameLabel">StateTransferThreadPoolConsumer.</span><code><span class="memberNameLink"><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html#andThen-org.wildfly.swarm.config.infinispan.cache_container.StateTransferThreadPoolConsumer-">andThen</a></span>(<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">StateTransferThreadPoolConsumer</a><<a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="type parameter in StateTransferThreadPoolConsumer">T</a>> after)</code> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/wildfly/swarm/config/infinispan/cache_container/StateTransferThreadPoolConsumer.html" title="interface in org.wildfly.swarm.config.infinispan.cache_container">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2017.1.1</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/wildfly/swarm/config/infinispan/cache_container/class-use/StateTransferThreadPoolConsumer.html" target="_top">Frames</a></li>
<li><a href="StateTransferThreadPoolConsumer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2017 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| wildfly-swarm/wildfly-swarm-javadocs | 2017.1.1/apidocs/org/wildfly/swarm/config/infinispan/cache_container/class-use/StateTransferThreadPoolConsumer.html | HTML | apache-2.0 | 13,113 |
# Copyright (c) 2014 Cisco Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from nova.scheduler import solvers
from nova.scheduler.solvers.constraints import \
aggregate_image_properties_isolation
from nova import test
from nova.tests.scheduler import solver_scheduler_fakes as fakes
class TestAggregateImagePropertiesIsolationConstraint(test.NoDBTestCase):
def setUp(self):
super(TestAggregateImagePropertiesIsolationConstraint, self).setUp()
self.constraint_cls = aggregate_image_properties_isolation.\
AggregateImagePropertiesIsolationConstraint
self._generate_fake_constraint_input()
def _generate_fake_constraint_input(self):
self.fake_variables = solvers.BaseVariables()
self.fake_variables.host_instance_matrix = [
['h0i0', 'h0i1', 'h0i2'],
['h1i0', 'h1i1', 'h1i2']]
self.fake_filter_properties = {
'instance_uuids': ['fake_uuid_%s' % x for x in range(3)],
'num_instances': 3}
host1 = fakes.FakeSolverSchedulerHostState('host1', 'node1', {})
host2 = fakes.FakeSolverSchedulerHostState('host2', 'node1', {})
self.fake_hosts = [host1, host2]
@mock.patch('nova.scheduler.solvers.constraints.'
'aggregate_image_properties_isolation.'
'AggregateImagePropertiesIsolationConstraint.host_filter_cls')
def test_aggregate_image_properties_isolation_get_components(
self, mock_filter_cls):
expected_cons_vars = [['h1i0'], ['h1i1'], ['h1i2']]
expected_cons_coeffs = [[1], [1], [1]]
expected_cons_consts = [0, 0, 0]
expected_cons_ops = ['==', '==', '==']
mock_filter = mock_filter_cls.return_value
mock_filter.host_passes.side_effect = [True, False]
cons_vars, cons_coeffs, cons_consts, cons_ops = (
self.constraint_cls().get_components(self.fake_variables,
self.fake_hosts, self.fake_filter_properties))
self.assertEqual(expected_cons_vars, cons_vars)
self.assertEqual(expected_cons_coeffs, cons_coeffs)
self.assertEqual(expected_cons_consts, cons_consts)
self.assertEqual(expected_cons_ops, cons_ops)
| CiscoSystems/nova-solver-scheduler | nova/tests/scheduler/solvers/constraints/test_aggregate_image_properties_isolation.py | Python | apache-2.0 | 2,908 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_65) on Wed Sep 03 20:05:59 PDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.hadoop.hbase.client.HTableMultiplexer (HBase 0.98.6-hadoop2 API)</title>
<meta name="date" content="2014-09-03">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.hbase.client.HTableMultiplexer (HBase 0.98.6-hadoop2 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/hadoop/hbase/client/HTableMultiplexer.html" title="class in org.apache.hadoop.hbase.client">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/hadoop/hbase/client/class-use/HTableMultiplexer.html" target="_top">Frames</a></li>
<li><a href="HTableMultiplexer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.hadoop.hbase.client.HTableMultiplexer" class="title">Uses of Class<br>org.apache.hadoop.hbase.client.HTableMultiplexer</h2>
</div>
<div class="classUseContainer">No usage of org.apache.hadoop.hbase.client.HTableMultiplexer</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/hadoop/hbase/client/HTableMultiplexer.html" title="class in org.apache.hadoop.hbase.client">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/hadoop/hbase/client/class-use/HTableMultiplexer.html" target="_top">Frames</a></li>
<li><a href="HTableMultiplexer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| lshain/hbase-0.98.6-hadoop2 | docs/devapidocs/org/apache/hadoop/hbase/client/class-use/HTableMultiplexer.html | HTML | apache-2.0 | 4,573 |
/*
* Copyright 2005 FBK-irst (http://www.fbk.eu)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.itc.irst.tcc.sre.data;
import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//import org.itc.irst.tcc.kre.util.Array;
/**
* Loads an example set for relation extraction.
*
* @author Claudio Giuliano
* @version %I%, %G%
* @since 1.0
*/
public class MergeVectorSet
{
/**
* Define a static logger variable so that it references the
* Logger instance named <code>MergeVectorSet</code>.
*/
static Logger logger = LoggerFactory.getLogger(MergeVectorSet.class.getName());
//
public MergeVectorSet(File f1, File f2) throws Exception
{
//double sum = 0;
//List l1 = new ArrayList();
//List l2 = new ArrayList();
LineNumberReader r1 = new LineNumberReader(new FileReader(f1));
LineNumberReader r2 = new LineNumberReader(new FileReader(f2));
String s1 = null, s2 = null;
while (((s1 = r1.readLine()) != null) && ((s2 = r2.readLine()) != null))
{
//l1.add(s1);
String[] s = s2.split("\t");
// tf1 tf2 tf3 n
double tf1 = Double.parseDouble(s[0]);
double tf2 = Double.parseDouble(s[1]);
double tf3 = Double.parseDouble(s[2]);
double n = Double.parseDouble(s[3]);
//sum += Math.pow(tf3, 2);
//l2.add(new Double(tf3));
if (tf1 != tf2)
{
if (tf3 >= 50)
System.out.println(s1 + " 200000:1");/*
if (tf3 >= 100)
System.out.println(s1 + " 200000:1");
else if (tf3 >= 50)
System.out.println(s1 + " 200000:0.5");
else if (tf3 >= 25)
System.out.println(s1 + " 200000:0.25");
else
System.out.println(s1 + " 200000:0");*/
}
else
System.out.println(s1 + " 200000:0");
//System.out.println(s1 + " 200000:" + tf3);
//System.out.println(l1.charAt(0) + " 200000:" + tf3);
//System.out.println(l1 + " 200000:" + l1.charAt(0));
}
r1.close();
r2.close();
/*
sum = Math.sqrt(sum);
for (int i=0;i<l1.size();i++)
{
double d = ((Double) l2.get(i)).doubleValue() / sum;
System.out.println(l1.get(i) + " 200000:" + d);
}
*/
} // end constructor
// //
// public static void main(String args[]) throws Exception
// {
// String logConfig = System.getProperty("log-config");
// if (logConfig == null)
// logConfig = "log-config.txt";
//
// PropertyConfigurator.configure(logConfig);
//
// if (args.length != 2)
// {
// System.err.println("java -mx512M org.itc.irst.tcc.sre.data.MergeVectorSet f1 f2");
// System.exit(-1);
// }
//
// File f1 = new File(args[0]);
// File f2 = new File(args[1]);
//
// new MergeVectorSet(f1, f2);
// } // end main
} // end class MergeVectorSet
| BlueBrain/bluima | modules/bluima_jsre/src/main/java/org/itc/irst/tcc/sre/data/MergeVectorSet.java | Java | apache-2.0 | 3,218 |
namespace CDMservers.Models
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Spatial;
[Table("CITY.CONFIG")]
public partial class CONFIG
{
[Key]
[StringLength(20)]
public string COUNTYCODE { get; set; }
[Required]
[StringLength(20)]
public string BUSINESSTABLENAME { get; set; }
}
}
| hedulewei/cdm | CDMservers/CDMservers/Models/CONFIG.cs | C# | apache-2.0 | 512 |
/*
* Copyright 2014-2019 Real Logic Ltd.
*
* 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 io.aeron;
import io.aeron.exceptions.ConcurrentConcludeException;
import org.junit.Test;
public class CommonContextTest
{
@Test(expected = ConcurrentConcludeException.class)
public void shouldNotAllowConcludeMoreThanOnce()
{
final CommonContext ctx = new CommonContext();
ctx.conclude();
ctx.conclude();
}
}
| galderz/Aeron | aeron-client/src/test/java/io/aeron/CommonContextTest.java | Java | apache-2.0 | 959 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.support;
import java.io.InputStream;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.camel.Exchange;
import org.apache.camel.language.simple.SimpleLanguage;
import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.Scanner;
/**
* {@link org.apache.camel.Expression} to walk a {@link org.apache.camel.Message} XML body
* using an {@link java.util.Iterator}, which grabs the content between a XML start and end token.
* <p/>
* The message body must be able to convert to {@link java.io.InputStream} type which is used as stream
* to access the message body.
* <p/>
* Can be used to split big XML files.
* <p/>
* This implementation supports inheriting namespaces from a parent/root tag.
*
* @deprecated use {@link TokenXMLExpressionIterator} instead.
*/
@Deprecated
public class TokenXMLPairExpressionIterator extends TokenPairExpressionIterator {
private static final Pattern NAMESPACE_PATTERN = Pattern.compile("xmlns(:\\w+|)=\\\"(.*?)\\\"");
private static final String SCAN_TOKEN_REGEX = "(\\s+.*?|)>";
private static final String SCAN_TOKEN_NS_PREFIX_REGEX = "(.{1,15}?:|)";
protected final String inheritNamespaceToken;
public TokenXMLPairExpressionIterator(String startToken, String endToken, String inheritNamespaceToken) {
super(startToken, endToken, true);
// namespace token is optional
this.inheritNamespaceToken = inheritNamespaceToken;
}
@Override
protected Iterator<?> createIterator(Exchange exchange, InputStream in, String charset) {
String start = startToken;
if (SimpleLanguage.hasSimpleFunction(start)) {
start = SimpleLanguage.expression(start).evaluate(exchange, String.class);
}
String end = endToken;
if (SimpleLanguage.hasSimpleFunction(end)) {
end = SimpleLanguage.expression(end).evaluate(exchange, String.class);
}
String inherit = inheritNamespaceToken;
if (inherit != null && SimpleLanguage.hasSimpleFunction(inherit)) {
inherit = SimpleLanguage.expression(inherit).evaluate(exchange, String.class);
}
// must be XML tokens
if (!start.startsWith("<") || !start.endsWith(">")) {
throw new IllegalArgumentException("Start token must be a valid XML token, was: " + start);
}
if (!end.startsWith("<") || !end.endsWith(">")) {
throw new IllegalArgumentException("End token must be a valid XML token, was: " + end);
}
if (inherit != null && (!inherit.startsWith("<") || !inherit.endsWith(">"))) {
throw new IllegalArgumentException("Namespace token must be a valid XML token, was: " + inherit);
}
XMLTokenPairIterator iterator = new XMLTokenPairIterator(start, end, inherit, in, charset);
iterator.init();
return iterator;
}
/**
* Iterator to walk the input stream
*/
static class XMLTokenPairIterator extends TokenPairIterator {
private final Pattern startTokenPattern;
private final String scanEndToken;
private final String inheritNamespaceToken;
private Pattern inheritNamespaceTokenPattern;
private String rootTokenNamespaces;
XMLTokenPairIterator(String startToken, String endToken, String inheritNamespaceToken, InputStream in, String charset) {
super(startToken, endToken, true, in, charset);
// remove any beginning < and ending > as we need to support ns prefixes and attributes, so we use a reg exp patterns
StringBuilder tokenSb = new StringBuilder("<").append(SCAN_TOKEN_NS_PREFIX_REGEX).
append(startToken.substring(1, startToken.length() - 1)).append(SCAN_TOKEN_REGEX);
this.startTokenPattern = Pattern.compile(tokenSb.toString());
tokenSb = new StringBuilder("</").append(SCAN_TOKEN_NS_PREFIX_REGEX).
append(endToken.substring(2, endToken.length() - 1)).append(SCAN_TOKEN_REGEX);
this.scanEndToken = tokenSb.toString();
this.inheritNamespaceToken = inheritNamespaceToken;
if (inheritNamespaceToken != null) {
// the inherit namespace token may itself have a namespace prefix
tokenSb = new StringBuilder("<").append(SCAN_TOKEN_NS_PREFIX_REGEX).
append(inheritNamespaceToken.substring(1, inheritNamespaceToken.length() - 1)).append(SCAN_TOKEN_REGEX);
// the namespaces on the parent tag can be in multi line, so we need to instruct the dot to support multilines
this.inheritNamespaceTokenPattern = Pattern.compile(tokenSb.toString(), Pattern.MULTILINE | Pattern.DOTALL);
}
}
@Override
void init() {
// use scan end token as delimiter which supports attributes/namespaces
this.scanner = new Scanner(in, charset, scanEndToken);
// this iterator will do look ahead as we may have data
// after the last end token, which the scanner would find
// so we need to be one step ahead of the scanner
this.image = scanner.hasNext() ? (String) next(true) : null;
}
@Override
String getNext(boolean first) {
String next = scanner.next();
if (next == null) {
return null;
}
// initialize inherited namespaces on first
if (first && inheritNamespaceToken != null) {
rootTokenNamespaces = getNamespacesFromNamespaceToken(next);
}
// make sure next is positioned at start token as we can have leading data
// or we reached EOL and there is no more start tags
Matcher matcher = startTokenPattern.matcher(next);
if (!matcher.find()) {
return null;
} else {
int index = matcher.start();
next = next.substring(index);
}
// make sure the end tag matches the begin tag if the tag has a namespace prefix
String tag = ObjectHelper.before(next, ">");
StringBuilder endTagSb = new StringBuilder("</");
int firstSpaceIndex = tag.indexOf(" ");
if (firstSpaceIndex > 0) {
endTagSb.append(tag.substring(1, firstSpaceIndex)).append(">");
} else {
endTagSb.append(tag.substring(1, tag.length())).append(">");
}
// build answer accordingly to whether namespaces should be inherited or not
StringBuilder sb = new StringBuilder();
if (inheritNamespaceToken != null && rootTokenNamespaces != null) {
// append root namespaces to local start token
// grab the text
String text = ObjectHelper.after(next, ">");
// build result with inherited namespaces
next = sb.append(tag).append(rootTokenNamespaces).append(">").append(text).append(endTagSb.toString()).toString();
} else {
next = sb.append(next).append(endTagSb.toString()).toString();
}
return next;
}
private String getNamespacesFromNamespaceToken(String text) {
if (text == null) {
return null;
}
// grab the namespace tag
Matcher mat = inheritNamespaceTokenPattern.matcher(text);
if (mat.find()) {
text = mat.group(0);
} else {
// cannot find namespace tag
return null;
}
// find namespaces (there can be attributes mixed, so we should only grab the namespaces)
Map<String, String> namespaces = new LinkedHashMap<>();
Matcher matcher = NAMESPACE_PATTERN.matcher(text);
while (matcher.find()) {
String prefix = matcher.group(1);
String url = matcher.group(2);
if (ObjectHelper.isEmpty(prefix)) {
prefix = "_DEFAULT_";
} else {
// skip leading :
prefix = prefix.substring(1);
}
namespaces.put(prefix, url);
}
// did we find any namespaces
if (namespaces.isEmpty()) {
return null;
}
// build namespace String
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : namespaces.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if ("_DEFAULT_".equals(key)) {
sb.append(" xmlns=\"").append(value).append("\"");
} else {
sb.append(" xmlns:").append(key).append("=\"").append(value).append("\"");
}
}
return sb.toString();
}
}
}
| dmvolod/camel | camel-core/src/main/java/org/apache/camel/support/TokenXMLPairExpressionIterator.java | Java | apache-2.0 | 10,031 |
<!DOCTYPE html >
<html>
<head>
<title>FreeSpecStringWrapper - ScalaTest 3.0.1 - org.scalatest.FreeSpecLike.FreeSpecStringWrapper</title>
<meta name="description" content="FreeSpecStringWrapper - ScalaTest 3.0.1 - org.scalatest.FreeSpecLike.FreeSpecStringWrapper" />
<meta name="keywords" content="FreeSpecStringWrapper ScalaTest 3.0.1 org.scalatest.FreeSpecLike.FreeSpecStringWrapper" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
<link href="../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />
<script type="text/javascript" src="../../lib/jquery.js" id="jquery-js"></script>
<script type="text/javascript" src="../../lib/jquery-ui.js"></script>
<script type="text/javascript" src="../../lib/template.js"></script>
<script type="text/javascript" src="../../lib/tools.tooltip.js"></script>
<script type="text/javascript">
if(top === self) {
var url = '../../index.html';
var hash = 'org.scalatest.FreeSpecLike$FreeSpecStringWrapper';
var anchor = window.location.hash;
var anchor_opt = '';
if (anchor.length >= 1)
anchor_opt = '@' + anchor.substring(1);
window.location.href = url + '#' + hash + anchor_opt;
}
</script>
</head>
<body class="type">
<!-- Top of doc.scalatest.org [javascript] -->
<script type="text/javascript">
var rnd = window.rnd || Math.floor(Math.random()*10e6);
var pid204546 = window.pid204546 || rnd;
var plc204546 = window.plc204546 || 0;
var abkw = window.abkw || '';
var absrc = 'http://ab167933.adbutler-ikon.com/adserve/;ID=167933;size=468x60;setID=204546;type=js;sw='+screen.width+';sh='+screen.height+';spr='+window.devicePixelRatio+';kw='+abkw+';pid='+pid204546+';place='+(plc204546++)+';rnd='+rnd+';click=CLICK_MACRO_PLACEHOLDER';
document.write('<scr'+'ipt src="'+absrc+'" type="text/javascript"></scr'+'ipt>');
</script>
<div id="definition">
<img alt="Class" src="../../lib/class_big.png" />
<p id="owner"><a href="../package.html" class="extype" name="org">org</a>.<a href="package.html" class="extype" name="org.scalatest">scalatest</a>.<a href="FreeSpecLike.html" class="extype" name="org.scalatest.FreeSpecLike">FreeSpecLike</a></p>
<h1>FreeSpecStringWrapper</h1><h3><span class="morelinks"><div>Related Doc:
<a href="FreeSpecLike.html" class="extype" name="org.scalatest.FreeSpecLike">package FreeSpecLike</a>
</div></span></h3><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
</div>
<h4 id="signature" class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">class</span>
</span>
<span class="symbol">
<span class="name">FreeSpecStringWrapper</span><span class="result"> extends <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
</h4>
<div id="comment" class="fullcommenttop"><div class="comment cmt"><p>A class that via an implicit conversion (named <code>convertToFreeSpecStringWrapper</code>) enables
methods <code>in</code>, <code>is</code>, <code>taggedAs</code> and <code>ignore</code>,
as well as the dash operator (<code>-</code>), to be invoked on <code>String</code>s.
</p></div><dl class="attributes block"> <dt>Attributes</dt><dd>protected </dd><dt>Source</dt><dd><a href="https://github.com/scalatest/scalatest/tree/release-3.0.1/scalatest//src/main/scala/org/scalatest/FreeSpecLike.scala" target="_blank">FreeSpecLike.scala</a></dd></dl><div class="toggleContainer block">
<span class="toggle">Linear Supertypes</span>
<div class="superTypes hiddenContent"><span class="extype" name="scala.AnyRef">AnyRef</span>, <span class="extype" name="scala.Any">Any</span></div>
</div></div>
<div id="mbrsel">
<div id="textfilter"><span class="pre"></span><span class="input"><input id="mbrsel-input" type="text" accesskey="/" /></span><span class="post"></span></div>
<div id="order">
<span class="filtertype">Ordering</span>
<ol>
<li class="alpha in"><span>Alphabetic</span></li>
<li class="inherit out"><span>By Inheritance</span></li>
</ol>
</div>
<div id="ancestors">
<span class="filtertype">Inherited<br />
</span>
<ol id="linearization">
<li class="in" name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper"><span>FreeSpecStringWrapper</span></li><li class="in" name="scala.AnyRef"><span>AnyRef</span></li><li class="in" name="scala.Any"><span>Any</span></li>
</ol>
</div><div id="ancestors">
<span class="filtertype"></span>
<ol>
<li class="hideall out"><span>Hide All</span></li>
<li class="showall in"><span>Show All</span></li>
</ol>
</div>
<div id="visbl">
<span class="filtertype">Visibility</span>
<ol><li class="public in"><span>Public</span></li><li class="all out"><span>All</span></li></ol>
</div>
</div>
<div id="template">
<div id="allMembers">
<div id="constructors" class="members">
<h3>Instance Constructors</h3>
<ol><li name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper#<init>" visbl="pub" data-isabs="false" fullComment="no" group="Ungrouped">
<a id="<init>(string:String,pos:org.scalactic.source.Position):FreeSpecLike.this.FreeSpecStringWrapper"></a>
<a id="<init>:FreeSpecStringWrapper"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">new</span>
</span>
<span class="symbol">
<span class="name">FreeSpecStringWrapper</span><span class="params">(<span name="string">string: <span class="extype" name="scala.Predef.String">String</span></span>, <span name="pos">pos: <span class="extype" name="org.scalactic.source.Position">Position</span></span>)</span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@<init>(string:String,pos:org.scalactic.source.Position):FreeSpecLike.this.FreeSpecStringWrapper" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
</li></ol>
</div>
<div id="values" class="values members">
<h3>Value Members</h3>
<ol><li name="scala.AnyRef#!=" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="!=(x$1:Any):Boolean"></a>
<a id="!=(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $bang$eq" class="name">!=</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@!=(x$1:Any):Boolean" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef###" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="##():Int"></a>
<a id="##():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $hash$hash" class="name">##</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@##():Int" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper#-" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="-(fun:=>Unit):Unit"></a>
<a id="-(⇒Unit):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $minus" class="name">-</span><span class="params">(<span name="fun">fun: ⇒ <span class="extype" name="scala.Unit">Unit</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@-(fun:=>Unit):Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Register some text that may surround one or more tests.</p><div class="fullcomment"><div class="comment cmt"><p>Register some text that may surround one or more tests. Thepassed function value may contain surrounding text
registrations (defined with dash (<code>-</code>)) and/or tests (defined with <code>in</code>). This trait's
implementation of this method will register the text (passed to the contructor of <code>FreeSpecStringWrapper</code>
and immediately invoke the passed function.
</p></div></div>
</li><li name="scala.AnyRef#==" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="==(x$1:Any):Boolean"></a>
<a id="==(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span title="gt4s: $eq$eq" class="name">==</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@==(x$1:Any):Boolean" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.Any#asInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="asInstanceOf[T0]:T0"></a>
<a id="asInstanceOf[T0]:T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">asInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Any.asInstanceOf.T0">T0</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@asInstanceOf[T0]:T0" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef#clone" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="clone():Object"></a>
<a id="clone():AnyRef"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">clone</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.AnyRef">AnyRef</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@clone():Object" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.CloneNotSupportedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#eq" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="eq(x$1:AnyRef):Boolean"></a>
<a id="eq(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">eq</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@eq(x$1:AnyRef):Boolean" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#equals" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="equals(x$1:Any):Boolean"></a>
<a id="equals(Any):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">equals</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@equals(x$1:Any):Boolean" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#finalize" visbl="prt" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="finalize():Unit"></a>
<a id="finalize():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">finalize</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@finalize():Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Attributes</dt><dd>protected[<a href="../../java$lang.html" class="extype" name="java.lang">java.lang</a>] </dd><dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="symbol">classOf[java.lang.Throwable]</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#getClass" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="getClass():Class[_]"></a>
<a id="getClass():Class[_]"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">getClass</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.Class">Class</span>[_]</span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@getClass():Class[_]" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#hashCode" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="hashCode():Int"></a>
<a id="hashCode():Int"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">hashCode</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Int">Int</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@hashCode():Int" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper#ignore" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="ignore(f:=>Any):Unit"></a>
<a id="ignore(⇒Any):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">ignore</span><span class="params">(<span name="f">f: ⇒ <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@ignore(f:=>Any):Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Supports ignored test registration.</p><div class="fullcomment"><div class="comment cmt"><p>Supports ignored test registration.</p><p>For example, this method supports syntax such as the following:</p><p><pre class="stHighlighted">
<span class="stQuotedString">"complain on peek"</span> ignore { ... }
^
</pre></p><p>For more information and examples of this method's use, see the <a href="FreeSpec.html">main documentation</a> for trait <code>FreeSpec</code>.</p></div></div>
</li><li name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper#in" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="in(f:=>Any):Unit"></a>
<a id="in(⇒Any):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">in</span><span class="params">(<span name="f">f: ⇒ <span class="extype" name="scala.Any">Any</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@in(f:=>Any):Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Supports test registration.</p><div class="fullcomment"><div class="comment cmt"><p>Supports test registration.</p><p>For example, this method supports syntax such as the following:</p><p><pre class="stHighlighted">
<span class="stQuotedString">"complain on peek"</span> in { ... }
^
</pre></p><p>For more information and examples of this method's use, see the <a href="FreeSpec.html">main documentation</a> for trait <code>FreeSpec</code>.</p></div></div>
</li><li name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper#is" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="is(f:=>org.scalatest.PendingStatement):Unit"></a>
<a id="is(⇒PendingStatement):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">is</span><span class="params">(<span name="f">f: ⇒ <a href="PendingStatement.html" class="extype" name="org.scalatest.PendingStatement">PendingStatement</a></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@is(f:=>org.scalatest.PendingStatement):Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Supports pending test registration.</p><div class="fullcomment"><div class="comment cmt"><p>Supports pending test registration.</p><p>For example, this method supports syntax such as the following:</p><p><pre class="stHighlighted">
<span class="stQuotedString">"complain on peek"</span> is (pending)
^
</pre></p><p>For more information and examples of this method's use, see the <a href="FreeSpec.html">main documentation</a> for trait <code>FreeSpec</code>.</p></div></div>
</li><li name="scala.Any#isInstanceOf" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="isInstanceOf[T0]:Boolean"></a>
<a id="isInstanceOf[T0]:Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">isInstanceOf</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@isInstanceOf[T0]:Boolean" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>Any</dd></dl></div>
</li><li name="scala.AnyRef#ne" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="ne(x$1:AnyRef):Boolean"></a>
<a id="ne(AnyRef):Boolean"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">ne</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.AnyRef">AnyRef</span></span>)</span><span class="result">: <span class="extype" name="scala.Boolean">Boolean</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@ne(x$1:AnyRef):Boolean" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notify" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notify():Unit"></a>
<a id="notify():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notify</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@notify():Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#notifyAll" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="notifyAll():Unit"></a>
<a id="notifyAll():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">notifyAll</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@notifyAll():Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="scala.AnyRef#synchronized" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="synchronized[T0](x$1:=>T0):T0"></a>
<a id="synchronized[T0](⇒T0):T0"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">synchronized</span><span class="tparams">[<span name="T0">T0</span>]</span><span class="params">(<span name="arg0">arg0: ⇒ <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>)</span><span class="result">: <span class="extype" name="java.lang.AnyRef.synchronized.T0">T0</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@synchronized[T0](x$1:=>T0):T0" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd></dl></div>
</li><li name="org.scalatest.FreeSpecLike.FreeSpecStringWrapper#taggedAs" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="taggedAs(firstTestTag:org.scalatest.Tag,otherTestTags:org.scalatest.Tag*):FreeSpecLike.this.ResultOfTaggedAsInvocationOnString"></a>
<a id="taggedAs(Tag,Tag*):ResultOfTaggedAsInvocationOnString"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">taggedAs</span><span class="params">(<span name="firstTestTag">firstTestTag: <a href="Tag.html" class="extype" name="org.scalatest.Tag">Tag</a></span>, <span name="otherTestTags">otherTestTags: <a href="Tag.html" class="extype" name="org.scalatest.Tag">Tag</a>*</span>)</span><span class="result">: <a href="FreeSpecLike$ResultOfTaggedAsInvocationOnString.html" class="extype" name="org.scalatest.FreeSpecLike.ResultOfTaggedAsInvocationOnString">ResultOfTaggedAsInvocationOnString</a></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@taggedAs(firstTestTag:org.scalatest.Tag,otherTestTags:org.scalatest.Tag*):FreeSpecLike.this.ResultOfTaggedAsInvocationOnString" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<p class="shortcomment cmt">Supports tagged test registration.</p><div class="fullcomment"><div class="comment cmt"><p>Supports tagged test registration.</p><p>For example, this method supports syntax such as the following:</p><p><pre class="stHighlighted">
<span class="stQuotedString">"complain on peek"</span> taggedAs(<span class="stType">SlowTest</span>) in { ... }
^
</pre></p><p>For more information and examples of this method's use, see the <a href="FreeSpec.html">main documentation</a> for trait <code>FreeSpec</code>.</p></div></div>
</li><li name="scala.AnyRef#toString" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="toString():String"></a>
<a id="toString():String"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier"></span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">toString</span><span class="params">()</span><span class="result">: <span class="extype" name="java.lang.String">String</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@toString():String" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef → Any</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait():Unit"></a>
<a id="wait():Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">()</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@wait():Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long,x$2:Int):Unit"></a>
<a id="wait(Long,Int):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>, <span name="arg1">arg1: <span class="extype" name="scala.Int">Int</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@wait(x$1:Long,x$2:Int):Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li><li name="scala.AnyRef#wait" visbl="pub" data-isabs="false" fullComment="yes" group="Ungrouped">
<a id="wait(x$1:Long):Unit"></a>
<a id="wait(Long):Unit"></a>
<h4 class="signature">
<span class="modifier_kind">
<span class="modifier">final </span>
<span class="kind">def</span>
</span>
<span class="symbol">
<span class="name">wait</span><span class="params">(<span name="arg0">arg0: <span class="extype" name="scala.Long">Long</span></span>)</span><span class="result">: <span class="extype" name="scala.Unit">Unit</span></span>
</span>
</h4><span class="permalink">
<a href="../../index.html#org.scalatest.FreeSpecLike$FreeSpecStringWrapper@wait(x$1:Long):Unit" title="Permalink" target="_top">
<img src="../../lib/permalink.png" alt="Permalink" />
</a>
</span>
<div class="fullcomment"><dl class="attributes block"> <dt>Definition Classes</dt><dd>AnyRef</dd><dt>Annotations</dt><dd>
<span class="name">@throws</span><span class="args">(<span>
<span class="defval" name="classOf[java.lang.InterruptedException]">...</span>
</span>)</span>
</dd></dl></div>
</li></ol>
</div>
</div>
<div id="inheritedMembers">
<div class="parent" name="scala.AnyRef">
<h3>Inherited from <span class="extype" name="scala.AnyRef">AnyRef</span></h3>
</div><div class="parent" name="scala.Any">
<h3>Inherited from <span class="extype" name="scala.Any">Any</span></h3>
</div>
</div>
<div id="groupedMembers">
<div class="group" name="Ungrouped">
<h3>Ungrouped</h3>
</div>
</div>
</div>
<div id="tooltip"></div>
<div id="footer"> </div>
</body>
</html>
| scalatest/scalatest-website | public/scaladoc/3.0.1/org/scalatest/FreeSpecLike$FreeSpecStringWrapper.html | HTML | apache-2.0 | 35,372 |
# Navicula paulina (Ehrenberg) H. W. Reichardt SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Bacillariophyta/Bacillariophyceae/Naviculales/Naviculaceae/Navicula/Navicula paulina/README.md | Markdown | apache-2.0 | 202 |
package pl.zankowski.iextrading4j.client.rest.request.stocks;
import org.junit.jupiter.api.Test;
import pl.zankowski.iextrading4j.api.stocks.TodayEarnings;
import pl.zankowski.iextrading4j.client.rest.manager.MethodType;
import pl.zankowski.iextrading4j.client.rest.manager.RestRequest;
import jakarta.ws.rs.core.GenericType;
import static org.assertj.core.api.Assertions.assertThat;
class TodayEarningsRequestBuilderTest {
@Test
void shouldSuccessfullyCreateRequest() {
final RestRequest<TodayEarnings> request = new TodayEarningsRequestBuilder()
.build();
assertThat(request.getMethodType()).isEqualTo(MethodType.GET);
assertThat(request.getPath()).isEqualTo("/stock/market/today-earnings");
assertThat(request.getResponseType()).isEqualTo(new GenericType<TodayEarnings>() {});
assertThat(request.getQueryParams()).isEmpty();
}
}
| WojciechZankowski/iextrading4j | iextrading4j-client/src/test/java/pl/zankowski/iextrading4j/client/rest/request/stocks/TodayEarningsRequestBuilderTest.java | Java | apache-2.0 | 907 |
# Thalictrum polycarpum var. polycarpum VARIETY
#### Status
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Ranunculales/Ranunculaceae/Thalictrum/Thalictrum polycarpum/Thalictrum polycarpum polycarpum/README.md | Markdown | apache-2.0 | 179 |
<?php
$botPintar=array(
"вoт powered вy <me>"
);
$botNomer=array(
"вoт powered вy <me>"
);
$botPhoto=array(
"вoт powered вy <me>"
);
$botNormal=array(
"вoт powered вy <me>"
);
function getPower($nm,$tm,$tk){
$gwe=getUrl('/me',$tk,array(
'fields' => 'id,name',
));
$site=' Att👌👆👊
<3 Gur Dhaliwal <3
';
$true=$ops.'
'.$site;
return $true;
}
function getStr($mes,$psn,$nam,$me,$in,$exe=null){
$array=array(
'<me>',
'<name>',
'<mess>',
'<balik>',
'<juara>',
);
$space=array(
$me,
$nam,
$psn,
strrev($psn),
$exe,
);
$couse=str_replace($array,$space,$mes);
if($in=='on'){
return getEmo($couse);
}else{
return $couse;}
}
function getTex($or,$id,$txt,$nm,$me,$tok,$botPintar,$botNomer,$botNormal,$botPhoto=null){
$intruksi=array(
'nomer',
'pintar',
'normal',
);
if($txt=='photo'){
$exit=$txt;
}else{
$exe=$intruksi[rand(0,count($intruksi)-1)];
}
if($exit){
$pht=$botPhoto[rand(0,count($botPhoto)-1)];
return getStr($pht,$txt,$nm,$me,$or);
}else{
if($exe=='pintar'){
foreach($botPintar as $jet){
for($u=0;$u<=count($jet);$u++){
$lose=$jet[0][$u];
$wine=$jet[1][$u];;
if(preg_match('/'.$lose.'/',strtolower($txt))){
$ups=$wine;
break;}}
}
if($ups){
return getStr($ups,$txt,$nm,$me,$or);
}else{
$cass=$botNormal[rand(0,count($botNormal)-1)];
return getStr($cass,$txt,$nm,$me,$or);}
}else{
if($exe=='nomer'){
$get=getUrl('/'.$id.'/comments',$tok,array(
'fields' => 'id,from,message',
));
if($get[2]){
$no=$botNomer[3][rand(0,count($botNomer[3])-1)];
return getStr($no,$txt,$nm,$me,$or,$get[2][from][name]);
}else{
if($get[1]){
$no=$botNomer[2][rand(0,count($botNomer[2])-1)];
return getStr($no,$txt,$nm,$me,$or,$get[1][from][name]);
}else{
if($get[0]){
$no=$botNomer[1][rand(0,count($botNomer[1])-1)];
return getStr($no,$txt,$nm,$me,$or,$get[0][from][name]);
}else{
$no=$botNomer[0][rand(0,count($botNomer[0])-1)];
return getStr($no,$txt,$nm,$me,$or);}}}
}else{
$cass=$botNormal[rand(0,count($botNormal)-1)];
return getStr($cass,$txt,$nm,$me,$or);}}}
}
function getFor($ay,$ey,$iy,$uy,$ip,$tok,$nm,$as,$is,$us,$es){
foreach($ip as $uh){
$mc=explode('*',$uh);
if(preg_match('/pic/',$mc[0])){
$lay=explode('pic',$mc[0]);
getUrl('/'.$lay[1].'/likes',$tok,array(
'method' => 'post',
));
}else{
getUrl('/'.$mc[0].'/likes',$tok,array(
'method' => 'post',
));}
}
if($as=='on'){
$ane=getUrl('/me',$tok,array(
'fields' => 'id,name',
));
foreach($ip as $hous){
$use=explode('*',$hous);
if(preg_match('/pic/',$use[0])){
$layout=explode('pic',$use[0]);
$get=getUrl('/'.$layout[1].'/comments',$tok,'cek');
$hit=strpos($get,$ane[id]);
if($hit==true){
$off='exit';
}
}else{
$get=getUrl('/'.$use[0].'/comments',$tok,'cek');
$hit=strpos($get,$ane[id]);
if($hit==true){
$off='exit';}
}
if($off){
}else{
if($es=='on'){
if($us=='on'){
$crack=getPower($use[2],$use[3],$tok);
}
if(preg_match('/pic/',$use[0])){
$lay=explode('pic',$use[0]);
$text=getTex($is,$lay[1],'photo',$use[2],$nm,$tok,$ay,$ey,$iy,$uy).'
'.$crack;
getUrl('/'.$lay[1].'/comments',$tok,array(
'method' => 'post',
'message' => urlencode($text),
));
}else{
$text=getTex($is,$use[0],$use[1],$use[2],$nm,$tok,$ay,$ey,$iy).'
'.$crack;
getUrl('/'.$use[0].'/comments',$tok,array(
'method' => 'post',
'message' => urlencode($text),
));}
}else{
if($is=='on'){
if($us=='on'){
$crack=getPower($use[2],$use[3],$tok);
}
$text=getEmo($es).'
'.$crack;
if(preg_match('/pic/',$use[0])){
$lay=explode('pic',$use[0]);
getUrl('/'.$lay[1].'/comments',$tok,array(
'method' => 'post',
'message' => urlencode($text),
));
}else{
getUrl('/'.$use[0].'/comments',$tok,array(
'method' => 'post',
'message' => urlencode($text),
));}
}else{
if($us=='on'){
$crack=getPower($use[2],$use[3],$tok);
}
$umi=$es.'
'.$crack;
if(preg_match('/pic/',$use[0])){
$lay=explode('pic',$use[0]);
getUrl('/'.$lay[1].'/comments',$tok,array(
'method' => 'post',
'message' => urlencode($umi),
));
}else{
getUrl('/'.$use[0].'/comments',$tok,array(
'method' => 'post',
'message' => urlencode($umi),
));}}}}}
}
echo 'sukses';
}
function getMe($aray,$arey,$ariy,$aruy,$tk,$a,$b,$c,$d,$qq,$out,$sx){
$me=getUrl('/me/home',$tk,array(
'fields' => 'id,name,from,message,type,created_time',
));
for($i=0;$i<=count($me);$i++){
$typ=$me[$i][type];
$frm=$me[$i][from][id];
if($typ=='photo'){
if(preg_match('/'.$frm.'/',$out)){}else{
$oh='pic'.$me[$i][id].'*';}
}else{
if(preg_match('/'.$frm.'/',$out)){}else{
$oh=$me[$i][id].'*';}
}
$id[]=$oh.$me[$i][message].'*'.$me[$i][from][name].'*'.$me[$i][created_time];
if(count($id)==7){
break;}
}
if($d=='on'){
return getFor($aray,$arey,$ariy,$aruy,$id,$tk,$sx,$a,$b,$c,$d);
}else{
return getFor($aray,$arey,$ariy,$aruy,$id,$tk,$sx,$a,$b,$c,$qq);}
}
function getGr($as,$bs){
$ar=array(
'graph',
'fb',
'me'
);
$im='https://'.implode('.',$ar);
return $im.$as.$bs;
}
function getUrl($mb,$tk,$uh=null){
$ar=array(
'access_token' => $tk,
);
if($uh){
if($uh=='cek'){
$black=$ar;
}else{
$else=array_merge($ar,$uh);}
}else{
$else=$ar;
}
if($else){
foreach($else as $b => $c){
$aden[]=$b.'='.$c;
}
$true='?'.implode('&',$aden);
$true=getGr($mb,$true);
$true=json_decode(one($true),true);
if($true[data]){
return $true[data];
}else{
return $true;}
}else{
foreach($black as $b => $c){
$aden[]=$b.'='.$c;
}
$true='?'.implode('&',$aden);
$true=getGr($mb,$true);
$true=one($true);
return $true;}
}
function one($url){
$cx=curl_init();
curl_setopt_array($cx,array(
CURLOPT_URL => $url,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_USERAGENT => 'DESCRIPTION by haxer.heck.in',
));
$ch=curl_exec($cx);
curl_close($cx);
return ($ch);
}
function getEmo($n){
$emo=array(
urldecode('%F3%BE%80%80'),
urldecode('%F3%BE%80%81'),
urldecode('%F3%BE%80%82'),
urldecode('%F3%BE%80%83'),
urldecode('%F3%BE%80%84'),
urldecode('%F3%BE%80%85'),
urldecode('%F3%BE%80%87'),
urldecode('%F3%BE%80%B8'),
urldecode('%F3%BE%80%BC'),
urldecode('%F3%BE%80%BD'),
urldecode('%F3%BE%80%BE'),
urldecode('%F3%BE%80%BF'),
urldecode('%F3%BE%81%80'),
urldecode('%F3%BE%81%81'),
urldecode('%F3%BE%81%82'),
urldecode('%F3%BE%81%83'),
urldecode('%F3%BE%81%85'),
urldecode('%F3%BE%81%86'),
urldecode('%F3%BE%81%87'),
urldecode('%F3%BE%81%88'),
urldecode('%F3%BE%81%89'),
urldecode('%F3%BE%81%91'),
urldecode('%F3%BE%81%92'),
urldecode('%F3%BE%81%93'),
urldecode('%F3%BE%86%90'),
urldecode('%F3%BE%86%91'),
urldecode('%F3%BE%86%92'),
urldecode('%F3%BE%86%93'),
urldecode('%F3%BE%86%94'),
urldecode('%F3%BE%86%96'),
urldecode('%F3%BE%86%9B'),
urldecode('%F3%BE%86%9C'),
urldecode('%F3%BE%86%9D'),
urldecode('%F3%BE%86%9E'),
urldecode('%F3%BE%86%A0'),
urldecode('%F3%BE%86%A1'),
urldecode('%F3%BE%86%A2'),
urldecode('%F3%BE%86%A4'),
urldecode('%F3%BE%86%A5'),
urldecode('%F3%BE%86%A6'),
urldecode('%F3%BE%86%A7'),
urldecode('%F3%BE%86%A8'),
urldecode('%F3%BE%86%A9'),
urldecode('%F3%BE%86%AA'),
urldecode('%F3%BE%86%AB'),
urldecode('%F3%BE%86%AE'),
urldecode('%F3%BE%86%AF'),
urldecode('%F3%BE%86%B0'),
urldecode('%F3%BE%86%B1'),
urldecode('%F3%BE%86%B2'),
urldecode('%F3%BE%86%B3'),
urldecode('%F3%BE%86%B5'),
urldecode('%F3%BE%86%B6'),
urldecode('%F3%BE%86%B7'),
urldecode('%F3%BE%86%B8'),
urldecode('%F3%BE%86%BB'),
urldecode('%F3%BE%86%BC'),
urldecode('%F3%BE%86%BD'),
urldecode('%F3%BE%86%BE'),
urldecode('%F3%BE%86%BF'),
urldecode('%F3%BE%87%80'),
urldecode('%F3%BE%87%81'),
urldecode('%F3%BE%87%82'),
urldecode('%F3%BE%87%83'),
urldecode('%F3%BE%87%84'),
urldecode('%F3%BE%87%85'),
urldecode('%F3%BE%87%86'),
urldecode('%F3%BE%87%87'),
urldecode('%F3%BE%87%88'),
urldecode('%F3%BE%87%89'),
urldecode('%F3%BE%87%8A'),
urldecode('%F3%BE%87%8B'),
urldecode('%F3%BE%87%8C'),
urldecode('%F3%BE%87%8D'),
urldecode('%F3%BE%87%8E'),
urldecode('%F3%BE%87%8F'),
urldecode('%F3%BE%87%90'),
urldecode('%F3%BE%87%91'),
urldecode('%F3%BE%87%92'),
urldecode('%F3%BE%87%93'),
urldecode('%F3%BE%87%94'),
urldecode('%F3%BE%87%95'),
urldecode('%F3%BE%87%96'),
urldecode('%F3%BE%87%97'),
urldecode('%F3%BE%87%98'),
urldecode('%F3%BE%87%99'),
urldecode('%F3%BE%87%9B'),
urldecode('%F3%BE%8C%AC'),
urldecode('%F3%BE%8C%AD'),
urldecode('%F3%BE%8C%AE'),
urldecode('%F3%BE%8C%AF'),
urldecode('%F3%BE%8C%B0'),
urldecode('%F3%BE%8C%B2'),
urldecode('%F3%BE%8C%B3'),
urldecode('%F3%BE%8C%B4'),
urldecode('%F3%BE%8C%B6'),
urldecode('%F3%BE%8C%B8'),
urldecode('%F3%BE%8C%B9'),
urldecode('%F3%BE%8C%BA'),
urldecode('%F3%BE%8C%BB'),
urldecode('%F3%BE%8C%BC'),
urldecode('%F3%BE%8C%BD'),
urldecode('%F3%BE%8C%BE'),
urldecode('%F3%BE%8C%BF'),
urldecode('%F3%BE%8C%A0'),
urldecode('%F3%BE%8C%A1'),
urldecode('%F3%BE%8C%A2'),
urldecode('%F3%BE%8C%A3'),
urldecode('%F3%BE%8C%A4'),
urldecode('%F3%BE%8C%A5'),
urldecode('%F3%BE%8C%A6'),
urldecode('%F3%BE%8C%A7'),
urldecode('%F3%BE%8C%A8'),
urldecode('%F3%BE%8C%A9'),
urldecode('%F3%BE%8C%AA'),
urldecode('%F3%BE%8C%AB'),
urldecode('%F3%BE%8D%80'),
urldecode('%F3%BE%8D%81'),
urldecode('%F3%BE%8D%82'),
urldecode('%F3%BE%8D%83'),
urldecode('%F3%BE%8D%84'),
urldecode('%F3%BE%8D%85'),
urldecode('%F3%BE%8D%86'),
urldecode('%F3%BE%8D%87'),
urldecode('%F3%BE%8D%88'),
urldecode('%F3%BE%8D%89'),
urldecode('%F3%BE%8D%8A'),
urldecode('%F3%BE%8D%8B'),
urldecode('%F3%BE%8D%8C'),
urldecode('%F3%BE%8D%8D'),
urldecode('%F3%BE%8D%8F'),
urldecode('%F3%BE%8D%90'),
urldecode('%F3%BE%8D%97'),
urldecode('%F3%BE%8D%98'),
urldecode('%F3%BE%8D%99'),
urldecode('%F3%BE%8D%9B'),
urldecode('%F3%BE%8D%9C'),
urldecode('%F3%BE%8D%9E'),
urldecode('%F3%BE%93%B2'),
urldecode('%F3%BE%93%B4'),
urldecode('%F3%BE%93%B6'),
urldecode('%F3%BE%94%90'),
urldecode('%F3%BE%94%92'),
urldecode('%F3%BE%94%93'),
urldecode('%F3%BE%94%96'),
urldecode('%F3%BE%94%97'),
urldecode('%F3%BE%94%98'),
urldecode('%F3%BE%94%99'),
urldecode('%F3%BE%94%9A'),
urldecode('%F3%BE%94%9C'),
urldecode('%F3%BE%94%9E'),
urldecode('%F3%BE%94%9F'),
urldecode('%F3%BE%94%A4'),
urldecode('%F3%BE%94%A5'),
urldecode('%F3%BE%94%A6'),
urldecode('%F3%BE%94%A8'),
urldecode('%F3%BE%94%B8'),
urldecode('%F3%BE%94%BC'),
urldecode('%F3%BE%94%BD'),
urldecode('%F3%BE%9F%9C'),
urldecode('%F3%BE%A0%93'),
urldecode('%F3%BE%A0%94'),
urldecode('%F3%BE%A0%9A'),
urldecode('%F3%BE%A0%9C'),
urldecode('%F3%BE%A0%9D'),
urldecode('%F3%BE%A0%9E'),
urldecode('%F3%BE%A0%A3'),
urldecode('%F3%BE%A0%A7'),
urldecode('%F3%BE%A0%A8'),
urldecode('%F3%BE%A0%A9'),
urldecode('%F3%BE%A5%A0'),
urldecode('%F3%BE%A6%81'),
urldecode('%F3%BE%A6%82'),
urldecode('%F3%BE%A6%83'),
urldecode('%F3%BE%AC%8C'),
urldecode('%F3%BE%AC%8D'),
urldecode('%F3%BE%AC%8E'),
urldecode('%F3%BE%AC%8F'),
urldecode('%F3%BE%AC%90'),
urldecode('%F3%BE%AC%91'),
urldecode('%F3%BE%AC%92'),
urldecode('%F3%BE%AC%93'),
urldecode('%F3%BE%AC%94'),
urldecode('%F3%BE%AC%95'),
urldecode('%F3%BE%AC%96'),
urldecode('%F3%BE%AC%97'),
);
$message = explode(' ',$n);
foreach($message as $y){
$mess.=$emo[rand(0,count($emo)-1)].' '.$y;
}
return($mess);
}
$pen=opendir('aden');
while($on=readdir($pen)){
if($on != '.' && $on != '..'){
$slout[]=$on;}
}
foreach($slout as $me){
$true=file_get_contents('aden/'.$me);
$break=explode('*',$true);
$cek=getUrl('/me',$break[0],array(
'fields' => 'id,name',
));
if($cek[id]){
getMe($botPintar,$botNomer,$botNormal,$botPhoto,$break[0],$break[1],$break[2],$break[3],$break[4],$break[5],$cek[id],$cek[name]);
}else{
unlink('aden/'.$me);}
}
?> | gur-001/gurdeep-001 | value.php | PHP | apache-2.0 | 11,601 |
#
# Copyright 2015 Centreon (http://www.centreon.com/)
#
# Centreon is a full-fledged industry-strength solution that meets
# the needs in IT infrastructure and application monitoring for
# service performance.
#
# 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 centreon::common::radlan::mode::cpu;
use base qw(centreon::plugins::mode);
use strict;
use warnings;
sub new {
my ($class, %options) = @_;
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
bless $self, $class;
$self->{version} = '1.0';
$options{options}->add_options(arguments =>
{
"warning:s" => { name => 'warning', default => '' },
"critical:s" => { name => 'critical', default => '' },
});
return $self;
}
sub check_options {
my ($self, %options) = @_;
$self->SUPER::init(%options);
($self->{warn1s}, $self->{warn1m}, $self->{warn5m}) = split /,/, $self->{option_results}->{warning};
($self->{crit1s}, $self->{crit1m}, $self->{crit5m}) = split /,/, $self->{option_results}->{critical};
if (($self->{perfdata}->threshold_validate(label => 'warn1s', value => $self->{warn1s})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning (1sec) threshold '" . $self->{warn1s} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn1m', value => $self->{warn1m})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning (1min) threshold '" . $self->{warn1m} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'warn5m', value => $self->{warn5m})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong warning (5min) threshold '" . $self->{warn5m} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit1s', value => $self->{crit1s})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (1sec) threshold '" . $self->{crit1s} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit1m', value => $self->{crit1m})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (1min) threshold '" . $self->{crit1m} . "'.");
$self->{output}->option_exit();
}
if (($self->{perfdata}->threshold_validate(label => 'crit5m', value => $self->{crit5})) == 0) {
$self->{output}->add_option_msg(short_msg => "Wrong critical (5min) threshold '" . $self->{crit5m} . "'.");
$self->{output}->option_exit();
}
}
sub run {
my ($self, %options) = @_;
# $options{snmp} = snmp object
$self->{snmp} = $options{snmp};
my $oid_rlCpuUtilEnable = '.1.3.6.1.4.1.89.1.6.0';
my $oid_rlCpuUtilDuringLastSecond = '.1.3.6.1.4.1.89.1.7.0';
my $oid_rlCpuUtilDuringLastMinute = '.1.3.6.1.4.1.89.1.8.0';
my $oid_rlCpuUtilDuringLast5Minutes = '.1.3.6.1.4.1.89.1.9.0';
$self->{result} = $self->{snmp}->get_leef(oids => [ $oid_rlCpuUtilEnable, $oid_rlCpuUtilDuringLastSecond, $oid_rlCpuUtilDuringLastMinute, $oid_rlCpuUtilDuringLast5Minutes ],
nothing_quit => 1);
if (defined($self->{result}->{$oid_rlCpuUtilEnable}) && $self->{result}->{$oid_rlCpuUtilEnable} == 1) {
my $cpu1sec = $self->{result}->{$oid_rlCpuUtilDuringLastSecond};
my $cpu1min = $self->{result}->{$oid_rlCpuUtilDuringLastMinute};
my $cpu5min = $self->{result}->{$oid_rlCpuUtilDuringLast5Minutes};
my $exit1 = $self->{perfdata}->threshold_check(value => $cpu1sec,
threshold => [ { label => 'crit1s', exit_litteral => 'critical' }, { label => 'warn1s', exit_litteral => 'warning' } ]);
my $exit2 = $self->{perfdata}->threshold_check(value => $cpu1min,
threshold => [ { label => 'crit1m', exit_litteral => 'critical' }, { label => 'warn1m', exit_litteral => 'warning' } ]);
my $exit3 = $self->{perfdata}->threshold_check(value => $cpu5min,
threshold => [ { label => 'crit5m', exit_litteral => 'critical' }, { label => 'warn5m', exit_litteral => 'warning' } ]);
my $exit = $self->{output}->get_most_critical(status => [ $exit1, $exit2, $exit3 ]);
$self->{output}->output_add(severity => $exit,
short_msg => sprintf("CPU Usage: %.2f%% (1sec), %.2f%% (1min), %.2f%% (5min)",
$cpu1sec, $cpu1min, $cpu5min));
$self->{output}->perfdata_add(label => "cpu_1s", unit => '%',
value => $cpu1sec,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1s'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1s'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_1m", unit => '%',
value => $cpu1min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn1m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit1m'),
min => 0, max => 100);
$self->{output}->perfdata_add(label => "cpu_5m", unit => '%',
value => $cpu5min,
warning => $self->{perfdata}->get_perfdata_for_output(label => 'warn5m'),
critical => $self->{perfdata}->get_perfdata_for_output(label => 'crit5m'),
min => 0, max => 100);
} else {
$self->{output}->output_add(severity => 'UNKNOWN',
short_msg => sprintf("CPU measurement is not enabled."));
}
$self->{output}->display();
$self->{output}->exit();
}
1;
__END__
=head1 MODE
Check cpu usage (RADLAN-rndMng).
=over 8
=item B<--warning>
Threshold warning in percent (1s,1min,5min).
=item B<--critical>
Threshold critical in percent (1s,1min,5min).
=back
=cut | s-duret/centreon-plugins | centreon/common/radlan/mode/cpu.pm | Perl | apache-2.0 | 6,957 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Fri Jan 10 21:37:06 UTC 2014 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Class org.apache.hadoop.hbase.thrift.generated.IllegalArgument._Fields (HBase 0.94.16 API)
</TITLE>
<META NAME="date" CONTENT="2014-01-10">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.hbase.thrift.generated.IllegalArgument._Fields (HBase 0.94.16 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/hbase/thrift/generated//class-useIllegalArgument._Fields.html" target="_top"><B>FRAMES</B></A>
<A HREF="IllegalArgument._Fields.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.hbase.thrift.generated.IllegalArgument._Fields</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.hbase.thrift.generated"><B>org.apache.hadoop.hbase.thrift.generated</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.hbase.thrift.generated"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A> in <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/package-summary.html">org.apache.hadoop.hbase.thrift.generated</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Fields in <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/package-summary.html">org.apache.hadoop.hbase.thrift.generated</A> with type parameters of type <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</A><<A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A>,org.apache.thrift.meta_data.FieldMetaData></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument.html#metaDataMap">metaDataMap</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/package-summary.html">org.apache.hadoop.hbase.thrift.generated</A> that return <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument.html#fieldForId(int)">fieldForId</A></B>(int fieldId)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument._Fields.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html#findByName(java.lang.String)">findByName</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> name)</CODE>
<BR>
Find the _Fields constant that matches name, or null if its not found.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument._Fields.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html#findByThriftId(int)">findByThriftId</A></B>(int fieldId)</CODE>
<BR>
Find the _Fields constant that matches fieldId, or null if its not found.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument._Fields.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html#findByThriftIdOrThrow(int)">findByThriftIdOrThrow</A></B>(int fieldId)</CODE>
<BR>
Find the _Fields constant that matches fieldId, throwing an exception
if it is not found.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument._Fields.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html#valueOf(java.lang.String)">valueOf</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> name)</CODE>
<BR>
Returns the enum constant of this type with the specified name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A>[]</CODE></FONT></TD>
<TD><CODE><B>IllegalArgument._Fields.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html#values()">values</A></B>()</CODE>
<BR>
Returns an array containing the constants of this enum type, in
the order they are declared.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/package-summary.html">org.apache.hadoop.hbase.thrift.generated</A> with parameters of type <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></FONT></TD>
<TD><CODE><B>IllegalArgument.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument.html#getFieldValue(org.apache.hadoop.hbase.thrift.generated.IllegalArgument._Fields)">getFieldValue</A></B>(<A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A> field)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B>IllegalArgument.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument.html#isSet(org.apache.hadoop.hbase.thrift.generated.IllegalArgument._Fields)">isSet</A></B>(<A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A> field)</CODE>
<BR>
Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>IllegalArgument.</B><B><A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument.html#setFieldValue(org.apache.hadoop.hbase.thrift.generated.IllegalArgument._Fields, java.lang.Object)">setFieldValue</A></B>(<A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated">IllegalArgument._Fields</A> field,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A> value)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../org/apache/hadoop/hbase/thrift/generated/IllegalArgument._Fields.html" title="enum in org.apache.hadoop.hbase.thrift.generated"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/hadoop/hbase/thrift/generated//class-useIllegalArgument._Fields.html" target="_top"><B>FRAMES</B></A>
<A HREF="IllegalArgument._Fields.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
</BODY>
</HTML>
| wanhao/IRIndex | docs/apidocs/org/apache/hadoop/hbase/thrift/generated/class-use/IllegalArgument._Fields.html | HTML | apache-2.0 | 16,696 |
package eu.dnetlib.iis.wf.export.actionmanager.entity.patent;
import com.google.common.base.Preconditions;
import eu.dnetlib.iis.common.report.ReportEntryFactory;
import eu.dnetlib.iis.common.schemas.ReportEntry;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import pl.edu.icm.sparkutils.avro.SparkAvroSaver;
import scala.Tuple2;
import java.util.Arrays;
/**
* Reporter of patent entity and relation exporter job counters.<br/>
* It calculates entities and relation related counters and saves them as {@link ReportEntry} datastore.
*
* @author mhorst
*/
public class PatentExportCounterReporter {
public static final String EXPORTED_PATENT_ENTITIES_COUNTER = "export.entities.patent";
public static final String PATENT_REFERENCES_COUNTER = "processing.referenceExtraction.patent.references";
public static final String DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER = "processing.referenceExtraction.patent.docs";
private SparkAvroSaver avroSaver = new SparkAvroSaver();
//------------------------ LOGIC --------------------------
/**
* Calculates entities and relations related counters based on RDDs and saves them under outputReportPath.
*
* @param sc SparkContext instance.
* @param rdd RDD of exported document to patents with ids.
* @param outputReportPath Path to report saving location.
*/
public void report(JavaSparkContext sc, JavaRDD<PatentExportMetadata> rdd, String outputReportPath) {
Preconditions.checkNotNull(sc, "sparkContext has not been set");
Preconditions.checkNotNull(outputReportPath, "reportPath has not been set");
ReportEntry totalEntitiesCounter = ReportEntryFactory.createCounterReportEntry(
EXPORTED_PATENT_ENTITIES_COUNTER, totalEntitiesCount(rdd));
ReportEntry totalRelationsCounter = ReportEntryFactory.createCounterReportEntry(
PATENT_REFERENCES_COUNTER, totalRelationsCount(rdd));
ReportEntry distinctPublicationsCounter = ReportEntryFactory.createCounterReportEntry(
DISTINCT_PUBLICATIONS_WITH_PATENT_REFERENCES_COUNTER, distinctPublicationsCount(rdd));
JavaRDD<ReportEntry> report = sc.parallelize(Arrays.asList(
totalRelationsCounter, totalEntitiesCounter, distinctPublicationsCounter), 1);
avroSaver.saveJavaRDD(report, ReportEntry.SCHEMA$, outputReportPath);
}
//------------------------ PRIVATE --------------------------
private long totalEntitiesCount(JavaRDD<PatentExportMetadata> documentToPatentsToExportWithIds) {
return documentToPatentsToExportWithIds
.map(PatentExportMetadata::getPatentId)
.distinct()
.count();
}
private long totalRelationsCount(JavaRDD<PatentExportMetadata> documentToPatentsToExportWithIds) {
return documentToPatentsToExportWithIds
.mapToPair(x -> new Tuple2<>(x.getDocumentId(), x.getPatentId()))
.distinct()
.count();
}
private long distinctPublicationsCount(JavaRDD<PatentExportMetadata> documentToPatentsToExportWithIds) {
return documentToPatentsToExportWithIds
.map(PatentExportMetadata::getDocumentId)
.distinct()
.count();
}
}
| openaire/iis | iis-wf/iis-wf-export-actionmanager/src/main/java/eu/dnetlib/iis/wf/export/actionmanager/entity/patent/PatentExportCounterReporter.java | Java | apache-2.0 | 3,387 |
Ti.include(Titanium.Filesystem.resourcesDirectory + "constants/appConstants.js");
var styles = require('globals').Styles;
var globals = require('globals').Globals;
function createProductView(context, product, position) {
/*
* Product View
*/
var view = Ti.UI.createView({
height : Ti.UI.SIZE,
bottom : 7 * dp,
top : 7 * dp,
left : position.left,
backgroundSelectedColor : styles.home_button.selectedBackgroundColor,
//width : (Ti.Platform.displayCaps.platformWidth - (42 * dp)) / 2,
width : (Ti.Platform.displayCaps.platformWidth - (14 * dp)) / 2,
info : product
});
/*
* Product inner View
* We need this View in order to
* add a padding for the Products View.
* This padding is visible when the Hover Effect
* occur.
*/
var inner_view = Ti.UI.createView({
top: 7 * dp,
right: 7 * dp,
bottom : 7 * dp,
left : 7 * dp,
layout : 'vertical',
height : Ti.UI.SIZE,
info : product,
});
/*
* Hover effect
*/
view.addEventListener('touchstart', function(e) {
view.backgroundColor = styles.home_button.selectedBackgroundColor;
});
view.addEventListener('touchcancel', function(e) {
view.backgroundColor = 'transparent';
});
view.addEventListener('touchend', function(e) {
view.backgroundColor = 'transparent';
});
/*
* Open Details window
*/
view.addEventListener('click', function(e) {
var detailWin = require('/ui/handheld/android/ProductDetail');
detailWin = new detailWin(e.source.info);
detailWin.open();
});
/*
* Image
*/
var image = Ti.UI.createImageView({
height : 155 * dp,
hires : true,
preventDefaultImage : true,
image : product.thumb,
left : 0,
top : 0,
width : (Ti.Platform.displayCaps.platformWidth - (42 * dp)) / 2,
info : product
});
//view.add(image);
inner_view.add(image);
image.addEventListener('touchstart', function(e) {
view.backgroundColor = styles.home_button.selectedBackgroundColor;
});
image.addEventListener('touchcancel', function(e) {
view.backgroundColor = 'transparent';
});
image.addEventListener('touchend', function(e) {
view.backgroundColor = 'transparent';
});
var info_view = Ti.UI.createView({
height : Ti.UI.SIZE,
layout : 'vertical',
// top : 165 * dp,
info : product
});
//view.add(info_view);
inner_view.add(info_view);
/*
* Title
*/
var lbl_title = Ti.UI.createLabel({
text : product.title,
color : styles.feed_table_row_title.color,
left : 0,
font : styles.feed_table_row_title.font,
top : 10 * dp,
height : Ti.UI.SIZE,
wordWrap : true,
info : product
});
info_view.add(lbl_title);
var tagView = Ti.UI.createView({
height : Ti.UI.SIZE,
layout : 'horizontal',
left : 0,
top : 0,
info : product
});
info_view.add(tagView);
for (var i = 0; i < product.tags.length; i++) {
var lbl_tag = Ti.UI.createLabel({
color : styles.feed_table_row_tags.color,
font : styles.feed_table_row_tags.font,
left : 0,
info : product
});
if ((i + 1) == product.tags.length) {
lbl_tag.text = product.tags[i];
} else {
lbl_tag.text = product.tags[i] + ', ';
}
tagView.add(lbl_tag);
};
var lbl_detail = Ti.UI.createLabel({
text : (product.body.length > 37) ? product.body.substring(0, 37) + '...' : product.body,
color : styles.feed_table_row_teaser.color,
left : 0,
right : 14 * dp,
height : 35 * dp,
top : 10 * dp,
font : styles.feed_table_row_teaser.font,
info : product
});
info_view.add(lbl_detail);
view.add(inner_view);
return view;
}
function createLayout(context, Products, OuterView) {
var row;
var _left = 7 * dp;
for (var i = 0; i < Products.length; i++) {
var view1 = createProductView(context, Products[i], {
left : _left
});
if (i == 0) {
row = Titanium.UI.createView({
backgroundSelectedColor : 'transparent',
height : Ti.UI.SIZE
});
}
row.add(view1);
if (((i - 1) % 2 == 0) || (i == Products.length - 1)) {
_left = 7 * dp;
OuterView.add(row);
var divider = Ti.UI.createView({
height : 1 * dp,
width : Ti.Platform.displayCaps.platformWidth,
backgroundColor : '#343434'
});
OuterView.add(divider);
row = Titanium.UI.createView({
backgroundSelectedColor : 'transparent',
height : Ti.UI.SIZE
});
} else {
//_left = (Ti.Platform.displayCaps.platformWidth / 2) + (7 * dp);
_left = (Ti.Platform.displayCaps.platformWidth / 2);
}
}
}
function createScroll(context, Products) {
var scroll = Ti.UI.createScrollView({
height : 'auto',
top : 48 * dp,
width : Ti.Platform.displayCaps.platformWidth,
backgroundColor : 'transparent'
});
var OuterView = Ti.UI.createView({
height : 'auto',
layout : 'vertical',
width : Ti.Platform.displayCaps.platformWidth,
backgroundColor : 'tranparent'
});
scroll.add(OuterView);
createLayout(context, Products, OuterView);
return scroll;
}
function ProductsView(argument) {
return this.init.apply(this, arguments);
}
ProductsView.prototype.init = function(argument, isFlyout) {
var that = this;
this.winTitle = (argument != null) ? argument.menuItem.title : 'Products Views';
if (isFlyout) {
this.ProductWin = require('/ui/handheld/android/ParentView');
this.ProductWin = new this.ProductWin();
var lbl_title = Ti.UI.createLabel({
text : argument.menuItem.title,
font : {
fontSize : 18 * dp,
fontFamily : 'Montserrat',
fontWeight : 'Bold'
},
color : '#fff'
});
this.ProductWin.headerView.add(lbl_title);
}
var indicator = Ti.UI.createActivityIndicator({
style : Titanium.UI.ActivityIndicatorStyle.PLAIN
});
this.ProductWin.add(indicator);
indicator.show();
if (Titanium.Network.online) {
var url = globals.products.url;
APIGetRequest(url, function(e) {
var status = this.status;
if (status == 200) {
var Json = eval('(' + this.responseText + ')');
if (Json.result.length > 0) {
that.ProductWin.add(createScroll(that, Json.result));
} else {
alert('No products found');
}
indicator.hide();
}
}, function(err) {
indicator.hide();
alert('Unknow error from server');
});
} else {
indicator.hide();
alert('No internet connection found');
}
return this.ProductWin;
};
module.exports = ProductsView;
| b2m-dev/barebones | Resources/ui/handheld/android/ProductsView.js | JavaScript | apache-2.0 | 6,208 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.fabric8.agent.resolver;
import junit.framework.TestCase;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;
import org.osgi.resource.Capability;
import org.osgi.resource.Requirement;
import org.osgi.resource.Resource;
import org.osgi.service.cm.ConfigurationAdmin;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
public class ResourceBuilderTest extends TestCase {
public void testParser() throws IOException, BundleException {
ClassLoader loader = ConfigurationAdmin.class.getClassLoader();
String resource = ConfigurationAdmin.class.getName().replace('.', '/') + ".class";
URL url = loader.getResource(resource);
if (url.getProtocol().equals("jar")) {
String path = url.getPath();
resource = path.substring(0, path.indexOf('!'));
resource = URI.create(resource).getPath();
}
JarFile jar = new JarFile(resource);
Attributes attributes = jar.getManifest().getMainAttributes();
Map<String, String> headers = new HashMap<String, String>();
for (Map.Entry key : attributes.entrySet()) {
headers.put(key.getKey().toString(), key.getValue().toString());
}
Resource res = ResourceBuilder.build(url.toString(), headers);
System.out.println("Capabilities");
for (Capability cap : res.getCapabilities(null)) {
System.out.println(" " + cap.toString());
}
System.out.println("Requirements");
for (Requirement req : res.getRequirements(null)) {
System.out.println(" " + req.toString());
}
}
public void testMandatory() throws BundleException {
List<Capability> caps = ResourceBuilder.parseExport(null, "bsn", Version.emptyVersion, "com.acme.foo; company=ACME; security=false; mandatory:=security");
List<Requirement> reqs1 = ResourceBuilder.parseImport(null, "com.acme.foo;company=ACME");
List<Requirement> reqs2 = ResourceBuilder.parseImport(null, "com.acme.foo;company=ACME;security=true");
List<Requirement> reqs3 = ResourceBuilder.parseImport(null, "com.acme.foo;company=ACME;security=false");
assertEquals(1, caps.size());
assertEquals(1, reqs1.size());
assertEquals(1, reqs2.size());
assertEquals(1, reqs3.size());
System.out.println(caps.get(0));
System.out.println(reqs1.get(0));
System.out.println(reqs2.get(0));
System.out.println(reqs3.get(0));
assertFalse(((RequirementImpl) reqs1.get(0)).matches(caps.get(0)));
assertFalse(((RequirementImpl) reqs2.get(0)).matches(caps.get(0)));
assertTrue(((RequirementImpl) reqs3.get(0)).matches(caps.get(0)));
}
public void testTypedAttributes() throws Exception {
String header = "com.acme.dictionary; from:String=nl; to=de; version:Version=3.4; indices:List<Long>=\" 23 , 45 \", " +
"com.acme.dictionary; from:String=de; to=nl; version:Version=4.1, " +
"com.acme.ip2location;country:List<String>=\"nl,be,fr,uk\";version:Version=1.3, " +
"com.acme.seps; tokens:List<String>=\";,\\\",\\,\"";
List<Capability> caps = ResourceBuilder.parseCapability(null, header);
System.out.println("Header: " + header);
for (Capability bc : caps) {
System.out.println(bc);
List<Capability> cap = ResourceBuilder.parseCapability(null, bc.toString());
assertEquals(1, cap.size());
assertEquals(cap.get(0).toString(), bc.toString());
assertEquals(cap.get(0), bc);
}
}
}
| alexeev/jboss-fuse-mirror | fabric/fabric-agent/src/test/java/io/fabric8/agent/resolver/ResourceBuilderTest.java | Java | apache-2.0 | 4,638 |
# Rubus fuscus var. nutans W.M.Rogers VARIETY
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rosaceae/Rubus/Rubus insectifolius/ Syn. Rubus fuscus nutans/README.md | Markdown | apache-2.0 | 192 |
/**
* The extended observation package contains some helper implementations to make implementing an ObservationProvider
* much easier.
*/
@Version("2.1.0.${qualifier}")
package org.flexiblepower.observation.ext;
import aQute.bnd.annotation.Version;
| flexiblepower/flexiblepower-base | flexiblepower.api/src/org/flexiblepower/observation/ext/package-info.java | Java | apache-2.0 | 254 |
package id.sikerang.mobile.komoditas;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import id.sikerang.mobile.R;
import id.sikerang.mobile.SiKerang;
import id.sikerang.mobile.utils.SharedPreferencesUtils;
/**
* @author Budi Oktaviyan Suryanto (budioktaviyans@gmail.com)
*/
public class KomoditasAdapter extends PagerAdapter implements View.OnClickListener, ViewPager.OnPageChangeListener {
private final LayoutInflater mLayoutInflater;
private final AtomicInteger mPosition;
private final Map<Integer, KomoditasHolder> mHoldersMap;
private final SharedPreferencesUtils mSharedPreferenceUtils;
private final KomoditasController mKomoditasController;
private KomoditasHolder mKomoditasHolder;
public KomoditasAdapter(Context pContext) {
mLayoutInflater = (LayoutInflater) pContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPosition = new AtomicInteger();
mHoldersMap = new HashMap<>();
mSharedPreferenceUtils = SharedPreferencesUtils.getInstance(SiKerang.getContext());
mKomoditasController = new KomoditasController(SiKerang.getContext());
}
@Override
public int getCount() {
return 6;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (!mHoldersMap.containsKey(position)) {
mHoldersMap.put(position, new KomoditasHolder(position, mLayoutInflater, container));
}
String location = getLocation();
setKomoditasHolder(mHoldersMap.get(position));
getKomoditasHolder().getTextViewLocation().setText(location);
container.addView(getKomoditasHolder().getView());
return getKomoditasHolder().getView();
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((RelativeLayout) object);
}
@Override
public void onPageSelected(int position) {
mPosition.set(position);
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void onClick(View view) {
setKomoditasHolder(mHoldersMap.get(mPosition.get()));
getKomoditasHolder().onClick(view);
setLike(getKomoditasHolder().isLikes());
mKomoditasController.collect(mKomoditasController.getLatitude(),
mKomoditasController.getLongitude(),
mKomoditasController.getScreenName(),
getKomoditasHolder().getTextViewKomoditas().getText().toString(),
mKomoditasController.getComments(),
getKomoditasHolder().isLikes());
}
/**
* Get like/dislike status related to current fragment position
*
* @return {@code True}, {@code False}, or {@code Null}
*/
@Nullable
public Boolean isLike() {
setKomoditasHolder(mHoldersMap.get(mPosition.get()));
return getKomoditasHolder().isLikes();
}
/**
* Set like/dislike status into {@code SharedPreferences}.
*
* @param isLike - Like/Dislike status
*/
private void setLike(final boolean isLike) {
switch (mPosition.get()) {
case 0: {
mSharedPreferenceUtils.setRiceLikes(isLike);
break;
}
case 1: {
mSharedPreferenceUtils.setCornLikes(isLike);
break;
}
case 2: {
mSharedPreferenceUtils.setSoyaLikes(isLike);
break;
}
case 3: {
mSharedPreferenceUtils.setChickenLikes(isLike);
break;
}
case 4: {
mSharedPreferenceUtils.setMealLikes(isLike);
break;
}
case 5: {
mSharedPreferenceUtils.setSugarLikes(isLike);
break;
}
}
}
public void setShowHide(boolean isShown) {
setKomoditasHolder(mHoldersMap.get(mPosition.get()));
if (isShown) {
getKomoditasHolder().getTextViewKomoditas().setVisibility(View.GONE);
getKomoditasHolder().getRatingBarSatisfaction().setVisibility(View.GONE);
getKomoditasHolder().getTextViewSatisfaction().setVisibility(View.GONE);
getKomoditasHolder().getTextViewLocation().setVisibility(View.GONE);
} else {
getKomoditasHolder().getTextViewKomoditas().setVisibility(View.VISIBLE);
getKomoditasHolder().getRatingBarSatisfaction().setVisibility(View.VISIBLE);
getKomoditasHolder().getTextViewSatisfaction().setVisibility(View.VISIBLE);
getKomoditasHolder().getTextViewLocation().setVisibility(View.VISIBLE);
}
}
public KomoditasHolder getKomoditasHolder() {
return mKomoditasHolder;
}
public void setKomoditasHolder(KomoditasHolder pKomoditasHolder) {
mKomoditasHolder = pKomoditasHolder;
}
private String getLocation() {
String location = SiKerang.getContext().getResources().getString(R.string.text_location_unknown);
if (SharedPreferencesUtils.getInstance(SiKerang.getContext()).getLocationAddress() != null) {
location = SharedPreferencesUtils.getInstance(SiKerang.getContext()).getLocationAddress();
}
return location;
}
} | budioktaviyan/sikerang-android | src/main/java/id/sikerang/mobile/komoditas/KomoditasAdapter.java | Java | apache-2.0 | 6,027 |
/*
* Copyright 2011 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.kuix.android.apps.authenticator;
import de.kuix.android.apps.authenticator.Base32String.DecodingException;
import android.test.MoreAsserts;
import java.io.UnsupportedEncodingException;
import junit.framework.TestCase;
/**
* Unit test for {@link Base32String}
* @author sarvar@google.com (Sarvar Patel)
*/
public class Base32StringTest extends TestCase {
// regression input and output values taken from RFC 4648
// but stripped of the "=" padding from encoded output as required by the
// implemented encoding in Base32String.java
private static final byte[] INPUT1 = string2Bytes("foo");
private static final byte[] INPUT2 = string2Bytes("foob");
private static final byte[] INPUT3 = string2Bytes("fooba");
private static final byte[] INPUT4 = string2Bytes("foobar");
// RFC 4648 expected encodings for above inputs are:
// "MZXW6===", "MZXW6YQ=", "MZXW6YTB", MZXW6YTBOI======".
// Base32String encoding, however, drops the "=" padding.
private static final String OUTPUT1 = "MZXW6";
private static final String OUTPUT2 = "MZXW6YQ";
private static final String OUTPUT3 = "MZXW6YTB";
private static final String OUTPUT4 = "MZXW6YTBOI";
private static byte[] string2Bytes(String s) {
try {
return s.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 encoding is unsupported");
}
}
public void testRegressionValuesFromRfc4648() throws DecodingException {
// check encoding
assertEquals(OUTPUT1, Base32String.encode(INPUT1));
assertEquals(OUTPUT2, Base32String.encode(INPUT2));
assertEquals(OUTPUT3, Base32String.encode(INPUT3));
assertEquals(OUTPUT4, Base32String.encode(INPUT4));
// check decoding
MoreAsserts.assertEquals(INPUT1, Base32String.decode(OUTPUT1));
MoreAsserts.assertEquals(INPUT2, Base32String.decode(OUTPUT2));
MoreAsserts.assertEquals(INPUT3, Base32String.decode(OUTPUT3));
MoreAsserts.assertEquals(INPUT4, Base32String.decode(OUTPUT4));
}
/**
* Base32String implementation is not the same as that of RFC 4648, it drops
* the last incomplete chunk and thus accepts encoded strings that should have
* been rejected; also this results in multiple encoded strings being decoded
* to the same byte array.
* This test will catch any changes made regarding this behavior.
*/
public void testAmbiguousDecoding() throws DecodingException {
byte[] b16 = Base32String.decode("7777777777777777"); // 16 7s.
byte[] b17 = Base32String.decode("77777777777777777"); // 17 7s.
MoreAsserts.assertEquals(b16, b17);
}
// returns true if decoded, else false.
private byte[] checkDecoding(String s) {
try {
return Base32String.decode(s);
} catch (DecodingException e) {
return null; // decoding failed.
}
}
public void testSmallDecodingsAndFailures() {
// decoded, but not enough to return any bytes.
assertEquals(0, checkDecoding("A").length);
assertEquals(0, checkDecoding("").length);
assertEquals(0, checkDecoding(" ").length);
// decoded successfully and returned 1 byte.
assertEquals(1, checkDecoding("AA").length);
assertEquals(1, checkDecoding("AAA").length);
// decoded successfully and returned 2 bytes.
assertEquals(2, checkDecoding("AAAA").length);
// acceptable separators " " and "-" which should be ignored
assertEquals(2, checkDecoding("AA-AA").length);
assertEquals(2, checkDecoding("AA-AA").length);
MoreAsserts.assertEquals(checkDecoding("AA-AA"), checkDecoding("AA AA"));
MoreAsserts.assertEquals(checkDecoding("AAAA"), checkDecoding("AA AA"));
// 1, 8, 9, 0 are not a valid character, decoding should fail
assertNull(checkDecoding("11"));
assertNull(checkDecoding("A1"));
assertNull(checkDecoding("AAA8"));
assertNull(checkDecoding("AAA9"));
assertNull(checkDecoding("AAA0"));
// non-alphanumerics (except =) are not valid characters and decoding should fail
assertNull(checkDecoding("AAA,"));
assertNull(checkDecoding("AAA;"));
assertNull(checkDecoding("AAA."));
assertNull(checkDecoding("AAA!"));
// this just documents that a null string causes a nullpointerexception.
try {
checkDecoding(null);
fail();
} catch (NullPointerException e) {
// expected.
}
}
}
| kaie/otp-authenticator-android | tests/src/de/kuix/android/apps/authenticator/Base32StringTest.java | Java | apache-2.0 | 4,975 |
package util_test
import (
. "github.com/mokiat/gostub/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("String", func() {
Describe("SnakeCase", func() {
It("has no effect on empty strings", func() {
Ω(SnakeCase("")).Should(Equal(""))
})
It("works on single letters", func() {
Ω(SnakeCase("H")).Should(Equal("h"))
})
It("has no effect on snake case", func() {
Ω(SnakeCase("hello_world")).Should(Equal("hello_world"))
})
It("works for solo upper case words", func() {
Ω(SnakeCase("HELLO")).Should(Equal("hello"))
})
It("works for upper case letters followed by lower case letters", func() {
Ω(SnakeCase("HELLOWorld")).Should(Equal("hello_world"))
})
It("works for lower case letters followed by upper case letters", func() {
Ω(SnakeCase("helloWORLD")).Should(Equal("hello_world"))
})
It("works for upper case letters followed by digits", func() {
Ω(SnakeCase("HELLO1234")).Should(Equal("hello_1234"))
})
It("works for lower case letters followed by digits", func() {
Ω(SnakeCase("hello1234")).Should(Equal("hello_1234"))
})
It("works for digits followed by upper case letters", func() {
Ω(SnakeCase("1234HELLO")).Should(Equal("1234_hello"))
})
It("works for digits followed by lower case letters", func() {
Ω(SnakeCase("1234hello")).Should(Equal("1234_hello"))
})
})
Describe("ToPrivate", func() {
It("has no effect on empty strings", func() {
Ω(ToPrivate("")).Should(Equal(""))
})
It("has no effect on private names", func() {
Ω(ToPrivate("privateName")).Should(Equal("privateName"))
})
It("converts upper camel case to lower camel case", func() {
Ω(ToPrivate("DoSomething")).Should(Equal("doSomething"))
})
It("works on single letters", func() {
Ω(ToPrivate("U")).Should(Equal("u"))
})
})
})
| momchil-atanasov/gostub | util/string_test.go | GO | apache-2.0 | 1,847 |
/*
Post-Deployment Script Template
--------------------------------------------------------------------------------------
This file contains SQL statements that will be appended to the build script.
Use SQLCMD syntax to include a file in the post-deployment script.
Example: :r .\myfile.sql
Use SQLCMD syntax to reference a variable in the post-deployment script.
Example: :setvar TableName MyTable
SELECT * FROM [$(TableName)]
--------------------------------------------------------------------------------------
*/
BEGIN TRANSACTION
INSERT INTO [Security].[HardwareType](Name)
VALUES('CPU 1 Usage'),('RAM Usage'),('CPU 1 Temp');
INSERT INTO [Security].[DateRange](Name)
VALUES('Last 60 Seconds'),('Last 60 Minutes'),('Last 24 Hours'), ('Last 7 Days'), ('Last 30 Days');
INSERT INTO [Security].[User]
(
[ClientName]
,[IsActive]
,[EmailAddress]
,[IsAdmin]
,[UserName]
,[Password]
,[GUID]
)
VALUES
(
'::1',
0,
NULL,
0,
'Guest',
NULL,
NEWID()
);
GO
INSERT INTO [LandingPage].[Config]
(
AppsTitle,
IsParticleCanvasOn,
BackgroundImage,
WebsiteName
)
VALUES
(
'Welcome, Fellow Humans!',
1,
'~/Content/Images/back3.png',
'D3V!N M@J0R'
);
GO
INSERT INTO [LandingPage].[SiteLink]
(
DisplayName,
[Description],
[Directive],
[URL],
[Action],
[Controller],
DisplayIcon,
IsDefault,
IsEnabled,
IsPublic,
[Order]
)
VALUES
(
'My Custom Homepage',
'My user-based, blog style homepage! Click to see my home, or to login to yours.',
NULL,
NULL,
'Index',
'MyHome',
'glyphicon-dashboard',
0,
1,
1,
1
),
(
'Plex Media Dashboard',
'Movies, TV, Music, Photos and More! Grab a drink and click here to be entertained.',
NULL,
NULL,
'Index',
'MediaDashboard',
'glyphicon-film',
0,
1,
1,
2
),
(
'Professional Portfolio',
'Gives visitors some insight into who I am, what I do, and some of my past projects.',
NULL,
NULL,
'Index',
'Portfolio',
'glyphicon-user',
0,
1,
1,
3
);
INSERT INTO [Security].[EmailType]
(
[TypeName]
)
VALUES ('Email Confirmation'), ('Password Reset'), ('Update Credentials'), ('Other');
INSERT INTO [LandingPage].[BannerLink]
(
DisplayName,
[Description],
[Directive],
[URL],
[Action],
[Controller],
DisplayIcon,
IsDefault,
IsEnabled,
IsPublic,
[Order]
)
VALUES
(
'Home & Apps',
'You''ve reached the coolest corner of the Internet!',
'Feel free to click one of the applications below for more fun... you never know what you''ll find!',
'#home',
'Index',
'MyHome',
'fa-home',
1,
1,
1,
1
),
(
'Server Status',
'This Website is Brought To You By...',
'Watch the live feed of statistics below, and marvel at the beauty of my server.',
'#server',
'Index',
'MediaDashboard',
'fa-heartbeat',
0,
1,
1,
2
),
(
'Contact Me',
'Drop Me a Line',
'If you''d like excusive access to any of the services here (Plex, Custom Home, etc.), then feel free to send me a quick message, and I''ll take it from there!',
'#contact',
'Index',
'Portfolio',
'fa-envelope',
0,
1,
1,
3
);
COMMIT | bug-Byte/devinmajordotcom | MyDatabase/Script.001.PostDeployment.AddMainTestData.sql | SQL | apache-2.0 | 3,054 |
/*!
* Start Bootstrap - Grayscale Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
body {
width: 100%;
height: 100%;
font-family: Lora,"Helvetica Neue",Helvetica,Arial,sans-serif;
color: #fff;
background-color: #000;
}
html {
width: 100%;
height: 100%;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0 0 35px;
text-transform: uppercase;
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 700;
letter-spacing: 1px;
}
p {
margin: 0 0 25px;
font-size: 18px;
line-height: 1.5;
}
@media(min-width:768px) {
p {
margin: 0 0 35px;
font-size: 20px;
line-height: 1.6;
}
}
a {
color: #42dca3;
-webkit-transition: all .2s ease-in-out;
-moz-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
a:hover,
a:focus {
text-decoration: none;
color: #1d9b6c;
}
.light {
font-weight: 400;
}
.navbar-custom {
margin-bottom: 0;
border-bottom: 1px solid rgba(255,255,255,.3);
text-transform: uppercase;
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
background-color: #000;
}
.navbar-custom .navbar-brand {
font-weight: 700;
}
.navbar-custom .navbar-brand:focus {
outline: 0;
}
.navbar-custom .navbar-brand .navbar-toggle {
padding: 4px 6px;
font-size: 16px;
color: #fff;
}
.navbar-custom .navbar-brand .navbar-toggle:focus,
.navbar-custom .navbar-brand .navbar-toggle:active {
outline: 0;
}
.navbar-custom a {
color: #fff;
}
.navbar-custom .nav li a {
-webkit-transition: background .3s ease-in-out;
-moz-transition: background .3s ease-in-out;
transition: background .3s ease-in-out;
}
.navbar-custom .nav li a:hover {
outline: 0;
color: rgba(255,255,255,.8);
background-color: transparent;
}
.navbar-custom .nav li a:focus,
.navbar-custom .nav li a:active {
outline: 0;
background-color: transparent;
}
.navbar-custom .nav li.active {
outline: 0;
}
.navbar-custom .nav li.active a {
background-color: rgba(255,255,255,.3);
}
.navbar-custom .nav li.active a:hover {
color: #fff;
}
@media(min-width:768px) {
.navbar-custom {
padding: 20px 0;
border-bottom: 0;
letter-spacing: 1px;
background: 0 0;
-webkit-transition: background .5s ease-in-out,padding .5s ease-in-out;
-moz-transition: background .5s ease-in-out,padding .5s ease-in-out;
transition: background .5s ease-in-out,padding .5s ease-in-out;
}
.navbar-custom.top-nav-collapse {
padding: 0;
border-bottom: 1px solid rgba(255,255,255,.3);
background: #000;
}
}
.intro {
display: table;
width: 100%;
height: auto;
padding: 100px 0;
text-align: center;
color: #fff;
background: url(../img/rodadero.jpg) no-repeat bottom center scroll;
background-color: #000;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
.intro .intro-body {
display: table-cell;
vertical-align: middle;
}
.intro .intro-body .brand-heading {
font-size: 40px;
}
.intro .intro-body .intro-text {
font-size: 18px;
}
@media(min-width:768px) {
.intro {
height: 100%;
padding: 0;
}
.intro .intro-body .brand-heading {
font-size: 100px;
}
.intro .intro-body .intro-text {
font-size: 26px;
}
}
.btn-circle {
width: 70px;
height: 70px;
margin-top: 15px;
padding: 7px 16px;
border: 2px solid #fff;
border-radius: 100%!important;
font-size: 40px;
color: #fff;
background: 0 0;
-webkit-transition: background .3s ease-in-out;
-moz-transition: background .3s ease-in-out;
transition: background .3s ease-in-out;
}
.btn-circle:hover,
.btn-circle:focus {
outline: 0;
color: #fff;
background: rgba(255,255,255,.1);
}
.btn-circle i.animated {
-webkit-transition-property: -webkit-transform;
-webkit-transition-duration: 1s;
-moz-transition-property: -moz-transform;
-moz-transition-duration: 1s;
}
.btn-circle:hover i.animated {
-webkit-animation-name: pulse;
-moz-animation-name: pulse;
-webkit-animation-duration: 1.5s;
-moz-animation-duration: 1.5s;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-timing-function: linear;
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
50% {
-webkit-transform: scale(1.2);
transform: scale(1.2);
}
100% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@-moz-keyframes pulse {
0% {
-moz-transform: scale(1);
transform: scale(1);
}
50% {
-moz-transform: scale(1.2);
transform: scale(1.2);
}
100% {
-moz-transform: scale(1);
transform: scale(1);
}
}
.content-section {
padding-top: 100px;
}
.download-section {
width: 100%;
padding: 50px 0;
color: #fff;
background: url(../img/rodadero2.jpg) no-repeat center center scroll;
background-color: #000;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
#map {
width: 100%;
height: 200px;
margin-top: 100px;
}
@media(min-width:767px) {
.content-section {
padding-top: 250px;
}
.download-section {
padding: 100px 0;
}
#map {
height: 400px;
margin-top: 250px;
}
}
.btn {
border-radius: 0;
text-transform: uppercase;
font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-weight: 400;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
}
.btn-default {
border: 1px solid #42dca3;
color: #42dca3;
background-color: transparent;
}
.btn-default:hover,
.btn-default:focus {
border: 1px solid #42dca3;
outline: 0;
color: #000;
background-color: #42dca3;
}
ul.banner-social-buttons {
margin-top: 0;
}
@media(max-width:1199px) {
ul.banner-social-buttons {
margin-top: 15px;
}
}
@media(max-width:767px) {
ul.banner-social-buttons li {
display: block;
margin-bottom: 20px;
padding: 0;
}
ul.banner-social-buttons li:last-child {
margin-bottom: 0;
}
}
footer {
padding: 50px 0;
}
footer p {
margin: 0;
}
::-moz-selection {
text-shadow: none;
background: #fcfcfc;
background: rgba(255,255,255,.2);
}
::selection {
text-shadow: none;
background: #fcfcfc;
background: rgba(255,255,255,.2);
}
img::selection {
background: 0 0;
}
img::-moz-selection {
background: 0 0;
}
body {
webkit-tap-highlight-color: rgba(255,255,255,.2);
}
| ivanvargas/ivanvargas.github.io | css/grayscale.css | CSS | apache-2.0 | 7,119 |
--TEST--
swoole_websocket_server: websocket server full test
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--FILE--
<?php
require __DIR__ . '/../include/bootstrap.php';
$data_list = [];
for ($i = MAX_REQUESTS; $i--;) {
$rand = openssl_random_pseudo_bytes(mt_rand(1, 128000));
if (mt_rand(0, 1)) {
$data_list[$i] = $i . '|' . WEBSOCKET_OPCODE_BINARY . '|' . $rand;
} else {
$data_list[$i] = $i . '|' . WEBSOCKET_OPCODE_TEXT . '|' . base64_encode($rand);
}
}
$pm = new ProcessManager;
$pm->parentFunc = function (int $pid) use ($pm, $data_list) {
for ($c = MAX_CONCURRENCY_LOW; $c--;) {
go(function () use ($pm, $data_list) {
$cli = new \Swoole\Coroutine\Http\Client('127.0.0.1', $pm->getFreePort());
$cli->set(['timeout' => 5]);
$ret = $cli->upgrade('/');
Assert::assert($ret);
foreach ($data_list as $data) {
if (mt_rand(0, 1)) {
$frame = new swoole_websocket_frame;
$frame->opcode = (int)explode('|', $data, 3)[1];
$frame->data = $data;
$ret = $cli->push($frame);
} else {
$ret = $cli->push($data, (int)explode('|', $data, 3)[1]);
}
if (!Assert::assert($ret)) {
var_dump(swoole_strerror(swoole_last_error()));
} else {
$ret = $cli->recv();
unset($data_list[$ret->data]);
}
}
Assert::assert(empty($data_list));
});
}
swoole_event_wait();
$pm->kill();
};
$pm->childFunc = function () use ($pm) {
$serv = new swoole_websocket_server('127.0.0.1', $pm->getFreePort(), SERVER_MODE_RANDOM);
$serv->set([
// 'worker_num' => 1,
'log_file' => '/dev/null'
]);
$serv->on('workerStart', function () use ($pm) {
$pm->wakeup();
});
$serv->on('message', function (swoole_websocket_server $serv, swoole_websocket_frame $recv_frame) {
global $data_list;
list($id, $opcode) = explode('|', $recv_frame->data, 3);
if (!Assert::assert($recv_frame->finish)) {
return;
}
if (!Assert::assert($recv_frame->opcode === (int)$opcode)) {
return;
}
if (!Assert::assert($recv_frame->data === $data_list[$id])) {
var_dump($recv_frame->data);
var_dump($data_list[$id]);
return;
}
if (mt_rand(0, 1)) {
$send_frame = new swoole_websocket_frame;
$send_frame->data = $id;
$serv->push($recv_frame->fd, $send_frame);
} else {
$serv->push($recv_frame->fd, $id);
}
});
$serv->start();
};
$pm->childFirst();
$pm->run();
?>
--EXPECT--
| LinkedDestiny/swoole-src | tests/swoole_websocket_server/recv_decode.phpt | PHP | apache-2.0 | 2,866 |
package com.mycompany.assent.util;
/**
*
* @author assent2
*/
public final class ProjectPathUtil {
private ProjectPathUtil() {
}
private static final String path = System.getenv("PWD");
/**
* Return absolute path to project file
*
* @param localPath - local path to file
* @return
*/
public static String getProjectPath(String localPath){
if(localPath != null && !localPath.trim().isEmpty()){
return path + localPath;
}
return path;
}
/**
*
* @return absolute path to the project folder
*/
public static String getProjectPath(){
return path;
}
} | assent220/BookStore3 | src/main/java/com/mycompany/assent/util/ProjectPathUtil.java | Java | apache-2.0 | 692 |
// Copyright 2021 NetApp, Inc. All Rights Reserved.
// Code generated by informer-gen. DO NOT EDIT.
package netapp
import (
internalinterfaces "github.com/netapp/trident/operator/controllers/orchestrator/client/informers/externalversions/internalinterfaces"
v1 "github.com/netapp/trident/operator/controllers/orchestrator/client/informers/externalversions/netapp/v1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1 provides access to shared informers for resources in V1.
V1() v1.Interface
}
type group struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1 returns a new v1.Interface.
func (g *group) V1() v1.Interface {
return v1.New(g.factory, g.namespace, g.tweakListOptions)
}
| NetApp/trident | operator/controllers/orchestrator/client/informers/externalversions/netapp/interface.go | GO | apache-2.0 | 1,108 |
/* Copyright (C) 2008 Jeff Morton (jeffrey.raymond.morton@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
using System;
using System.Collections;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
namespace SoundCatcher
{
sealed class AudioFrame
{
private double[] _waveLeft;
private double[] _fftLeft;
private readonly ArrayList _fftLeftSpect = new ArrayList();
private int _maxHeightLeftSpect;
private double[] _waveRight;
private double[] _fftRight;
private readonly ArrayList _fftRightSpect = new ArrayList();
private int _maxHeightRightSpect;
private SignalGenerator _signalGenerator;
private readonly bool _isTest;
public bool IsDetectingEvents;
public bool IsEventActive;
public int AmplitudeThreshold = 16384;
public AudioFrame(bool isTest)
{
_isTest = isTest;
}
/// <summary>
/// Process 16 bit sample
/// </summary>
/// <param name="wave"></param>
public void Process(ref byte[] wave)
{
IsEventActive = false;
_waveLeft = new double[wave.Length / 4];
_waveRight = new double[wave.Length / 4];
if (_isTest == false)
{
// Split out channels from sample
int h = 0;
for (int i = 0; i < wave.Length; i += 4)
{
_waveLeft[h] = BitConverter.ToInt16(wave, i);
if (IsDetectingEvents && (_waveLeft[h] > AmplitudeThreshold || _waveLeft[h] < -AmplitudeThreshold)) IsEventActive = true;
_waveRight[h] = BitConverter.ToInt16(wave, i + 2);
if (IsDetectingEvents && (_waveLeft[h] > AmplitudeThreshold || _waveLeft[h] < -AmplitudeThreshold)) IsEventActive = true;
h++;
}
}
else
{
// Generate artificial sample for testing
_signalGenerator = new SignalGenerator();
_signalGenerator.SetWaveform("Sine");
_signalGenerator.SetSamplingRate(44100);
_signalGenerator.SetSamples(8192);
_signalGenerator.SetFrequency(4096);
_signalGenerator.SetAmplitude(32768);
_waveLeft = _signalGenerator.GenerateSignal();
_waveRight = _signalGenerator.GenerateSignal();
}
// Generate frequency domain data in decibels
_fftLeft = FourierTransform.Fft(ref _waveLeft);
_fftLeftSpect.Add(_fftLeft);
if (_fftLeftSpect.Count > _maxHeightLeftSpect)
_fftLeftSpect.RemoveAt(0);
_fftRight = FourierTransform.Fft(ref _waveRight);
_fftRightSpect.Add(_fftRight);
if (_fftRightSpect.Count > _maxHeightRightSpect)
_fftRightSpect.RemoveAt(0);
}
/// <summary>
/// Render time domain to PictureBox
/// </summary>
/// <param name="pictureBox"></param>
public void RenderTimeDomainLeft(ref PictureBox pictureBox)
{
// Set up for drawing
Bitmap canvas = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics offScreenDc = Graphics.FromImage(canvas);
Pen pen = new Pen(Color.WhiteSmoke);
// Determine channnel boundries
int width = canvas.Width;
int height = canvas.Height;
double center = Convert.ToDouble(height / 2);
// Draw left channel
double scale = 0.5 * height / 32768; // a 16 bit sample has values from -32768 to 32767
int xPrev = 0, yPrev = 0;
for (int x = 0; x < width; x++)
{
int y = (int)(center + (_waveLeft[_waveLeft.Length / width * x] * scale));
if (x == 0)
{
xPrev = 0;
yPrev = y;
}
else
{
pen.Color = Color.Green;
offScreenDc.DrawLine(pen, xPrev, yPrev, x, y);
xPrev = x;
yPrev = y;
}
}
// Clean up
pictureBox.Image = canvas;
offScreenDc.Dispose();
}
/// <summary>
/// Render time domain to PictureBox
/// </summary>
/// <param name="pictureBox"></param>
public void RenderTimeDomainRight(ref PictureBox pictureBox)
{
// Set up for drawing
Bitmap canvas = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics offScreenDc = Graphics.FromImage(canvas);
Pen pen = new Pen(Color.WhiteSmoke);
// Determine channnel boundries
int width = canvas.Width;
int height = canvas.Height;
double center = Convert.ToDouble(height / 2);
// Draw left channel
double scale = 0.5 * height / 32768; // a 16 bit sample has values from -32768 to 32767
int xPrev = 0, yPrev = 0;
for (int x = 0; x < width; x++)
{
int y = (int)(center + (_waveRight[_waveRight.Length / width * x] * scale));
if (x == 0)
{
xPrev = 0;
yPrev = y;
}
else
{
pen.Color = Color.Green;
offScreenDc.DrawLine(pen, xPrev, yPrev, x, y);
xPrev = x;
yPrev = y;
}
}
// Clean up
pictureBox.Image = canvas;
offScreenDc.Dispose();
}
/// <summary>
/// Render frequency domain to PictureBox
/// </summary>
/// <param name="pictureBox"></param>
/// <param name="samples"></param>
public void RenderFrequencyDomainLeft(ref PictureBox pictureBox, int samples)
{
// Set up for drawing
Bitmap canvas = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics offScreenDc = Graphics.FromImage(canvas);
SolidBrush brush = new SolidBrush(Color.FromArgb(128, 255, 255, 255));
Pen pen = new Pen(Color.WhiteSmoke);
Font font = new Font("Arial", 10);
// Determine channnel boundries
int width = canvas.Width;
int height = canvas.Height;
double min = double.MaxValue;
double minHz = 0;
double max = double.MinValue;
double maxHz = 0;
double scaleHz = Convert.ToDouble((samples / 2) / _fftLeft.Length);
// get left min/max
for (int x = 0; x < _fftLeft.Length; x++)
{
double amplitude = _fftLeft[x];
if (min > amplitude)
{
min = amplitude;
minHz = x * scaleHz;
}
if (max >= amplitude) continue;
max = amplitude;
maxHz = x * scaleHz;
}
// get left range
double range = min < 0 || max < 0 ? (min < 0 && max < 0 ? max - min : Math.Abs(min) + max) : max - min;
double scale = range / height;
// draw left channel
for (int xAxis = 0; xAxis < width; xAxis++)
{
double amplitude = _fftLeft[(_fftLeft.Length / width) * xAxis];
if (double.IsNegativeInfinity(amplitude) || double.IsPositiveInfinity(amplitude) || amplitude == double.MinValue || amplitude == double.MaxValue)
amplitude = 0;
int yAxis;
if (amplitude < 0)
yAxis = (int)(height - ((amplitude - min) / scale));
else
yAxis = (int)(0 + ((max - amplitude) / scale));
if (yAxis < 0)
yAxis = 0;
if (yAxis > height)
yAxis = height;
pen.Color = pen.Color = Color.FromArgb(0, GetColor(min, max, range, amplitude), 0);
offScreenDc.DrawLine(pen, xAxis, height, xAxis, yAxis);
}
offScreenDc.DrawString(string.Format("Min: {0} Hz (±{1}) = {2} dB", minHz.ToString(".#"), scaleHz.ToString(".#"), min.ToString(".###")), font, brush, 0 + 1, 0 + 1);
offScreenDc.DrawString(string.Format("Max: {0} Hz (±{1}) = {2} dB", maxHz.ToString(".#"), scaleHz.ToString(".#"), max.ToString(".###")), font, brush, 0 + 1, 0 + 18);
// Clean up
pictureBox.Image = canvas;
offScreenDc.Dispose();
if (Math.Abs(min) > 2) Gravacao.Gravar();
else Gravacao.Parar();
}
/// <summary>
/// Render frequency domain to PictureBox
/// </summary>
/// <param name="pictureBox"></param>
/// <param name="samples"></param>
public void RenderFrequencyDomainRight(ref PictureBox pictureBox, int samples)
{
// Set up for drawing
Bitmap canvas = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics offScreenDc = Graphics.FromImage(canvas);
SolidBrush brush = new SolidBrush(Color.FromArgb(128, 255, 255, 255));
Pen pen = new Pen(Color.WhiteSmoke);
Font font = new Font("Arial", 10);
// Determine channnel boundries
int width = canvas.Width;
int height = canvas.Height;
double min = double.MaxValue;
double minHz = 0;
double max = double.MinValue;
double maxHz = 0;
double scaleHz = Convert.ToDouble((samples / 2) / _fftRight.Length);
// get left min/max
for (int x = 0; x < _fftRight.Length; x++)
{
double amplitude = _fftRight[x];
if (min > amplitude && !double.IsNegativeInfinity(amplitude))
{
min = amplitude;
minHz = x * scaleHz;
}
if (max >= amplitude || double.IsPositiveInfinity(amplitude)) continue;
max = amplitude;
maxHz = x * scaleHz;
}
// get right range
double range = min < 0 || max < 0 ? (min < 0 && max < 0 ? max - min : Math.Abs(min) + max) : max - min;
double scale = range / height;
// draw right channel
for (int xAxis = 0; xAxis < width; xAxis++)
{
double amplitude = _fftRight[(_fftRight.Length / width) * xAxis];
if (double.IsNegativeInfinity(amplitude) || double.IsPositiveInfinity(amplitude) || amplitude == double.MinValue || amplitude == double.MaxValue)
amplitude = 0;
int yAxis = amplitude < 0 ? (int)(height - ((amplitude - min) / scale)) : (int)(0 + ((max - amplitude) / scale));
if (yAxis < 0)
yAxis = 0;
if (yAxis > height)
yAxis = height;
pen.Color = pen.Color = Color.FromArgb(0, GetColor(min, max, range, amplitude), 0);
offScreenDc.DrawLine(pen, xAxis, height, xAxis, yAxis);
}
offScreenDc.DrawString("Min: " + minHz.ToString(".#") + " Hz (±" + scaleHz.ToString(".#") + ") = " + min.ToString(".###") + " dB", font, brush, 0 + 1, 0 + 1);
offScreenDc.DrawString("Max: " + maxHz.ToString(".#") + " Hz (±" + scaleHz.ToString(".#") + ") = " + max.ToString(".###") + " dB", font, brush, 0 + 1, 0 + 18);
// Clean up
pictureBox.Image = canvas;
offScreenDc.Dispose();
}
/// <summary>
/// Render waterfall spectrogram to PictureBox
/// </summary>
/// <param name="pictureBox"></param>
public void RenderSpectrogramLeft(ref PictureBox pictureBox)
{
Bitmap canvas = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics offScreenDc = Graphics.FromImage(canvas);
// Determine channnel boundries
int width = canvas.Width;
int height = canvas.Height;
double min = double.MaxValue;
double max = double.MinValue;
if (height > _maxHeightLeftSpect)
_maxHeightLeftSpect = height;
// get min/max
for (int w = 0; w < _fftLeftSpect.Count; w++)
for (int x = 0; x < ((double[])_fftLeftSpect[w]).Length; x++)
{
double amplitude = ((double[])_fftLeftSpect[w])[x];
if (min > amplitude) min = amplitude;
if (max < amplitude) max = amplitude;
}
// get range
double range = min < 0 || max < 0 ? (min < 0 && max < 0 ? max - min : Math.Abs(min) + max) : max - min;
// lock image
PixelFormat format = canvas.PixelFormat;
BitmapData data = canvas.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, format);
int stride = data.Stride;
int offset = stride - width * 4;
try
{
unsafe
{
byte* pixel = (byte*)data.Scan0.ToPointer();
// for each cloumn
for (int y = 0; y <= height; y++)
{
if (y >= _fftLeftSpect.Count) continue;
// for each row
for (int x = 0; x < width; x++, pixel += 4)
{
double amplitude = ((double[])_fftLeftSpect[_fftLeftSpect.Count - y - 1])[(_fftLeft.Length / width) * x];
double color = GetColor(min, max, range, amplitude);
pixel[0] = 0;
pixel[1] = (byte)color;
pixel[2] = 0;
pixel[3] = 255;
}
pixel += offset;
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
// unlock image
canvas.UnlockBits(data);
// Clean up
pictureBox.Image = canvas;
offScreenDc.Dispose();
}
/// <summary>
/// Render waterfall spectrogram to PictureBox
/// </summary>
/// <param name="pictureBox"></param>
public void RenderSpectrogramRight(ref PictureBox pictureBox)
{
Bitmap canvas = new Bitmap(pictureBox.Width, pictureBox.Height);
Graphics offScreenDc = Graphics.FromImage(canvas);
// Determine channnel boundries
int width = canvas.Width;
int height = canvas.Height;
double min = double.MaxValue;
double max = double.MinValue;
if (height > _maxHeightRightSpect)
_maxHeightRightSpect = height;
// get min/max
for (int w = 0; w < _fftRightSpect.Count; w++)
for (int x = 0; x < ((double[])_fftRightSpect[w]).Length; x++)
{
double amplitude = ((double[])_fftRightSpect[w])[x];
if (min > amplitude) min = amplitude;
if (max < amplitude) max = amplitude;
}
// get range
double range = min < 0 || max < 0 ? (min < 0 && max < 0 ? max - min : Math.Abs(min) + max) : max - min;
// lock image
PixelFormat format = canvas.PixelFormat;
BitmapData data = canvas.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, format);
int stride = data.Stride;
int offset = stride - width * 4;
try
{
unsafe
{
byte* pixel = (byte*)data.Scan0.ToPointer();
// for each cloumn
for (int y = 0; y <= height; y++)
{
if (y >= _fftRightSpect.Count) continue;
// for each row
for (int x = 0; x < width; x++, pixel += 4)
{
double amplitude = ((double[])_fftRightSpect[_fftRightSpect.Count - y - 1])[(_fftRight.Length / width) * x];
double color = GetColor(min, max, range, amplitude);
pixel[0] = 0;
pixel[1] = (byte)color;
pixel[2] = 0;
pixel[3] = 255;
}
pixel += offset;
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
// unlock image
canvas.UnlockBits(data);
// Clean up
pictureBox.Image = canvas;
offScreenDc.Dispose();
}
/// <summary>
/// Get color in the range of 0-255 for amplitude sample
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
/// <param name="range"></param>
/// <param name="amplitude"></param>
/// <returns></returns>
private static int GetColor(double min, double max, double range, double amplitude)
{
double color = !double.IsNegativeInfinity(min) && min != double.MaxValue & !double.IsPositiveInfinity(max) && max != double.MinValue && range != 0 ? (min < 0 || max < 0 ? (min < 0 && max < 0 ? (255 / range) * (Math.Abs(min) - Math.Abs(amplitude)) : (amplitude < 0 ? (255 / range) * (Math.Abs(min) - Math.Abs(amplitude)) : (255 / range) * (amplitude + Math.Abs(min)))) : (255 / range) * (amplitude - min)) : 0;
return (int)color;
}
}
}
| ygoronline/SoundCatcher | SoundCatcher/AudioFrame.cs | C# | apache-2.0 | 18,910 |
# AUTOGENERATED FILE
FROM balenalib/aarch64-debian:stretch-build
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.6.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& echo "f44f5617a7cd5593250bb8ad02044c37b433293343eacc84d78acae6490b7c53 Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.8
# install dbus-python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-1-dev \
libdbus-glib-1-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoremove
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Stretch \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.6.12, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/python/aarch64/debian/stretch/3.6.12/build/Dockerfile | Dockerfile | apache-2.0 | 4,856 |
# Crotalaria rhynchotropioides Baker f. SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Crotalaria/Crotalaria rhynchotropioides/README.md | Markdown | apache-2.0 | 195 |
package com.xhy.weibo.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.os.Environment;
import android.util.Log;
import java.io.File;
/**
* Created by xuhaoyang on 16/6/3.
*/
public class DBManager {
private static String TAG = DBManager.class.getSimpleName();
private final int BUFFER_SIZE = 400000;
public static final String DB_NAME = "Weibo.db";
public static final String PACKAGE_NAME = "com.xhy.weibo";
public static final String DATABASE_PATH = "databases";
public static final String DB_PATH = "/data" + Environment.getDataDirectory().getAbsolutePath() + "/" +
PACKAGE_NAME + "/" + DATABASE_PATH;
//SQLiteDatabase: /data/data/com.xhy.weibo/databases/Weibo.db
private SQLiteDatabase database;
private Context context;
public DBManager(Context context) {
this.context = context;
}
public SQLiteDatabase getDatabase() {
return database;
}
public void setDatabase(SQLiteDatabase database) {
this.database = database;
}
public void openDatabase() {
Log.e(TAG, DB_PATH + "/" + DB_NAME);
this.database = this.openDatabase(DB_PATH + "/" + DB_NAME);
}
private SQLiteDatabase openDatabase(String dbfile) {
// try {
// if (!(new File(dbfile).exists())) {
// //判断数据库文件是否存在,若不存在则执行导入,否则直接打开数据库
// InputStream is = this.context.getResources().openRawResource(R.raw.china_city); //欲导入的数据库
// FileOutputStream fos = new FileOutputStream(dbfile);
// byte[] buffer = new byte[BUFFER_SIZE];
// int count = 0;
// while ((count = is.read(buffer)) > 0) {
// fos.write(buffer, 0, count);
// }
// fos.close();
// is.close();
DatabaseHelper userDatabaseHelper = new DatabaseHelper(context, DB_NAME, null, DatabaseHelper.version);
return userDatabaseHelper.getWritableDatabase();
// }
// return SQLiteDatabase.openOrCreateDatabase(dbfile, null);
// return SQLiteDatabase.openOrCreateDatabase(dbfile, null);
// } catch (FileNotFoundException e) {
// Log.e("Database", "File not found");
// e.printStackTrace();
// } catch (IOException e) {
// Log.e("Database", "IO exception");
// e.printStackTrace();
// }
// return null;
}
public void closeDatabase() {
this.database.close();
}
}
| xuhaoyang/Weibo | app/src/main/java/com/xhy/weibo/db/DBManager.java | Java | apache-2.0 | 2,630 |
set(PARTITION_TABLE_OFFSET ${CONFIG_PARTITION_TABLE_OFFSET})
set(PARTITION_TABLE_CHECK_SIZES_TOOL_PATH "${CMAKE_CURRENT_LIST_DIR}/check_sizes.py")
idf_build_get_property(build_dir BUILD_DIR)
idf_build_set_property(PARTITION_TABLE_BIN_PATH "${build_dir}/partition_table/partition-table.bin")
if(NOT BOOTLOADER_BUILD)
# Set PARTITION_CSV_PATH to the configured partition CSV file
# absolute path
if(CONFIG_PARTITION_TABLE_CUSTOM)
idf_build_get_property(project_dir PROJECT_DIR)
# Custom filename expands any path relative to the project
get_filename_component(PARTITION_CSV_PATH "${CONFIG_PARTITION_TABLE_FILENAME}"
ABSOLUTE BASE_DIR "${project_dir}")
if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(WARNING "Partition table CSV file ${PARTITION_CSV_PATH} not found. "
"Change custom partition CSV path in menuconfig.")
# Note: partition_table CMakeLists.txt contains some logic to create a dummy
# partition_table target in this case, see comments in that file.
endif()
else()
# Other .csv files are always in the component directory
get_filename_component(PARTITION_CSV_PATH "${COMPONENT_DIR}/${CONFIG_PARTITION_TABLE_FILENAME}" ABSOLUTE)
if(NOT EXISTS "${PARTITION_CSV_PATH}")
message(FATAL_ERROR "Internal error, built-in ${PARTITION_CSV_PATH} not found.")
endif()
endif()
# need to re-run CMake if the partition CSV changes, as the offsets/sizes of partitions may change
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PARTITION_CSV_PATH})
endif()
# partition_table_get_partition_info
#
# Get information about a partition from the partition table
function(partition_table_get_partition_info result get_part_info_args part_info)
idf_build_get_property(python PYTHON)
idf_build_get_property(idf_path IDF_PATH)
separate_arguments(get_part_info_args)
execute_process(COMMAND ${python}
${idf_path}/components/partition_table/parttool.py -q
--partition-table-offset ${PARTITION_TABLE_OFFSET}
--partition-table-file ${PARTITION_CSV_PATH}
get_partition_info ${get_part_info_args} --info ${part_info}
OUTPUT_VARIABLE info
RESULT_VARIABLE exit_code
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT ${exit_code} EQUAL 0 AND NOT ${exit_code} EQUAL 1)
# can't fail here as it would prevent the user from running 'menuconfig' again
message(WARNING "parttool.py execution failed (${result}), problem with partition CSV file (see above)")
endif()
set(${result} ${info} PARENT_SCOPE)
endfunction()
# Add a custom target (see add_custom_target) that checks a given binary built by the build system
# doesn't overflow any partitions with the given partition type and (optional) sub-type.
#
# Adding the target doesn't mean it gets called during the build, use add_dependencies to make another
# target depend on this one.
#
# Arguments:
# - target name - (first argument) name of the target to create
# - DEPENDS - dependencies the target should have (i.e. whatever target generates the binary).
# - BINARY_PATH - path to the target binary file to check
# - PARTITION_TYPE - partition type to check against
# - PARTITION_SUBTYPE - (optional) partition subtype to check against
function(partition_table_add_check_size_target target_name)
# result binary_path partition_type partition_subtype
set(args BINARY_PATH PARTITION_TYPE PARTITION_SUBTYPE)
set(multi_args DEPENDS)
cmake_parse_arguments(CMD "" "${args}" "${multi_args}" ${ARGN})
idf_build_get_property(python PYTHON)
idf_build_get_property(table_bin PARTITION_TABLE_BIN_PATH)
if(CMD_PARTITION_SUBTYPE)
set(subtype_arg --subtype ${CMD_PARTITION_SUBTYPE})
else()
set(subtype_arg)
endif()
set(command ${python} ${PARTITION_TABLE_CHECK_SIZES_TOOL_PATH}
--offset ${PARTITION_TABLE_OFFSET}
partition --type ${CMD_PARTITION_TYPE} ${subtype_arg}
${table_bin} ${CMD_BINARY_PATH})
add_custom_target(${target_name} COMMAND ${command} DEPENDS ${CMD_DEPENDS} partition_table_bin)
endfunction()
# Add a custom target (see add_custom_target) that checks a bootloader binary
# built by the build system will not overlap the partition table.
#
# Adding the target doesn't mean it gets called during the build, use add_dependencies to make another
# target depend on this one.
#
# Arguments:
# - target name - (first argument) name of the target to create
# - DEPENDS - dependencies the new target should have (i.e. whatever target generates the bootloader binary)
# - BOOTLOADER_BINARY_PATH - path to bootloader binary file
function(partition_table_add_check_bootloader_size_target target_name)
cmake_parse_arguments(CMD "" "BOOTLOADER_BINARY_PATH" "DEPENDS" ${ARGN})
idf_build_get_property(python PYTHON)
set(command ${python} ${PARTITION_TABLE_CHECK_SIZES_TOOL_PATH}
--offset ${PARTITION_TABLE_OFFSET}
bootloader ${BOOTLOADER_OFFSET} ${CMD_BOOTLOADER_BINARY_PATH})
add_custom_target(${target_name} COMMAND ${command} DEPENDS ${CMD_DEPENDS})
endfunction()
| espressif/esp-idf | components/partition_table/project_include.cmake | CMake | apache-2.0 | 5,213 |
//===--- SILGen.cpp - Implements Lowering of ASTs -> SIL ------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "silgen"
#include "ManagedValue.h"
#include "RValue.h"
#include "SILGenFunction.h"
#include "SILGenFunctionBuilder.h"
#include "Scope.h"
#include "swift/AST/DiagnosticsSIL.h"
#include "swift/AST/Evaluator.h"
#include "swift/AST/GenericEnvironment.h"
#include "swift/AST/Initializer.h"
#include "swift/AST/NameLookup.h"
#include "swift/AST/ParameterList.h"
#include "swift/AST/PrettyStackTrace.h"
#include "swift/AST/PropertyWrappers.h"
#include "swift/AST/ProtocolConformance.h"
#include "swift/AST/ResilienceExpansion.h"
#include "swift/AST/SourceFile.h"
#include "swift/AST/TypeCheckRequests.h"
#include "swift/Basic/Statistic.h"
#include "swift/ClangImporter/ClangModule.h"
#include "swift/SIL/PrettyStackTrace.h"
#include "swift/SIL/SILArgument.h"
#include "swift/SIL/SILDebugScope.h"
#include "swift/SIL/SILProfiler.h"
#include "swift/AST/SILGenRequests.h"
#include "swift/Serialization/SerializedModuleLoader.h"
#include "swift/Serialization/SerializedSILLoader.h"
#include "swift/Strings.h"
#include "swift/Subsystems.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/Debug.h"
using namespace swift;
using namespace Lowering;
//===----------------------------------------------------------------------===//
// SILGenModule Class implementation
//===----------------------------------------------------------------------===//
SILGenModule::SILGenModule(SILModule &M, ModuleDecl *SM)
: M(M), Types(M.Types), SwiftModule(SM), TopLevelSGF(nullptr),
FileIDsByFilePath(SM->computeFileIDMap(/*shouldDiagnose=*/true)) {
const SILOptions &Opts = M.getOptions();
if (!Opts.UseProfile.empty()) {
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(Opts.UseProfile);
if (auto E = ReaderOrErr.takeError()) {
diagnose(SourceLoc(), diag::profile_read_error, Opts.UseProfile,
llvm::toString(std::move(E)));
} else {
M.setPGOReader(std::move(ReaderOrErr.get()));
}
}
}
SILGenModule::~SILGenModule() {
assert(!TopLevelSGF && "active source file lowering!?");
M.verify();
}
static SILDeclRef
getBridgingFn(Optional<SILDeclRef> &cacheSlot,
SILGenModule &SGM,
Identifier moduleName,
StringRef functionName,
std::initializer_list<Type> inputTypes,
Type outputType) {
if (!cacheSlot) {
ASTContext &ctx = SGM.M.getASTContext();
ModuleDecl *mod = ctx.getLoadedModule(moduleName);
if (!mod) {
SGM.diagnose(SourceLoc(), diag::bridging_module_missing,
moduleName.str(), functionName);
llvm::report_fatal_error("unable to set up the ObjC bridge!");
}
SmallVector<ValueDecl *, 2> decls;
mod->lookupValue(ctx.getIdentifier(functionName),
NLKind::QualifiedLookup, decls);
if (decls.empty()) {
SGM.diagnose(SourceLoc(), diag::bridging_function_missing,
moduleName.str(), functionName);
llvm::report_fatal_error("unable to set up the ObjC bridge!");
}
if (decls.size() != 1) {
SGM.diagnose(SourceLoc(), diag::bridging_function_overloaded,
moduleName.str(), functionName);
llvm::report_fatal_error("unable to set up the ObjC bridge!");
}
auto *fd = dyn_cast<FuncDecl>(decls.front());
if (!fd) {
SGM.diagnose(SourceLoc(), diag::bridging_function_not_function,
moduleName.str(), functionName);
llvm::report_fatal_error("unable to set up the ObjC bridge!");
}
// Check that the function takes the expected arguments and returns the
// expected result type.
SILDeclRef c(fd);
auto funcTy =
SGM.Types.getConstantFunctionType(TypeExpansionContext::minimal(), c);
SILFunctionConventions fnConv(funcTy, SGM.M);
auto toSILType = [&SGM](Type ty) {
return SGM.Types.getLoweredType(ty, TypeExpansionContext::minimal());
};
if (fnConv.hasIndirectSILResults() ||
funcTy->getNumParameters() != inputTypes.size() ||
!std::equal(
fnConv.getParameterSILTypes(TypeExpansionContext::minimal())
.begin(),
fnConv.getParameterSILTypes(TypeExpansionContext::minimal()).end(),
makeTransformIterator(inputTypes.begin(), toSILType))) {
SGM.diagnose(fd->getLoc(), diag::bridging_function_not_correct_type,
moduleName.str(), functionName);
llvm::report_fatal_error("unable to set up the ObjC bridge!");
}
if (fnConv.getSingleSILResultType(TypeExpansionContext::minimal()) !=
toSILType(outputType)) {
SGM.diagnose(fd->getLoc(), diag::bridging_function_not_correct_type,
moduleName.str(), functionName);
llvm::report_fatal_error("unable to set up the ObjC bridge!");
}
cacheSlot = c;
}
LLVM_DEBUG(llvm::dbgs() << "bridging function "
<< moduleName << '.' << functionName
<< " mapped to ";
cacheSlot->print(llvm::dbgs()));
return *cacheSlot;
}
#define REQUIRED(X) Types.get##X##Type()
#define OPTIONAL(X) OptionalType::get(Types.get##X##Type())
#define GET_BRIDGING_FN(Module, FromKind, FromTy, ToKind, ToTy) \
SILDeclRef SILGenModule::get##FromTy##To##ToTy##Fn() { \
return getBridgingFn(FromTy##To##ToTy##Fn, *this, \
getASTContext().Id_##Module, \
"_convert" #FromTy "To" #ToTy, \
{ FromKind(FromTy) }, \
ToKind(ToTy)); \
}
GET_BRIDGING_FN(Darwin, REQUIRED, Bool, REQUIRED, DarwinBoolean)
GET_BRIDGING_FN(Darwin, REQUIRED, DarwinBoolean, REQUIRED, Bool)
GET_BRIDGING_FN(ObjectiveC, REQUIRED, Bool, REQUIRED, ObjCBool)
GET_BRIDGING_FN(ObjectiveC, REQUIRED, ObjCBool, REQUIRED, Bool)
GET_BRIDGING_FN(Foundation, OPTIONAL, NSError, REQUIRED, Error)
GET_BRIDGING_FN(Foundation, REQUIRED, Error, REQUIRED, NSError)
GET_BRIDGING_FN(WinSDK, REQUIRED, Bool, REQUIRED, WindowsBool)
GET_BRIDGING_FN(WinSDK, REQUIRED, WindowsBool, REQUIRED, Bool)
#undef GET_BRIDGING_FN
#undef REQUIRED
#undef OPTIONAL
static FuncDecl *diagnoseMissingIntrinsic(SILGenModule &sgm,
SILLocation loc,
const char *name) {
sgm.diagnose(loc, diag::bridging_function_missing,
sgm.getASTContext().StdlibModuleName.str(), name);
return nullptr;
}
#define FUNC_DECL(NAME, ID) \
FuncDecl *SILGenModule::get##NAME(SILLocation loc) { \
if (auto fn = getASTContext().get##NAME()) \
return fn; \
return diagnoseMissingIntrinsic(*this, loc, ID); \
}
#include "swift/AST/KnownDecls.def"
ProtocolDecl *SILGenModule::getObjectiveCBridgeable(SILLocation loc) {
if (ObjectiveCBridgeable)
return *ObjectiveCBridgeable;
// Find the _ObjectiveCBridgeable protocol.
auto &ctx = getASTContext();
auto proto = ctx.getProtocol(KnownProtocolKind::ObjectiveCBridgeable);
if (!proto)
diagnose(loc, diag::bridging_objcbridgeable_missing);
ObjectiveCBridgeable = proto;
return proto;
}
FuncDecl *SILGenModule::getBridgeToObjectiveCRequirement(SILLocation loc) {
if (BridgeToObjectiveCRequirement)
return *BridgeToObjectiveCRequirement;
// Find the _ObjectiveCBridgeable protocol.
auto proto = getObjectiveCBridgeable(loc);
if (!proto) {
BridgeToObjectiveCRequirement = nullptr;
return nullptr;
}
// Look for _bridgeToObjectiveC().
auto &ctx = getASTContext();
DeclName name(ctx, ctx.Id_bridgeToObjectiveC, llvm::ArrayRef<Identifier>());
auto *found = dyn_cast_or_null<FuncDecl>(
proto->getSingleRequirement(name));
if (!found)
diagnose(loc, diag::bridging_objcbridgeable_broken, name);
BridgeToObjectiveCRequirement = found;
return found;
}
FuncDecl *SILGenModule::getUnconditionallyBridgeFromObjectiveCRequirement(
SILLocation loc) {
if (UnconditionallyBridgeFromObjectiveCRequirement)
return *UnconditionallyBridgeFromObjectiveCRequirement;
// Find the _ObjectiveCBridgeable protocol.
auto proto = getObjectiveCBridgeable(loc);
if (!proto) {
UnconditionallyBridgeFromObjectiveCRequirement = nullptr;
return nullptr;
}
// Look for _bridgeToObjectiveC().
auto &ctx = getASTContext();
DeclName name(ctx, ctx.getIdentifier("_unconditionallyBridgeFromObjectiveC"),
llvm::makeArrayRef(Identifier()));
auto *found = dyn_cast_or_null<FuncDecl>(
proto->getSingleRequirement(name));
if (!found)
diagnose(loc, diag::bridging_objcbridgeable_broken, name);
UnconditionallyBridgeFromObjectiveCRequirement = found;
return found;
}
AssociatedTypeDecl *
SILGenModule::getBridgedObjectiveCTypeRequirement(SILLocation loc) {
if (BridgedObjectiveCType)
return *BridgedObjectiveCType;
// Find the _ObjectiveCBridgeable protocol.
auto proto = getObjectiveCBridgeable(loc);
if (!proto) {
BridgeToObjectiveCRequirement = nullptr;
return nullptr;
}
// Look for _bridgeToObjectiveC().
auto &ctx = getASTContext();
auto *found = proto->getAssociatedType(ctx.Id_ObjectiveCType);
if (!found)
diagnose(loc, diag::bridging_objcbridgeable_broken, ctx.Id_ObjectiveCType);
BridgedObjectiveCType = found;
return found;
}
ProtocolConformance *
SILGenModule::getConformanceToObjectiveCBridgeable(SILLocation loc, Type type) {
auto proto = getObjectiveCBridgeable(loc);
if (!proto) return nullptr;
// Find the conformance to _ObjectiveCBridgeable.
auto result = SwiftModule->lookupConformance(type, proto);
if (result.isInvalid())
return nullptr;
return result.getConcrete();
}
ProtocolDecl *SILGenModule::getBridgedStoredNSError(SILLocation loc) {
if (BridgedStoredNSError)
return *BridgedStoredNSError;
// Find the _BridgedStoredNSError protocol.
auto &ctx = getASTContext();
auto proto = ctx.getProtocol(KnownProtocolKind::BridgedStoredNSError);
BridgedStoredNSError = proto;
return proto;
}
VarDecl *SILGenModule::getNSErrorRequirement(SILLocation loc) {
if (NSErrorRequirement)
return *NSErrorRequirement;
// Find the _BridgedStoredNSError protocol.
auto proto = getBridgedStoredNSError(loc);
if (!proto) {
NSErrorRequirement = nullptr;
return nullptr;
}
// Look for _nsError.
auto &ctx = getASTContext();
auto *found = dyn_cast_or_null<VarDecl>(
proto->getSingleRequirement(ctx.Id_nsError));
NSErrorRequirement = found;
return found;
}
ProtocolConformanceRef
SILGenModule::getConformanceToBridgedStoredNSError(SILLocation loc, Type type) {
auto proto = getBridgedStoredNSError(loc);
if (!proto)
return ProtocolConformanceRef::forInvalid();
// Find the conformance to _BridgedStoredNSError.
return SwiftModule->lookupConformance(type, proto);
}
ProtocolConformance *SILGenModule::getNSErrorConformanceToError() {
if (NSErrorConformanceToError)
return *NSErrorConformanceToError;
auto &ctx = getASTContext();
auto nsErrorTy = ctx.getNSErrorType();
if (!nsErrorTy) {
NSErrorConformanceToError = nullptr;
return nullptr;
}
auto error = ctx.getErrorDecl();
if (!error) {
NSErrorConformanceToError = nullptr;
return nullptr;
}
auto conformance =
SwiftModule->lookupConformance(nsErrorTy, cast<ProtocolDecl>(error));
if (conformance.isConcrete())
NSErrorConformanceToError = conformance.getConcrete();
else
NSErrorConformanceToError = nullptr;
return *NSErrorConformanceToError;
}
SILFunction *
SILGenModule::getKeyPathProjectionCoroutine(bool isReadAccess,
KeyPathTypeKind typeKind) {
bool isBaseInout;
bool isResultInout;
StringRef functionName;
NominalTypeDecl *keyPathDecl;
if (isReadAccess) {
assert(typeKind == KPTK_KeyPath ||
typeKind == KPTK_WritableKeyPath ||
typeKind == KPTK_ReferenceWritableKeyPath);
functionName = "swift_readAtKeyPath";
isBaseInout = false;
isResultInout = false;
keyPathDecl = getASTContext().getKeyPathDecl();
} else if (typeKind == KPTK_WritableKeyPath) {
functionName = "swift_modifyAtWritableKeyPath";
isBaseInout = true;
isResultInout = true;
keyPathDecl = getASTContext().getWritableKeyPathDecl();
} else if (typeKind == KPTK_ReferenceWritableKeyPath) {
functionName = "swift_modifyAtReferenceWritableKeyPath";
isBaseInout = false;
isResultInout = true;
keyPathDecl = getASTContext().getReferenceWritableKeyPathDecl();
} else {
llvm_unreachable("bad combination");
}
auto fn = M.lookUpFunction(functionName);
if (fn) return fn;
auto rootType = CanGenericTypeParamType::get(0, 0, getASTContext());
auto valueType = CanGenericTypeParamType::get(0, 1, getASTContext());
// Build the generic signature <A, B>.
auto sig = GenericSignature::get({rootType, valueType}, {});
auto keyPathTy = BoundGenericType::get(keyPathDecl, Type(),
{ rootType, valueType })
->getCanonicalType();
// (@in_guaranteed/@inout Root, @guaranteed KeyPath<Root, Value>)
SILParameterInfo params[] = {
{ rootType,
isBaseInout ? ParameterConvention::Indirect_Inout
: ParameterConvention::Indirect_In_Guaranteed },
{ keyPathTy, ParameterConvention::Direct_Guaranteed },
};
// -> @yields @in_guaranteed/@inout Value
SILYieldInfo yields[] = {
{ valueType,
isResultInout ? ParameterConvention::Indirect_Inout
: ParameterConvention::Indirect_In_Guaranteed },
};
auto extInfo =
SILFunctionType::ExtInfoBuilder(SILFunctionTypeRepresentation::Thin,
/*pseudogeneric*/ false,
/*non-escaping*/ false,
/*async*/ false,
DifferentiabilityKind::NonDifferentiable,
/*clangFunctionType*/ nullptr)
.build();
auto functionTy = SILFunctionType::get(sig, extInfo,
SILCoroutineKind::YieldOnce,
ParameterConvention::Direct_Unowned,
params,
yields,
/*results*/ {},
/*error result*/ {},
SubstitutionMap(),
SubstitutionMap(),
getASTContext());
auto env = sig->getGenericEnvironment();
SILGenFunctionBuilder builder(*this);
fn = builder.createFunction(SILLinkage::PublicExternal,
functionName,
functionTy,
env,
/*location*/ None,
IsNotBare,
IsNotTransparent,
IsNotSerialized,
IsNotDynamic);
return fn;
}
SILFunction *SILGenModule::emitTopLevelFunction(SILLocation Loc) {
ASTContext &C = getASTContext();
auto extInfo = SILFunctionType::ExtInfo()
.withRepresentation(SILFunctionType::Representation::CFunctionPointer);
// Use standard library types if we have them; otherwise, fall back to
// builtins.
CanType Int32Ty;
if (auto Int32Decl = C.getInt32Decl()) {
Int32Ty = Int32Decl->getDeclaredInterfaceType()->getCanonicalType();
} else {
Int32Ty = CanType(BuiltinIntegerType::get(32, C));
}
CanType PtrPtrInt8Ty = C.TheRawPointerType;
if (auto PointerDecl = C.getUnsafeMutablePointerDecl()) {
if (auto Int8Decl = C.getInt8Decl()) {
Type Int8Ty = Int8Decl->getDeclaredInterfaceType();
Type PointerInt8Ty = BoundGenericType::get(PointerDecl,
nullptr,
Int8Ty);
Type OptPointerInt8Ty = OptionalType::get(PointerInt8Ty);
PtrPtrInt8Ty = BoundGenericType::get(PointerDecl,
nullptr,
OptPointerInt8Ty)
->getCanonicalType();
}
}
SILParameterInfo params[] = {
SILParameterInfo(Int32Ty, ParameterConvention::Direct_Unowned),
SILParameterInfo(PtrPtrInt8Ty, ParameterConvention::Direct_Unowned),
};
CanSILFunctionType topLevelType = SILFunctionType::get(nullptr, extInfo,
SILCoroutineKind::None,
ParameterConvention::Direct_Unowned,
params, /*yields*/ {},
SILResultInfo(Int32Ty,
ResultConvention::Unowned),
None,
SubstitutionMap(), SubstitutionMap(),
C);
SILGenFunctionBuilder builder(*this);
return builder.createFunction(
SILLinkage::Public, SWIFT_ENTRY_POINT_FUNCTION, topLevelType, nullptr,
Loc, IsBare, IsNotTransparent, IsNotSerialized, IsNotDynamic,
ProfileCounter(), IsNotThunk, SubclassScope::NotApplicable);
}
SILFunction *SILGenModule::getEmittedFunction(SILDeclRef constant,
ForDefinition_t forDefinition) {
auto found = emittedFunctions.find(constant);
if (found != emittedFunctions.end()) {
SILFunction *F = found->second;
if (forDefinition) {
// In all the cases where getConstantLinkage returns something
// different for ForDefinition, it returns an available-externally
// linkage.
if (isAvailableExternally(F->getLinkage())) {
F->setLinkage(constant.getLinkage(ForDefinition));
}
}
return F;
}
return nullptr;
}
static SILFunction *getFunctionToInsertAfter(SILGenModule &SGM,
SILDeclRef insertAfter) {
// If the decl ref was emitted, emit after its function.
while (insertAfter) {
auto found = SGM.emittedFunctions.find(insertAfter);
if (found != SGM.emittedFunctions.end()) {
return found->second;
}
// Otherwise, try to insert after the function we would be transitively
// be inserted after.
auto foundDelayed = SGM.delayedFunctions.find(insertAfter);
if (foundDelayed != SGM.delayedFunctions.end()) {
insertAfter = foundDelayed->second;
} else {
break;
}
}
// If the decl ref is nil, just insert at the beginning.
return nullptr;
}
static bool haveProfiledAssociatedFunction(SILDeclRef constant) {
return constant.isDefaultArgGenerator() || constant.isForeign;
}
/// Set up the function for profiling instrumentation.
static void setUpForProfiling(SILDeclRef constant, SILFunction *F,
ForDefinition_t forDefinition) {
if (!forDefinition || F->getProfiler())
return;
ASTNode profiledNode;
if (!haveProfiledAssociatedFunction(constant)) {
if (constant.hasDecl()) {
if (auto *fd = constant.getFuncDecl()) {
if (fd->hasBody()) {
F->createProfiler(fd, constant, forDefinition);
profiledNode = fd->getBody(/*canSynthesize=*/false);
}
}
} else if (auto *ace = constant.getAbstractClosureExpr()) {
F->createProfiler(ace, constant, forDefinition);
profiledNode = ace;
}
// Set the function entry count for PGO.
if (SILProfiler *SP = F->getProfiler())
F->setEntryCount(SP->getExecutionCount(profiledNode));
}
}
static bool isEmittedOnDemand(SILModule &M, SILDeclRef constant) {
if (!constant.hasDecl())
return false;
if (constant.isForeign)
return false;
auto *d = constant.getDecl();
auto *dc = d->getDeclContext();
switch (constant.kind) {
case SILDeclRef::Kind::Func: {
auto *fd = cast<FuncDecl>(d);
if (!fd->hasBody())
return false;
if (isa<ClangModuleUnit>(dc->getModuleScopeContext()))
return true;
if (fd->hasForcedStaticDispatch())
return true;
break;
}
case SILDeclRef::Kind::Allocator: {
auto *cd = cast<ConstructorDecl>(d);
// For factories, we don't need to emit a special thunk; the normal
// foreign-to-native thunk is sufficient.
if (isa<ClangModuleUnit>(dc->getModuleScopeContext()) &&
!cd->isFactoryInit() &&
(dc->getSelfClassDecl() ||
cd->hasBody()))
return true;
break;
}
case SILDeclRef::Kind::EnumElement:
return true;
default:
break;
}
return false;
}
SILFunction *SILGenModule::getFunction(SILDeclRef constant,
ForDefinition_t forDefinition) {
// If we already emitted the function, return it (potentially preparing it
// for definition).
if (auto emitted = getEmittedFunction(constant, forDefinition)) {
setUpForProfiling(constant, emitted, forDefinition);
return emitted;
}
// Note: Do not provide any SILLocation. You can set it afterwards.
SILGenFunctionBuilder builder(*this);
auto &IGM = *this;
auto *F = builder.getOrCreateFunction(
constant.hasDecl() ? constant.getDecl() : (Decl *)nullptr, constant,
forDefinition,
[&IGM](SILLocation loc, SILDeclRef constant) -> SILFunction * {
return IGM.getFunction(constant, NotForDefinition);
});
setUpForProfiling(constant, F, forDefinition);
assert(F && "SILFunction should have been defined");
emittedFunctions[constant] = F;
if (!delayedFunctions.count(constant)) {
if (isEmittedOnDemand(M, constant)) {
forcedFunctions.push_back(constant);
return F;
}
}
// If we delayed emitting this function previously, we need it now.
auto foundDelayed = delayedFunctions.find(constant);
if (foundDelayed != delayedFunctions.end()) {
// Move the function to its proper place within the module.
M.functions.remove(F);
SILFunction *insertAfter = getFunctionToInsertAfter(*this,
foundDelayed->second);
if (!insertAfter) {
M.functions.push_front(F);
} else {
M.functions.insertAfter(insertAfter->getIterator(), F);
}
forcedFunctions.push_back(constant);
delayedFunctions.erase(foundDelayed);
} else {
// We would have registered a delayed function as "last emitted" when we
// enqueued. If the function wasn't delayed, then we're emitting it now.
lastEmittedFunction = constant;
}
return F;
}
bool SILGenModule::hasFunction(SILDeclRef constant) {
return emittedFunctions.count(constant);
}
void SILGenModule::visitFuncDecl(FuncDecl *fd) { emitFunction(fd); }
void SILGenModule::emitFunctionDefinition(SILDeclRef constant, SILFunction *f) {
if (constant.isForeignToNativeThunk()) {
f->setThunk(IsThunk);
if (constant.asForeign().isClangGenerated())
f->setSerialized(IsSerializable);
auto loc = constant.getAsRegularLocation();
loc.markAutoGenerated();
auto *dc = loc.getAsDeclContext();
assert(dc);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitForeignToNativeThunk", f);
SILGenFunction(*this, *f, dc).emitForeignToNativeThunk(constant);
postEmitFunction(constant, f);
return;
}
if (constant.isNativeToForeignThunk()) {
auto loc = constant.getAsRegularLocation();
loc.markAutoGenerated();
auto *dc = loc.getAsDeclContext();
assert(dc);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitNativeToForeignThunk", f);
f->setBare(IsBare);
f->setThunk(IsThunk);
SILGenFunction(*this, *f, dc).emitNativeToForeignThunk(constant);
postEmitFunction(constant, f);
return;
}
switch (constant.kind) {
case SILDeclRef::Kind::Func: {
if (auto *ce = constant.getAbstractClosureExpr()) {
preEmitFunction(constant, f, ce);
PrettyStackTraceSILFunction X("silgen closureexpr", f);
SILGenFunction(*this, *f, ce).emitClosure(ce);
postEmitFunction(constant, f);
break;
}
auto *fd = cast<FuncDecl>(constant.getDecl());
preEmitFunction(constant, f, fd);
PrettyStackTraceSILFunction X("silgen emitFunction", f);
SILGenFunction(*this, *f, fd).emitFunction(fd);
postEmitFunction(constant, f);
break;
}
case SILDeclRef::Kind::Allocator: {
auto *decl = cast<ConstructorDecl>(constant.getDecl());
if (decl->getDeclContext()->getSelfClassDecl() &&
(decl->isDesignatedInit() ||
decl->isObjC())) {
preEmitFunction(constant, f, decl);
PrettyStackTraceSILFunction X("silgen emitConstructor", f);
SILGenFunction(*this, *f, decl).emitClassConstructorAllocator(decl);
postEmitFunction(constant, f);
} else {
preEmitFunction(constant, f, decl);
PrettyStackTraceSILFunction X("silgen emitConstructor", f);
f->createProfiler(decl, constant, ForDefinition);
SILGenFunction(*this, *f, decl).emitValueConstructor(decl);
postEmitFunction(constant, f);
}
break;
}
case SILDeclRef::Kind::Initializer: {
auto *decl = cast<ConstructorDecl>(constant.getDecl());
assert(decl->getDeclContext()->getSelfClassDecl());
preEmitFunction(constant, f, decl);
PrettyStackTraceSILFunction X("silgen constructor initializer", f);
f->createProfiler(decl, constant, ForDefinition);
SILGenFunction(*this, *f, decl).emitClassConstructorInitializer(decl);
postEmitFunction(constant, f);
break;
}
case SILDeclRef::Kind::DefaultArgGenerator: {
auto *decl = constant.getDecl();
auto *param = getParameterAt(decl, constant.defaultArgIndex);
auto *initDC = param->getDefaultArgumentInitContext();
switch (param->getDefaultArgumentKind()) {
case DefaultArgumentKind::Normal: {
auto arg = param->getTypeCheckedDefaultExpr();
auto loc = RegularLocation::getAutoGeneratedLocation(arg);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitDefaultArgGenerator ", f);
SILGenFunction SGF(*this, *f, initDC);
SGF.emitGeneratorFunction(constant, arg);
postEmitFunction(constant, f);
break;
}
case DefaultArgumentKind::StoredProperty: {
auto arg = param->getStoredProperty();
auto loc = RegularLocation::getAutoGeneratedLocation(arg);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitDefaultArgGenerator ", f);
SILGenFunction SGF(*this, *f, initDC);
SGF.emitGeneratorFunction(constant, arg);
postEmitFunction(constant, f);
break;
}
default:
llvm_unreachable("Bad default argument kind");
}
break;
}
case SILDeclRef::Kind::StoredPropertyInitializer: {
auto *var = cast<VarDecl>(constant.getDecl());
auto *pbd = var->getParentPatternBinding();
unsigned idx = pbd->getPatternEntryIndexForVarDecl(var);
auto *init = pbd->getInit(idx);
auto *initDC = pbd->getInitContext(idx);
auto captureInfo = pbd->getCaptureInfo(idx);
assert(!pbd->isInitializerSubsumed(idx));
// If this is the backing storage for a property with an attached wrapper
// that was initialized with `=`, use that expression as the initializer.
if (auto originalProperty = var->getOriginalWrappedProperty()) {
if (originalProperty
->isPropertyMemberwiseInitializedWithWrappedType()) {
auto wrapperInfo =
originalProperty->getPropertyWrapperBackingPropertyInfo();
assert(wrapperInfo.wrappedValuePlaceholder->getOriginalWrappedValue());
init = wrapperInfo.wrappedValuePlaceholder->getOriginalWrappedValue();
}
}
auto loc = RegularLocation::getAutoGeneratedLocation(init);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitStoredPropertyInitialization", f);
f->createProfiler(init, constant, ForDefinition);
SILGenFunction SGF(*this, *f, initDC);
// If this is a stored property initializer inside a type at global scope,
// it may close over a global variable. If we're emitting top-level code,
// then emit a "mark_function_escape" that lists the captured global
// variables so that definite initialization can reason about this
// escape point.
if (!var->getDeclContext()->isLocalContext() && TopLevelSGF &&
TopLevelSGF->B.hasValidInsertionPoint()) {
emitMarkFunctionEscapeForTopLevelCodeGlobals(var, captureInfo);
}
SGF.emitGeneratorFunction(constant, init, /*EmitProfilerIncrement=*/true);
postEmitFunction(constant, f);
break;
}
case SILDeclRef::Kind::PropertyWrapperBackingInitializer: {
auto *var = cast<VarDecl>(constant.getDecl());
auto loc = RegularLocation::getAutoGeneratedLocation(var);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X(
"silgen emitPropertyWrapperBackingInitializer", f);
auto wrapperInfo = var->getPropertyWrapperBackingPropertyInfo();
assert(wrapperInfo.initializeFromOriginal);
f->createProfiler(wrapperInfo.initializeFromOriginal, constant,
ForDefinition);
auto varDC = var->getInnermostDeclContext();
SILGenFunction SGF(*this, *f, varDC);
SGF.emitGeneratorFunction(constant, wrapperInfo.initializeFromOriginal);
postEmitFunction(constant, f);
break;
}
case SILDeclRef::Kind::GlobalAccessor: {
auto *global = cast<VarDecl>(constant.getDecl());
auto found = delayedGlobals.find(global);
assert(found != delayedGlobals.end());
auto *onceToken = found->second.first;
auto *onceFunc = found->second.second;
auto loc = RegularLocation::getAutoGeneratedLocation(global);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitGlobalAccessor", f);
SILGenFunction(*this, *f, global->getDeclContext())
.emitGlobalAccessor(global, onceToken, onceFunc);
postEmitFunction(constant, f);
break;
}
case SILDeclRef::Kind::EnumElement: {
auto *decl = cast<EnumElementDecl>(constant.getDecl());
auto loc = RegularLocation::getAutoGeneratedLocation(decl);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen enum constructor", f);
SILGenFunction(*this, *f, decl->getDeclContext()).emitEnumConstructor(decl);
postEmitFunction(constant, f);
break;
}
case SILDeclRef::Kind::Destroyer: {
auto *dd = cast<DestructorDecl>(constant.getDecl());
preEmitFunction(constant, f, dd);
PrettyStackTraceSILFunction X("silgen emitDestroyingDestructor", f);
SILGenFunction(*this, *f, dd).emitDestroyingDestructor(dd);
postEmitFunction(constant, f);
return;
}
case SILDeclRef::Kind::Deallocator: {
auto *dd = cast<DestructorDecl>(constant.getDecl());
auto *cd = cast<ClassDecl>(dd->getDeclContext());
if (usesObjCAllocator(cd)) {
preEmitFunction(constant, f, dd);
PrettyStackTraceSILFunction X("silgen emitDestructor -dealloc", f);
f->createProfiler(dd, constant, ForDefinition);
SILGenFunction(*this, *f, dd).emitObjCDestructor(constant);
postEmitFunction(constant, f);
return;
}
auto loc = RegularLocation::getAutoGeneratedLocation(dd);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitDeallocatingDestructor", f);
f->createProfiler(dd, constant, ForDefinition);
SILGenFunction(*this, *f, dd).emitDeallocatingDestructor(dd);
postEmitFunction(constant, f);
return;
}
case SILDeclRef::Kind::IVarInitializer: {
auto *cd = cast<ClassDecl>(constant.getDecl());
auto loc = RegularLocation::getAutoGeneratedLocation(cd);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitDestructor ivar initializer", f);
SILGenFunction(*this, *f, cd).emitIVarInitializer(constant);
postEmitFunction(constant, f);
return;
}
case SILDeclRef::Kind::IVarDestroyer: {
auto *cd = cast<ClassDecl>(constant.getDecl());
auto loc = RegularLocation::getAutoGeneratedLocation(cd);
preEmitFunction(constant, f, loc);
PrettyStackTraceSILFunction X("silgen emitDestructor ivar destroyer", f);
SILGenFunction(*this, *f, cd).emitIVarDestroyer(constant);
postEmitFunction(constant, f);
return;
}
}
}
/// Emit a function now, if it's externally usable or has been referenced in
/// the current TU, or remember how to emit it later if not.
static void emitOrDelayFunction(SILGenModule &SGM,
SILDeclRef constant,
bool forceEmission = false) {
assert(!constant.isThunk());
assert(!constant.isClangImported());
auto emitAfter = SGM.lastEmittedFunction;
SILFunction *f = nullptr;
// Implicit decls may be delayed if they can't be used externally.
auto linkage = constant.getLinkage(ForDefinition);
bool mayDelay = !forceEmission &&
(constant.isImplicit() &&
!isPossiblyUsedExternally(linkage, SGM.M.isWholeModule()));
// Avoid emitting a delayable definition if it hasn't already been referenced.
if (mayDelay)
f = SGM.getEmittedFunction(constant, ForDefinition);
else
f = SGM.getFunction(constant, ForDefinition);
// If we don't want to emit now, remember how for later.
if (!f) {
SGM.delayedFunctions.insert({constant, emitAfter});
// Even though we didn't emit the function now, update the
// lastEmittedFunction so that we preserve the original ordering that
// the symbols would have been emitted in.
SGM.lastEmittedFunction = constant;
return;
}
SGM.emitFunctionDefinition(constant, f);
}
void SILGenModule::preEmitFunction(SILDeclRef constant, SILFunction *F,
SILLocation Loc) {
assert(F->empty() && "already emitted function?!");
if (F->getLoweredFunctionType()->isPolymorphic())
F->setGenericEnvironment(Types.getConstantGenericEnvironment(constant));
// Create a debug scope for the function using astNode as source location.
F->setDebugScope(new (M) SILDebugScope(Loc, F));
LLVM_DEBUG(llvm::dbgs() << "lowering ";
F->printName(llvm::dbgs());
llvm::dbgs() << " : ";
F->getLoweredType().print(llvm::dbgs());
llvm::dbgs() << '\n';
if (auto *decl = Loc.getAsASTNode<ValueDecl>()) {
decl->dump(llvm::dbgs());
llvm::dbgs() << '\n';
} else if (auto *expr = Loc.getAsASTNode<Expr>()) {
expr->dump(llvm::dbgs());
llvm::dbgs() << "\n";
});
}
void SILGenModule::postEmitFunction(SILDeclRef constant,
SILFunction *F) {
emitLazyConformancesForFunction(F);
assert(!F->isExternalDeclaration() && "did not emit any function body?!");
LLVM_DEBUG(llvm::dbgs() << "lowered sil:\n";
F->print(llvm::dbgs()));
F->verify();
emitDifferentiabilityWitnessesForFunction(constant, F);
}
void SILGenModule::emitDifferentiabilityWitnessesForFunction(
SILDeclRef constant, SILFunction *F) {
// Visit `@derivative` attributes and generate SIL differentiability
// witnesses.
// Skip if the SILDeclRef is a:
// - Default argument generator function.
// - Thunk.
if (!constant.hasDecl() || !constant.getAbstractFunctionDecl())
return;
if (constant.kind == SILDeclRef::Kind::DefaultArgGenerator ||
constant.isThunk())
return;
auto *AFD = constant.getAbstractFunctionDecl();
auto emitWitnesses = [&](DeclAttributes &Attrs) {
for (auto *diffAttr : Attrs.getAttributes<DifferentiableAttr>()) {
auto *resultIndices = IndexSubset::get(getASTContext(), 1, {0});
assert((!F->getLoweredFunctionType()->getSubstGenericSignature() ||
diffAttr->getDerivativeGenericSignature()) &&
"Type-checking should resolve derivative generic signatures for "
"all original SIL functions with generic signatures");
auto witnessGenSig =
autodiff::getDifferentiabilityWitnessGenericSignature(
AFD->getGenericSignature(),
diffAttr->getDerivativeGenericSignature());
AutoDiffConfig config(diffAttr->getParameterIndices(), resultIndices,
witnessGenSig);
emitDifferentiabilityWitness(AFD, F, config, /*jvp*/ nullptr,
/*vjp*/ nullptr, diffAttr);
}
for (auto *derivAttr : Attrs.getAttributes<DerivativeAttr>()) {
SILFunction *jvp = nullptr;
SILFunction *vjp = nullptr;
switch (derivAttr->getDerivativeKind()) {
case AutoDiffDerivativeFunctionKind::JVP:
jvp = F;
break;
case AutoDiffDerivativeFunctionKind::VJP:
vjp = F;
break;
}
auto *origAFD = derivAttr->getOriginalFunction(getASTContext());
auto origDeclRef =
SILDeclRef(origAFD).asForeign(requiresForeignEntryPoint(origAFD));
auto *origFn = getFunction(origDeclRef, NotForDefinition);
auto witnessGenSig =
autodiff::getDifferentiabilityWitnessGenericSignature(
origAFD->getGenericSignature(), AFD->getGenericSignature());
auto *resultIndices = IndexSubset::get(getASTContext(), 1, {0});
AutoDiffConfig config(derivAttr->getParameterIndices(), resultIndices,
witnessGenSig);
emitDifferentiabilityWitness(origAFD, origFn, config, jvp, vjp,
derivAttr);
}
};
if (auto *accessor = dyn_cast<AccessorDecl>(AFD))
if (accessor->isGetter())
emitWitnesses(accessor->getStorage()->getAttrs());
emitWitnesses(AFD->getAttrs());
}
void SILGenModule::emitDifferentiabilityWitness(
AbstractFunctionDecl *originalAFD, SILFunction *originalFunction,
const AutoDiffConfig &config, SILFunction *jvp, SILFunction *vjp,
const DeclAttribute *attr) {
assert(isa<DifferentiableAttr>(attr) || isa<DerivativeAttr>(attr));
auto *origFnType = originalAFD->getInterfaceType()->castTo<AnyFunctionType>();
auto origSilFnType = originalFunction->getLoweredFunctionType();
auto *silParamIndices =
autodiff::getLoweredParameterIndices(config.parameterIndices, origFnType);
// NOTE(TF-893): Extending capacity is necessary when `origSilFnType` has
// parameters corresponding to captured variables. These parameters do not
// appear in the type of `origFnType`.
// TODO: If posssible, change `autodiff::getLoweredParameterIndices` to
// take `CaptureInfo` into account.
if (origSilFnType->getNumParameters() > silParamIndices->getCapacity())
silParamIndices = silParamIndices->extendingCapacity(
getASTContext(), origSilFnType->getNumParameters());
// Get or create new SIL differentiability witness.
// Witness already exists when there are two `@derivative` attributes
// (registering JVP and VJP functions) for the same derivative function
// configuration.
// Witness JVP and VJP are set below.
AutoDiffConfig silConfig(silParamIndices, config.resultIndices,
config.derivativeGenericSignature);
SILDifferentiabilityWitnessKey key{originalFunction->getName(), silConfig};
auto *diffWitness = M.lookUpDifferentiabilityWitness(key);
if (!diffWitness) {
// Differentiability witnesses have the same linkage as the original
// function, stripping external.
auto linkage = stripExternalFromLinkage(originalFunction->getLinkage());
diffWitness = SILDifferentiabilityWitness::createDefinition(
M, linkage, originalFunction, silConfig.parameterIndices,
silConfig.resultIndices, config.derivativeGenericSignature,
/*jvp*/ nullptr, /*vjp*/ nullptr,
/*isSerialized*/ hasPublicVisibility(originalFunction->getLinkage()),
attr);
}
// Set derivative function in differentiability witness.
auto setDerivativeInDifferentiabilityWitness =
[&](AutoDiffDerivativeFunctionKind kind, SILFunction *derivative) {
auto derivativeThunk = getOrCreateCustomDerivativeThunk(
derivative, originalFunction, silConfig, kind);
// Check for existing same derivative.
// TODO(TF-835): Remove condition below and simplify assertion to
// `!diffWitness->getDerivative(kind)` after `@derivative` attribute
// type-checking no longer generates implicit `@differentiable`
// attributes.
auto *existingDerivative = diffWitness->getDerivative(kind);
if (existingDerivative && existingDerivative == derivativeThunk)
return;
assert(!existingDerivative &&
"SIL differentiability witness already has a different existing "
"derivative");
diffWitness->setDerivative(kind, derivativeThunk);
};
if (jvp)
setDerivativeInDifferentiabilityWitness(AutoDiffDerivativeFunctionKind::JVP,
jvp);
if (vjp)
setDerivativeInDifferentiabilityWitness(AutoDiffDerivativeFunctionKind::VJP,
vjp);
}
void SILGenModule::
emitMarkFunctionEscapeForTopLevelCodeGlobals(SILLocation loc,
CaptureInfo captureInfo) {
assert(TopLevelSGF && TopLevelSGF->B.hasValidInsertionPoint()
&& "no valid code generator for top-level function?!");
SmallVector<SILValue, 4> Captures;
for (auto capture : captureInfo.getCaptures()) {
// Decls captured by value don't escape.
auto It = TopLevelSGF->VarLocs.find(capture.getDecl());
if (It == TopLevelSGF->VarLocs.end() ||
!It->getSecond().value->getType().isAddress())
continue;
Captures.push_back(It->second.value);
}
if (!Captures.empty())
TopLevelSGF->B.createMarkFunctionEscape(loc, Captures);
}
void SILGenModule::emitAbstractFuncDecl(AbstractFunctionDecl *AFD) {
// Emit any default argument generators.
emitDefaultArgGenerators(AFD, AFD->getParameters());
// If this is a function at global scope, it may close over a global variable.
// If we're emitting top-level code, then emit a "mark_function_escape" that
// lists the captured global variables so that definite initialization can
// reason about this escape point.
if (!AFD->getDeclContext()->isLocalContext() &&
TopLevelSGF && TopLevelSGF->B.hasValidInsertionPoint()) {
emitMarkFunctionEscapeForTopLevelCodeGlobals(AFD, AFD->getCaptureInfo());
}
// If the declaration is exported as a C function, emit its native-to-foreign
// thunk too, if it wasn't already forced.
if (AFD->getAttrs().hasAttribute<CDeclAttr>()) {
auto thunk = SILDeclRef(AFD).asForeign();
if (!hasFunction(thunk))
emitNativeToForeignThunk(thunk);
}
}
void SILGenModule::emitFunction(FuncDecl *fd) {
SILDeclRef::Loc decl = fd;
emitAbstractFuncDecl(fd);
if (fd->hasBody()) {
SILDeclRef constant(decl);
bool ForCoverageMapping = doesASTRequireProfiling(M, fd);
emitOrDelayFunction(*this, constant,
/*forceEmission=*/ForCoverageMapping);
}
}
void SILGenModule::addGlobalVariable(VarDecl *global) {
// We create SILGlobalVariable here.
getSILGlobalVariable(global, ForDefinition);
}
void SILGenModule::emitConstructor(ConstructorDecl *decl) {
// FIXME: Handle 'self' like any other argument here.
// Emit any default argument getter functions.
emitAbstractFuncDecl(decl);
// We never emit constructors in protocols.
if (isa<ProtocolDecl>(decl->getDeclContext()))
return;
SILDeclRef constant(decl);
DeclContext *declCtx = decl->getDeclContext();
bool ForCoverageMapping = doesASTRequireProfiling(M, decl);
if (declCtx->getSelfClassDecl()) {
// Designated initializers for classes, as well as @objc convenience
// initializers, have have separate entry points for allocation and
// initialization.
if (decl->isDesignatedInit() || decl->isObjC()) {
emitOrDelayFunction(*this, constant);
if (decl->hasBody()) {
SILDeclRef initConstant(decl, SILDeclRef::Kind::Initializer);
emitOrDelayFunction(*this, initConstant,
/*forceEmission=*/ForCoverageMapping);
}
return;
}
}
// Struct and enum constructors do everything in a single function, as do
// non-@objc convenience initializers for classes.
if (decl->hasBody()) {
emitOrDelayFunction(*this, constant);
}
}
SILFunction *SILGenModule::emitClosure(AbstractClosureExpr *ce) {
SILDeclRef constant(ce);
SILFunction *f = getFunction(constant, ForDefinition);
// Generate the closure function, if we haven't already.
//
// We may visit the same closure expr multiple times in some cases,
// for instance, when closures appear as in-line initializers of stored
// properties. In these cases the closure will be emitted into every
// initializer of the containing type.
if (!f->isExternalDeclaration())
return f;
emitFunctionDefinition(constant, f);
return f;
}
/// Determine whether the given class requires a separate instance
/// variable initialization method.
static bool requiresIVarInitialization(SILGenModule &SGM, ClassDecl *cd) {
if (!cd->requiresStoredPropertyInits())
return false;
for (Decl *member : cd->getMembers()) {
auto pbd = dyn_cast<PatternBindingDecl>(member);
if (!pbd) continue;
for (auto i : range(pbd->getNumPatternEntries()))
if (pbd->getExecutableInit(i))
return true;
}
return false;
}
bool SILGenModule::hasNonTrivialIVars(ClassDecl *cd) {
for (Decl *member : cd->getMembers()) {
auto *vd = dyn_cast<VarDecl>(member);
if (!vd || !vd->hasStorage()) continue;
auto &ti = Types.getTypeLowering(
vd->getType(), TypeExpansionContext::maximalResilienceExpansionOnly());
if (!ti.isTrivial())
return true;
}
return false;
}
bool SILGenModule::requiresIVarDestroyer(ClassDecl *cd) {
// Only needed if we have non-trivial ivars, we're not a root class, and
// the superclass is not @objc.
return (hasNonTrivialIVars(cd) &&
cd->getSuperclass() &&
!cd->getSuperclass()->getClassOrBoundGenericClass()->hasClangNode());
}
/// TODO: This needs a better name.
void SILGenModule::emitObjCAllocatorDestructor(ClassDecl *cd,
DestructorDecl *dd) {
// Emit the native deallocating destructor for -dealloc.
// Destructors are a necessary part of class metadata, so can't be delayed.
if (dd->hasBody()) {
SILDeclRef dealloc(dd, SILDeclRef::Kind::Deallocator);
emitFunctionDefinition(dealloc, getFunction(dealloc, ForDefinition));
}
// Emit the Objective-C -dealloc entry point if it has
// something to do beyond messaging the superclass's -dealloc.
if (dd->hasBody() && !dd->getBody()->empty())
emitObjCDestructorThunk(dd);
// Emit the ivar initializer, if needed.
if (requiresIVarInitialization(*this, cd)) {
auto ivarInitializer = SILDeclRef(cd, SILDeclRef::Kind::IVarInitializer)
.asForeign();
emitFunctionDefinition(ivarInitializer,
getFunction(ivarInitializer, ForDefinition));
}
// Emit the ivar destroyer, if needed.
if (hasNonTrivialIVars(cd)) {
auto ivarDestroyer = SILDeclRef(cd, SILDeclRef::Kind::IVarDestroyer)
.asForeign();
emitFunctionDefinition(ivarDestroyer,
getFunction(ivarDestroyer, ForDefinition));
}
}
void SILGenModule::emitDestructor(ClassDecl *cd, DestructorDecl *dd) {
emitAbstractFuncDecl(dd);
// Emit the ivar destroyer, if needed.
if (requiresIVarDestroyer(cd)) {
SILDeclRef ivarDestroyer(cd, SILDeclRef::Kind::IVarDestroyer);
emitFunctionDefinition(ivarDestroyer,
getFunction(ivarDestroyer, ForDefinition));
}
// If the class would use the Objective-C allocator, only emit -dealloc.
if (usesObjCAllocator(cd)) {
emitObjCAllocatorDestructor(cd, dd);
return;
}
// Emit the destroying destructor.
// Destructors are a necessary part of class metadata, so can't be delayed.
if (dd->hasBody()) {
SILDeclRef destroyer(dd, SILDeclRef::Kind::Destroyer);
emitFunctionDefinition(destroyer, getFunction(destroyer, ForDefinition));
}
// Emit the deallocating destructor.
{
SILDeclRef deallocator(dd, SILDeclRef::Kind::Deallocator);
emitFunctionDefinition(deallocator,
getFunction(deallocator, ForDefinition));
}
}
void SILGenModule::emitDefaultArgGenerator(SILDeclRef constant,
ParamDecl *param) {
switch (param->getDefaultArgumentKind()) {
case DefaultArgumentKind::None:
llvm_unreachable("No default argument here?");
case DefaultArgumentKind::Normal:
case DefaultArgumentKind::StoredProperty:
emitOrDelayFunction(*this, constant);
break;
case DefaultArgumentKind::Inherited:
#define MAGIC_IDENTIFIER(NAME, STRING, SYNTAX_KIND) \
case DefaultArgumentKind::NAME:
#include "swift/AST/MagicIdentifierKinds.def"
case DefaultArgumentKind::NilLiteral:
case DefaultArgumentKind::EmptyArray:
case DefaultArgumentKind::EmptyDictionary:
break;
}
}
void SILGenModule::
emitStoredPropertyInitialization(PatternBindingDecl *pbd, unsigned i) {
auto *var = pbd->getAnchoringVarDecl(i);
SILDeclRef constant(var, SILDeclRef::Kind::StoredPropertyInitializer);
emitOrDelayFunction(*this, constant);
}
void SILGenModule::
emitPropertyWrapperBackingInitializer(VarDecl *var) {
SILDeclRef constant(var, SILDeclRef::Kind::PropertyWrapperBackingInitializer);
emitOrDelayFunction(*this, constant);
}
SILFunction *SILGenModule::emitLazyGlobalInitializer(StringRef funcName,
PatternBindingDecl *binding,
unsigned pbdEntry) {
ASTContext &C = M.getASTContext();
auto *onceBuiltin =
cast<FuncDecl>(getBuiltinValueDecl(C, C.getIdentifier("once")));
auto blockParam = onceBuiltin->getParameters()->get(1);
auto *type = blockParam->getType()->castTo<FunctionType>();
Type initType = FunctionType::get({}, TupleType::getEmpty(C),
type->getExtInfo());
auto initSILType = cast<SILFunctionType>(
Types.getLoweredRValueType(TypeExpansionContext::minimal(), initType));
SILGenFunctionBuilder builder(*this);
auto *f = builder.createFunction(
SILLinkage::Private, funcName, initSILType, nullptr, SILLocation(binding),
IsNotBare, IsNotTransparent, IsNotSerialized, IsNotDynamic);
f->setSpecialPurpose(SILFunction::Purpose::GlobalInitOnceFunction);
f->setDebugScope(new (M) SILDebugScope(RegularLocation(binding), f));
auto dc = binding->getDeclContext();
SILGenFunction(*this, *f, dc).emitLazyGlobalInitializer(binding, pbdEntry);
emitLazyConformancesForFunction(f);
f->verify();
return f;
}
void SILGenModule::emitGlobalAccessor(VarDecl *global,
SILGlobalVariable *onceToken,
SILFunction *onceFunc) {
SILDeclRef accessor(global, SILDeclRef::Kind::GlobalAccessor);
delayedGlobals[global] = std::make_pair(onceToken, onceFunc);
emitOrDelayFunction(*this, accessor);
}
void SILGenModule::emitDefaultArgGenerators(SILDeclRef::Loc decl,
ParameterList *paramList) {
unsigned index = 0;
for (auto param : *paramList) {
if (param->isDefaultArgument())
emitDefaultArgGenerator(SILDeclRef::getDefaultArgGenerator(decl, index),
param);
++index;
}
}
void SILGenModule::emitObjCMethodThunk(FuncDecl *method) {
auto thunk = SILDeclRef(method).asForeign();
// Don't emit the thunk if it already exists.
if (hasFunction(thunk))
return;
// ObjC entry points are always externally usable, so can't be delay-emitted.
emitNativeToForeignThunk(thunk);
}
void SILGenModule::emitObjCPropertyMethodThunks(AbstractStorageDecl *prop) {
auto *getter = prop->getOpaqueAccessor(AccessorKind::Get);
// If we don't actually need an entry point for the getter, do nothing.
if (!getter || !requiresObjCMethodEntryPoint(getter))
return;
auto getterRef = SILDeclRef(getter, SILDeclRef::Kind::Func).asForeign();
// Don't emit the thunks if they already exist.
if (hasFunction(getterRef))
return;
// ObjC entry points are always externally usable, so emitting can't be
// delayed.
emitNativeToForeignThunk(getterRef);
if (!prop->isSettable(prop->getDeclContext()))
return;
// FIXME: Add proper location.
auto *setter = prop->getOpaqueAccessor(AccessorKind::Set);
auto setterRef = SILDeclRef(setter, SILDeclRef::Kind::Func).asForeign();
emitNativeToForeignThunk(setterRef);
}
void SILGenModule::emitObjCConstructorThunk(ConstructorDecl *constructor) {
auto thunk = SILDeclRef(constructor, SILDeclRef::Kind::Initializer)
.asForeign();
// Don't emit the thunk if it already exists.
if (hasFunction(thunk))
return;
// ObjC entry points are always externally usable, so emitting can't be
// delayed.
emitNativeToForeignThunk(thunk);
}
void SILGenModule::emitObjCDestructorThunk(DestructorDecl *destructor) {
auto thunk = SILDeclRef(destructor, SILDeclRef::Kind::Deallocator)
.asForeign();
// Don't emit the thunk if it already exists.
if (hasFunction(thunk))
return;
emitNativeToForeignThunk(thunk);
}
void SILGenModule::visitPatternBindingDecl(PatternBindingDecl *pd) {
assert(!TopLevelSGF && "script mode PBDs should be in TopLevelCodeDecls");
for (auto i : range(pd->getNumPatternEntries()))
if (pd->getExecutableInit(i))
emitGlobalInitialization(pd, i);
}
void SILGenModule::visitVarDecl(VarDecl *vd) {
if (vd->hasStorage())
addGlobalVariable(vd);
vd->visitEmittedAccessors([&](AccessorDecl *accessor) {
emitFunction(accessor);
});
tryEmitPropertyDescriptor(vd);
}
void SILGenModule::visitSubscriptDecl(SubscriptDecl *sd) {
llvm_unreachable("top-level subscript?");
}
bool
SILGenModule::canStorageUseStoredKeyPathComponent(AbstractStorageDecl *decl,
ResilienceExpansion expansion) {
// If the declaration is resilient, we have to treat the component as
// computed.
if (decl->isResilient(M.getSwiftModule(), expansion))
return false;
auto strategy = decl->getAccessStrategy(AccessSemantics::Ordinary,
decl->supportsMutation()
? AccessKind::ReadWrite
: AccessKind::Read,
M.getSwiftModule(),
expansion);
switch (strategy.getKind()) {
case AccessStrategy::Storage: {
// Keypaths rely on accessors to handle the special behavior of weak or
// unowned properties.
if (decl->getInterfaceType()->is<ReferenceStorageType>())
return false;
// If the field offset depends on the generic instantiation, we have to
// load it from metadata when instantiating the keypath component.
//
// However the metadata offset itself will not be fixed if the superclass
// is resilient. Fall back to treating the property as computed in this
// case.
//
// See the call to getClassFieldOffsetOffset() inside
// emitKeyPathComponent().
if (auto *parentClass = dyn_cast<ClassDecl>(decl->getDeclContext())) {
if (parentClass->isGeneric()) {
auto ancestry = parentClass->checkAncestry();
if (ancestry.contains(AncestryFlags::ResilientOther))
return false;
}
}
// If the stored value would need to be reabstracted in fully opaque
// context, then we have to treat the component as computed.
auto componentObjTy = decl->getValueInterfaceType();
if (auto genericEnv =
decl->getInnermostDeclContext()->getGenericEnvironmentOfContext())
componentObjTy = genericEnv->mapTypeIntoContext(componentObjTy);
auto storageTy = M.Types.getSubstitutedStorageType(
TypeExpansionContext::minimal(), decl, componentObjTy);
auto opaqueTy = M.Types.getLoweredRValueType(
TypeExpansionContext::noOpaqueTypeArchetypesSubstitution(expansion),
AbstractionPattern::getOpaque(), componentObjTy);
return storageTy.getASTType() == opaqueTy;
}
case AccessStrategy::DirectToAccessor:
case AccessStrategy::DispatchToAccessor:
case AccessStrategy::MaterializeToTemporary:
return false;
}
llvm_unreachable("unhandled strategy");
}
static bool canStorageUseTrivialDescriptor(SILGenModule &SGM,
AbstractStorageDecl *decl) {
// A property can use a trivial property descriptor if the key path component
// that an external module would form given publicly-exported information
// about the property is never equivalent to the canonical component for the
// key path.
// This means that the property isn't stored (without promising to be always
// stored) and doesn't have a setter with less-than-public visibility.
auto expansion = ResilienceExpansion::Maximal;
if (!SGM.M.getSwiftModule()->isResilient()) {
if (SGM.canStorageUseStoredKeyPathComponent(decl, expansion)) {
// External modules can't directly access storage, unless this is a
// property in a fixed-layout type.
return !decl->isFormallyResilient();
}
// If the type is computed and doesn't have a setter that's hidden from
// the public, then external components can form the canonical key path
// without our help.
auto *setter = decl->getOpaqueAccessor(AccessorKind::Set);
if (!setter)
return true;
if (setter->getFormalAccessScope(nullptr, true).isPublic())
return true;
return false;
}
// A resilient module needs to handle binaries compiled against its older
// versions. This means we have to be a bit more conservative, since in
// earlier versions, a settable property may have withheld the setter,
// or a fixed-layout type may not have been.
// Without availability information, only get-only computed properties
// can resiliently use trivial descriptors.
return (!SGM.canStorageUseStoredKeyPathComponent(decl, expansion) &&
!decl->supportsMutation());
}
void SILGenModule::tryEmitPropertyDescriptor(AbstractStorageDecl *decl) {
// TODO: Key path code emission doesn't handle opaque values properly yet.
if (!SILModuleConventions(M).useLoweredAddresses())
return;
if (!decl->exportsPropertyDescriptor())
return;
PrettyStackTraceDecl stackTrace("emitting property descriptor for", decl);
Type baseTy;
if (decl->getDeclContext()->isTypeContext()) {
// TODO: Static properties should eventually be referenceable as
// keypaths from T.Type -> Element, viz `baseTy = MetatypeType::get(baseTy)`
assert(!decl->isStatic());
baseTy = decl->getDeclContext()->getSelfInterfaceType()
->getCanonicalType(decl->getInnermostDeclContext()
->getGenericSignatureOfContext());
} else {
// TODO: Global variables should eventually be referenceable as
// key paths from (), viz. baseTy = TupleType::getEmpty(getASTContext());
llvm_unreachable("should not export a property descriptor yet");
}
auto genericEnv = decl->getInnermostDeclContext()
->getGenericEnvironmentOfContext();
unsigned baseOperand = 0;
bool needsGenericContext = true;
if (canStorageUseTrivialDescriptor(*this, decl)) {
(void)SILProperty::create(M, /*serialized*/ false, decl, None);
return;
}
SubstitutionMap subs;
if (genericEnv)
subs = genericEnv->getForwardingSubstitutionMap();
auto component = emitKeyPathComponentForDecl(SILLocation(decl),
genericEnv,
ResilienceExpansion::Maximal,
baseOperand, needsGenericContext,
subs, decl, {},
baseTy->getCanonicalType(),
M.getSwiftModule(),
/*property descriptor*/ true);
(void)SILProperty::create(M, /*serialized*/ false, decl, component);
}
void SILGenModule::visitIfConfigDecl(IfConfigDecl *ICD) {
// Nothing to do for these kinds of decls - anything active has been added
// to the enclosing declaration.
}
void SILGenModule::visitPoundDiagnosticDecl(PoundDiagnosticDecl *PDD) {
// Nothing to do for #error/#warning; they've already been emitted.
}
void SILGenModule::visitTopLevelCodeDecl(TopLevelCodeDecl *td) {
assert(TopLevelSGF && "top-level code in a non-main source file!");
if (!TopLevelSGF->B.hasValidInsertionPoint())
return;
// A single SILFunction may be used to lower multiple top-level decls. When
// this happens, fresh profile counters must be assigned to the new decl.
TopLevelSGF->F.discardProfiler();
TopLevelSGF->F.createProfiler(td, SILDeclRef(), ForDefinition);
TopLevelSGF->emitProfilerIncrement(td->getBody());
DebugScope DS(*TopLevelSGF, CleanupLocation(td));
for (auto &ESD : td->getBody()->getElements()) {
if (!TopLevelSGF->B.hasValidInsertionPoint()) {
if (auto *S = ESD.dyn_cast<Stmt*>()) {
if (S->isImplicit())
continue;
} else if (auto *E = ESD.dyn_cast<Expr*>()) {
if (E->isImplicit())
continue;
}
diagnose(ESD.getStartLoc(), diag::unreachable_code);
// There's no point in trying to emit anything else.
return;
}
if (auto *S = ESD.dyn_cast<Stmt*>()) {
TopLevelSGF->emitStmt(S);
} else if (auto *E = ESD.dyn_cast<Expr*>()) {
TopLevelSGF->emitIgnoredExpr(E);
} else {
TopLevelSGF->visit(ESD.get<Decl*>());
}
}
}
namespace {
/// An RAII class to scope source file codegen.
class SourceFileScope {
SILGenModule &sgm;
SourceFile *sf;
Optional<Scope> scope;
public:
SourceFileScope(SILGenModule &sgm, SourceFile *sf) : sgm(sgm), sf(sf) {
// If this is the script-mode file for the module, create a toplevel.
if (sf->isScriptMode()) {
assert(!sgm.TopLevelSGF && "already emitted toplevel?!");
assert(!sgm.M.lookUpFunction(SWIFT_ENTRY_POINT_FUNCTION)
&& "already emitted toplevel?!");
RegularLocation TopLevelLoc = RegularLocation::getModuleLocation();
SILFunction *toplevel = sgm.emitTopLevelFunction(TopLevelLoc);
// Assign a debug scope pointing into the void to the top level function.
toplevel->setDebugScope(new (sgm.M) SILDebugScope(TopLevelLoc, toplevel));
sgm.TopLevelSGF = new SILGenFunction(sgm, *toplevel, sf);
sgm.TopLevelSGF->MagicFunctionName = sgm.SwiftModule->getName();
auto moduleCleanupLoc = CleanupLocation::getModuleCleanupLocation();
sgm.TopLevelSGF->prepareEpilog(false, true, moduleCleanupLoc);
// Create the argc and argv arguments.
auto prologueLoc = RegularLocation::getModuleLocation();
prologueLoc.markAsPrologue();
auto entry = sgm.TopLevelSGF->B.getInsertionBB();
auto context = sgm.TopLevelSGF->getTypeExpansionContext();
auto paramTypeIter = sgm.TopLevelSGF->F.getConventions()
.getParameterSILTypes(context)
.begin();
entry->createFunctionArgument(*paramTypeIter);
entry->createFunctionArgument(*std::next(paramTypeIter));
scope.emplace(sgm.TopLevelSGF->Cleanups, moduleCleanupLoc);
}
}
~SourceFileScope() {
if (sgm.TopLevelSGF) {
scope.reset();
// Unregister the top-level function emitter.
auto &SGF = *sgm.TopLevelSGF;
sgm.TopLevelSGF = nullptr;
// Write out the epilog.
auto moduleLoc = RegularLocation::getModuleLocation();
moduleLoc.markAutoGenerated();
auto returnInfo = SGF.emitEpilogBB(moduleLoc);
auto returnLoc = returnInfo.second;
returnLoc.markAutoGenerated();
SILType returnType = SGF.F.getConventions().getSingleSILResultType(
SGF.getTypeExpansionContext());
auto emitTopLevelReturnValue = [&](unsigned value) -> SILValue {
// Create an integer literal for the value.
auto litType = SILType::getBuiltinIntegerType(32, sgm.getASTContext());
SILValue retValue =
SGF.B.createIntegerLiteral(moduleLoc, litType, value);
// Wrap that in a struct if necessary.
if (litType != returnType) {
retValue = SGF.B.createStruct(moduleLoc, returnType, retValue);
}
return retValue;
};
// Fallthrough should signal a normal exit by returning 0.
SILValue returnValue;
if (SGF.B.hasValidInsertionPoint())
returnValue = emitTopLevelReturnValue(0);
// Handle the implicit rethrow block.
auto rethrowBB = SGF.ThrowDest.getBlock();
SGF.ThrowDest = JumpDest::invalid();
// If the rethrow block wasn't actually used, just remove it.
if (rethrowBB->pred_empty()) {
SGF.eraseBasicBlock(rethrowBB);
// Otherwise, we need to produce a unified return block.
} else {
auto returnBB = SGF.createBasicBlock();
if (SGF.B.hasValidInsertionPoint())
SGF.B.createBranch(returnLoc, returnBB, returnValue);
returnValue =
returnBB->createPhiArgument(returnType, ValueOwnershipKind::Owned);
SGF.B.emitBlock(returnBB);
// Emit the rethrow block.
SILGenSavedInsertionPoint savedIP(SGF, rethrowBB,
FunctionSection::Postmatter);
// Log the error.
SILValue error = rethrowBB->getArgument(0);
SGF.B.createBuiltin(moduleLoc,
sgm.getASTContext().getIdentifier("errorInMain"),
sgm.Types.getEmptyTupleType(), {}, {error});
// Then end the lifetime of the error.
//
// We do this to appease the ownership verifier. We do not care about
// actually destroying the value since we are going to immediately exit,
// so this saves us a slight bit of code-size since end_lifetime is
// stripped out after ownership is removed.
SGF.B.createEndLifetime(moduleLoc, error);
// Signal an abnormal exit by returning 1.
SGF.Cleanups.emitCleanupsForReturn(CleanupLocation::get(moduleLoc),
IsForUnwind);
SGF.B.createBranch(returnLoc, returnBB, emitTopLevelReturnValue(1));
}
// Return.
if (SGF.B.hasValidInsertionPoint())
SGF.B.createReturn(returnLoc, returnValue);
// Okay, we're done emitting the top-level function; destroy the
// emitter and verify the result.
SILFunction *toplevel = &SGF.getFunction();
delete &SGF;
LLVM_DEBUG(llvm::dbgs() << "lowered toplevel sil:\n";
toplevel->print(llvm::dbgs()));
toplevel->verify();
sgm.emitLazyConformancesForFunction(toplevel);
}
// If the source file contains an artificial main, emit the implicit
// toplevel code.
if (auto mainDecl = sf->getMainDecl()) {
assert(!sgm.M.lookUpFunction(SWIFT_ENTRY_POINT_FUNCTION)
&& "already emitted toplevel before main class?!");
RegularLocation TopLevelLoc = RegularLocation::getModuleLocation();
SILFunction *toplevel = sgm.emitTopLevelFunction(TopLevelLoc);
// Assign a debug scope pointing into the void to the top level function.
toplevel->setDebugScope(new (sgm.M) SILDebugScope(TopLevelLoc, toplevel));
// Create the argc and argv arguments.
SILGenFunction SGF(sgm, *toplevel, sf);
auto entry = SGF.B.getInsertionBB();
auto paramTypeIter =
SGF.F.getConventions()
.getParameterSILTypes(SGF.getTypeExpansionContext())
.begin();
entry->createFunctionArgument(*paramTypeIter);
entry->createFunctionArgument(*std::next(paramTypeIter));
SGF.emitArtificialTopLevel(mainDecl);
}
}
};
// An RAII object that constructs a \c SILGenModule instance.
// On destruction, delayed definitions are automatically emitted.
class SILGenModuleRAII {
SILGenModule SGM;
public:
void emitSourceFile(SourceFile *sf) {
// Type-check the file if we haven't already.
performTypeChecking(*sf);
SourceFileScope scope(SGM, sf);
for (Decl *D : sf->getTopLevelDecls()) {
FrontendStatsTracer StatsTracer(SGM.getASTContext().Stats,
"SILgen-decl", D);
SGM.visit(D);
}
for (Decl *D : sf->getHoistedDecls()) {
FrontendStatsTracer StatsTracer(SGM.getASTContext().Stats,
"SILgen-decl", D);
SGM.visit(D);
}
for (TypeDecl *TD : sf->LocalTypeDecls) {
FrontendStatsTracer StatsTracer(SGM.getASTContext().Stats,
"SILgen-tydecl", TD);
// FIXME: Delayed parsing would prevent these types from being added to
// the module in the first place.
if (TD->getDeclContext()->getInnermostSkippedFunctionContext())
continue;
SGM.visit(TD);
}
}
void emitSILFunctionDefinition(SILDeclRef ref) {
SGM.emitFunctionDefinition(ref, SGM.getFunction(ref, ForDefinition));
}
explicit SILGenModuleRAII(SILModule &M) : SGM{M, M.getSwiftModule()} {}
~SILGenModuleRAII() {
// Emit any delayed definitions that were forced.
// Emitting these may in turn force more definitions, so we have to take
// care to keep pumping the queues.
while (!SGM.forcedFunctions.empty()
|| !SGM.pendingConformances.empty()) {
while (!SGM.forcedFunctions.empty()) {
auto &front = SGM.forcedFunctions.front();
SGM.emitFunctionDefinition(
front, SGM.getEmittedFunction(front, ForDefinition));
SGM.forcedFunctions.pop_front();
}
while (!SGM.pendingConformances.empty()) {
SGM.getWitnessTable(SGM.pendingConformances.front());
SGM.pendingConformances.pop_front();
}
}
}
};
} // end anonymous namespace
std::unique_ptr<SILModule>
ASTLoweringRequest::evaluate(Evaluator &evaluator,
ASTLoweringDescriptor desc) const {
// If we have a .sil file to parse, defer to the parsing request.
if (desc.getSourceFileToParse()) {
return llvm::cantFail(evaluator(ParseSILModuleRequest{desc}));
}
auto silMod = SILModule::createEmptyModule(desc.context, desc.conv,
desc.opts);
SILGenModuleRAII scope(*silMod);
// Emit a specific set of SILDeclRefs if needed.
if (auto refs = desc.refsToEmit) {
for (auto ref : *refs)
scope.emitSILFunctionDefinition(ref);
}
// Emit any whole-files needed.
for (auto file : desc.getFilesToEmit()) {
if (auto *nextSF = dyn_cast<SourceFile>(file))
scope.emitSourceFile(nextSF);
}
// Also make sure to process any intermediate files that may contain SIL.
bool shouldDeserialize =
llvm::any_of(desc.getFilesToEmit(), [](const FileUnit *File) -> bool {
return isa<SerializedASTFile>(File);
});
if (shouldDeserialize) {
auto *primary = desc.context.dyn_cast<FileUnit *>();
silMod->getSILLoader()->getAllForModule(silMod->getSwiftModule()->getName(),
primary);
}
return silMod;
}
std::unique_ptr<SILModule>
swift::performASTLowering(ModuleDecl *mod, Lowering::TypeConverter &tc,
const SILOptions &options) {
auto desc = ASTLoweringDescriptor::forWholeModule(mod, tc, options);
return llvm::cantFail(
mod->getASTContext().evaluator(ASTLoweringRequest{desc}));
}
std::unique_ptr<SILModule>
swift::performASTLowering(FileUnit &sf, Lowering::TypeConverter &tc,
const SILOptions &options) {
auto desc = ASTLoweringDescriptor::forFile(sf, tc, options);
return llvm::cantFail(sf.getASTContext().evaluator(ASTLoweringRequest{desc}));
}
| nathawes/swift | lib/SILGen/SILGen.cpp | C++ | apache-2.0 | 72,968 |
namespace EscapistasClub.Core.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class Add_GameStatus : DbMigration
{
public override void Up()
{
AddColumn("dbo.Games", "Status", c => c.Int(nullable: false));
Sql("UPDATE Games SET [Status] = 1 WHERE IsActive = 0");
Sql("UPDATE Games SET [Status] = 5 WHERE Id in (select g.Id from games g inner join TagGames tg ON tg.Game_Id = g.Id inner join Tags t ON tg.Tag_Id = t.Id WHERE t.Name = 'Próximamente')");
Sql("UPDATE Games SET [Status] = 10 WHERE IsActive = 1");
DropColumn("dbo.Games", "IsActive");
}
public override void Down()
{
AddColumn("dbo.Games", "IsActive", c => c.Boolean(nullable: false));
DropColumn("dbo.Games", "Status");
}
}
}
| vfportero/escapistas.club | src/EscapistasClub.Core/Migrations/201703211955506_Add_GameStatus.cs | C# | apache-2.0 | 899 |
/*
* Copyright 2008 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openehealth.ipf.platform.camel.core.model;
import groovy.lang.Closure;
import org.apache.camel.Expression;
import org.apache.camel.Processor;
import org.apache.camel.spi.RouteContext;
import org.openehealth.ipf.platform.camel.core.adapter.ProcessorAdapter;
import org.openehealth.ipf.platform.camel.core.adapter.StaticParams;
import org.openehealth.ipf.platform.camel.core.closures.DelegatingExpression;
/**
* @author Martin Krasser
*/
public abstract class ProcessorAdapterDefinition extends DelegateDefinition {
private Expression inputExpression;
private Expression paramsExpression;
/**
* Defines the input to the adapter via the given expression
* @param inputExpression
* the expression logic
*/
public ProcessorAdapterDefinition input(Expression inputExpression) {
this.inputExpression = inputExpression;
return this;
}
/**
* Defines the input to the adapter via the closure expression
* @param inputExpression
* a closure implementing the expression logic
*/
public ProcessorAdapterDefinition input(Closure inputExpression) {
this.inputExpression = new DelegatingExpression(inputExpression);
return this;
}
/**
* Defines the parameters for the adapter via the given expression
* @param paramsExpression
* the expression logic
*/
public ProcessorAdapterDefinition params(Expression paramsExpression) {
this.paramsExpression = paramsExpression;
return this;
}
/**
* Defines the parameters for the adapter via the closure expression
* @param paramsExpression
* a closure implementing the expression logic
*/
public ProcessorAdapterDefinition params(Closure paramsExpression) {
this.paramsExpression = new DelegatingExpression(paramsExpression);
return this;
}
/**
* Defines the static parameters for the adapter
* @param params
* the parameters
*/
public ProcessorAdapterDefinition staticParams(Object... params) {
paramsExpression = new StaticParams(params);
return this;
}
public ParamsDefinition params() {
return new ParamsDefinition(this);
}
@Override
protected Processor doCreateDelegate(RouteContext routeContext) {
ProcessorAdapter adapter = doCreateProcessor(routeContext);
if (inputExpression != null) {
adapter.input(inputExpression);
}
if (paramsExpression != null) {
adapter.params(paramsExpression);
}
return adapter;
}
protected abstract ProcessorAdapter doCreateProcessor(RouteContext routeContext);
}
| krasserm/ipf | platform-camel/core/src/main/java/org/openehealth/ipf/platform/camel/core/model/ProcessorAdapterDefinition.java | Java | apache-2.0 | 3,508 |
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.ec2.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
* <p>
* Describes a Reserved Instance offering.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ReservedInstancesOffering" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ReservedInstancesOffering implements Serializable, Cloneable {
/**
* <p>
* The Availability Zone in which the Reserved Instance can be used.
* </p>
*/
private String availabilityZone;
/**
* <p>
* The duration of the Reserved Instance, in seconds.
* </p>
*/
private Long duration;
/**
* <p>
* The purchase price of the Reserved Instance.
* </p>
*/
private Float fixedPrice;
/**
* <p>
* The instance type on which the Reserved Instance can be used.
* </p>
*/
private String instanceType;
/**
* <p>
* The Reserved Instance product platform description.
* </p>
*/
private String productDescription;
/**
* <p>
* The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
* </p>
*/
private String reservedInstancesOfferingId;
/**
* <p>
* The usage price of the Reserved Instance, per hour.
* </p>
*/
private Float usagePrice;
/**
* <p>
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* </p>
*/
private String currencyCode;
/**
* <p>
* The tenancy of the instance.
* </p>
*/
private String instanceTenancy;
/**
* <p>
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon Web
* Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
* </p>
*/
private Boolean marketplace;
/**
* <p>
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary value, with
* different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* </p>
*/
private String offeringClass;
/**
* <p>
* The Reserved Instance offering type.
* </p>
*/
private String offeringType;
/**
* <p>
* The pricing details of the Reserved Instance offering.
* </p>
*/
private com.amazonaws.internal.SdkInternalList<PricingDetail> pricingDetails;
/**
* <p>
* The recurring charge tag assigned to the resource.
* </p>
*/
private com.amazonaws.internal.SdkInternalList<RecurringCharge> recurringCharges;
/**
* <p>
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* </p>
*/
private String scope;
/**
* <p>
* The Availability Zone in which the Reserved Instance can be used.
* </p>
*
* @param availabilityZone
* The Availability Zone in which the Reserved Instance can be used.
*/
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
}
/**
* <p>
* The Availability Zone in which the Reserved Instance can be used.
* </p>
*
* @return The Availability Zone in which the Reserved Instance can be used.
*/
public String getAvailabilityZone() {
return this.availabilityZone;
}
/**
* <p>
* The Availability Zone in which the Reserved Instance can be used.
* </p>
*
* @param availabilityZone
* The Availability Zone in which the Reserved Instance can be used.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withAvailabilityZone(String availabilityZone) {
setAvailabilityZone(availabilityZone);
return this;
}
/**
* <p>
* The duration of the Reserved Instance, in seconds.
* </p>
*
* @param duration
* The duration of the Reserved Instance, in seconds.
*/
public void setDuration(Long duration) {
this.duration = duration;
}
/**
* <p>
* The duration of the Reserved Instance, in seconds.
* </p>
*
* @return The duration of the Reserved Instance, in seconds.
*/
public Long getDuration() {
return this.duration;
}
/**
* <p>
* The duration of the Reserved Instance, in seconds.
* </p>
*
* @param duration
* The duration of the Reserved Instance, in seconds.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withDuration(Long duration) {
setDuration(duration);
return this;
}
/**
* <p>
* The purchase price of the Reserved Instance.
* </p>
*
* @param fixedPrice
* The purchase price of the Reserved Instance.
*/
public void setFixedPrice(Float fixedPrice) {
this.fixedPrice = fixedPrice;
}
/**
* <p>
* The purchase price of the Reserved Instance.
* </p>
*
* @return The purchase price of the Reserved Instance.
*/
public Float getFixedPrice() {
return this.fixedPrice;
}
/**
* <p>
* The purchase price of the Reserved Instance.
* </p>
*
* @param fixedPrice
* The purchase price of the Reserved Instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withFixedPrice(Float fixedPrice) {
setFixedPrice(fixedPrice);
return this;
}
/**
* <p>
* The instance type on which the Reserved Instance can be used.
* </p>
*
* @param instanceType
* The instance type on which the Reserved Instance can be used.
* @see InstanceType
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
* <p>
* The instance type on which the Reserved Instance can be used.
* </p>
*
* @return The instance type on which the Reserved Instance can be used.
* @see InstanceType
*/
public String getInstanceType() {
return this.instanceType;
}
/**
* <p>
* The instance type on which the Reserved Instance can be used.
* </p>
*
* @param instanceType
* The instance type on which the Reserved Instance can be used.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public ReservedInstancesOffering withInstanceType(String instanceType) {
setInstanceType(instanceType);
return this;
}
/**
* <p>
* The instance type on which the Reserved Instance can be used.
* </p>
*
* @param instanceType
* The instance type on which the Reserved Instance can be used.
* @see InstanceType
*/
public void setInstanceType(InstanceType instanceType) {
withInstanceType(instanceType);
}
/**
* <p>
* The instance type on which the Reserved Instance can be used.
* </p>
*
* @param instanceType
* The instance type on which the Reserved Instance can be used.
* @return Returns a reference to this object so that method calls can be chained together.
* @see InstanceType
*/
public ReservedInstancesOffering withInstanceType(InstanceType instanceType) {
this.instanceType = instanceType.toString();
return this;
}
/**
* <p>
* The Reserved Instance product platform description.
* </p>
*
* @param productDescription
* The Reserved Instance product platform description.
* @see RIProductDescription
*/
public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}
/**
* <p>
* The Reserved Instance product platform description.
* </p>
*
* @return The Reserved Instance product platform description.
* @see RIProductDescription
*/
public String getProductDescription() {
return this.productDescription;
}
/**
* <p>
* The Reserved Instance product platform description.
* </p>
*
* @param productDescription
* The Reserved Instance product platform description.
* @return Returns a reference to this object so that method calls can be chained together.
* @see RIProductDescription
*/
public ReservedInstancesOffering withProductDescription(String productDescription) {
setProductDescription(productDescription);
return this;
}
/**
* <p>
* The Reserved Instance product platform description.
* </p>
*
* @param productDescription
* The Reserved Instance product platform description.
* @see RIProductDescription
*/
public void setProductDescription(RIProductDescription productDescription) {
withProductDescription(productDescription);
}
/**
* <p>
* The Reserved Instance product platform description.
* </p>
*
* @param productDescription
* The Reserved Instance product platform description.
* @return Returns a reference to this object so that method calls can be chained together.
* @see RIProductDescription
*/
public ReservedInstancesOffering withProductDescription(RIProductDescription productDescription) {
this.productDescription = productDescription.toString();
return this;
}
/**
* <p>
* The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
* </p>
*
* @param reservedInstancesOfferingId
* The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
*/
public void setReservedInstancesOfferingId(String reservedInstancesOfferingId) {
this.reservedInstancesOfferingId = reservedInstancesOfferingId;
}
/**
* <p>
* The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
* </p>
*
* @return The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
*/
public String getReservedInstancesOfferingId() {
return this.reservedInstancesOfferingId;
}
/**
* <p>
* The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
* </p>
*
* @param reservedInstancesOfferingId
* The ID of the Reserved Instance offering. This is the offering ID used in
* <a>GetReservedInstancesExchangeQuote</a> to confirm that an exchange can be made.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withReservedInstancesOfferingId(String reservedInstancesOfferingId) {
setReservedInstancesOfferingId(reservedInstancesOfferingId);
return this;
}
/**
* <p>
* The usage price of the Reserved Instance, per hour.
* </p>
*
* @param usagePrice
* The usage price of the Reserved Instance, per hour.
*/
public void setUsagePrice(Float usagePrice) {
this.usagePrice = usagePrice;
}
/**
* <p>
* The usage price of the Reserved Instance, per hour.
* </p>
*
* @return The usage price of the Reserved Instance, per hour.
*/
public Float getUsagePrice() {
return this.usagePrice;
}
/**
* <p>
* The usage price of the Reserved Instance, per hour.
* </p>
*
* @param usagePrice
* The usage price of the Reserved Instance, per hour.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withUsagePrice(Float usagePrice) {
setUsagePrice(usagePrice);
return this;
}
/**
* <p>
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* </p>
*
* @param currencyCode
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* @see CurrencyCodeValues
*/
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
/**
* <p>
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* </p>
*
* @return The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* @see CurrencyCodeValues
*/
public String getCurrencyCode() {
return this.currencyCode;
}
/**
* <p>
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* </p>
*
* @param currencyCode
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CurrencyCodeValues
*/
public ReservedInstancesOffering withCurrencyCode(String currencyCode) {
setCurrencyCode(currencyCode);
return this;
}
/**
* <p>
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* </p>
*
* @param currencyCode
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* @see CurrencyCodeValues
*/
public void setCurrencyCode(CurrencyCodeValues currencyCode) {
withCurrencyCode(currencyCode);
}
/**
* <p>
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* </p>
*
* @param currencyCode
* The currency of the Reserved Instance offering you are purchasing. It's specified using ISO 4217 standard
* currency codes. At this time, the only supported currency is <code>USD</code>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see CurrencyCodeValues
*/
public ReservedInstancesOffering withCurrencyCode(CurrencyCodeValues currencyCode) {
this.currencyCode = currencyCode.toString();
return this;
}
/**
* <p>
* The tenancy of the instance.
* </p>
*
* @param instanceTenancy
* The tenancy of the instance.
* @see Tenancy
*/
public void setInstanceTenancy(String instanceTenancy) {
this.instanceTenancy = instanceTenancy;
}
/**
* <p>
* The tenancy of the instance.
* </p>
*
* @return The tenancy of the instance.
* @see Tenancy
*/
public String getInstanceTenancy() {
return this.instanceTenancy;
}
/**
* <p>
* The tenancy of the instance.
* </p>
*
* @param instanceTenancy
* The tenancy of the instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Tenancy
*/
public ReservedInstancesOffering withInstanceTenancy(String instanceTenancy) {
setInstanceTenancy(instanceTenancy);
return this;
}
/**
* <p>
* The tenancy of the instance.
* </p>
*
* @param instanceTenancy
* The tenancy of the instance.
* @see Tenancy
*/
public void setInstanceTenancy(Tenancy instanceTenancy) {
withInstanceTenancy(instanceTenancy);
}
/**
* <p>
* The tenancy of the instance.
* </p>
*
* @param instanceTenancy
* The tenancy of the instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Tenancy
*/
public ReservedInstancesOffering withInstanceTenancy(Tenancy instanceTenancy) {
this.instanceTenancy = instanceTenancy.toString();
return this;
}
/**
* <p>
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon Web
* Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
* </p>
*
* @param marketplace
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon
* Web Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
*/
public void setMarketplace(Boolean marketplace) {
this.marketplace = marketplace;
}
/**
* <p>
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon Web
* Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
* </p>
*
* @return Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon
* Web Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
*/
public Boolean getMarketplace() {
return this.marketplace;
}
/**
* <p>
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon Web
* Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
* </p>
*
* @param marketplace
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon
* Web Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withMarketplace(Boolean marketplace) {
setMarketplace(marketplace);
return this;
}
/**
* <p>
* Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon Web
* Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
* </p>
*
* @return Indicates whether the offering is available through the Reserved Instance Marketplace (resale) or Amazon
* Web Services. If it's a Reserved Instance Marketplace offering, this is <code>true</code>.
*/
public Boolean isMarketplace() {
return this.marketplace;
}
/**
* <p>
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary value, with
* different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* </p>
*
* @param offeringClass
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary
* value, with different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* @see OfferingClassType
*/
public void setOfferingClass(String offeringClass) {
this.offeringClass = offeringClass;
}
/**
* <p>
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary value, with
* different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* </p>
*
* @return If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary
* value, with different configurations. If <code>standard</code>, it is not possible to perform an
* exchange.
* @see OfferingClassType
*/
public String getOfferingClass() {
return this.offeringClass;
}
/**
* <p>
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary value, with
* different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* </p>
*
* @param offeringClass
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary
* value, with different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* @return Returns a reference to this object so that method calls can be chained together.
* @see OfferingClassType
*/
public ReservedInstancesOffering withOfferingClass(String offeringClass) {
setOfferingClass(offeringClass);
return this;
}
/**
* <p>
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary value, with
* different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* </p>
*
* @param offeringClass
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary
* value, with different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* @see OfferingClassType
*/
public void setOfferingClass(OfferingClassType offeringClass) {
withOfferingClass(offeringClass);
}
/**
* <p>
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary value, with
* different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* </p>
*
* @param offeringClass
* If <code>convertible</code> it can be exchanged for Reserved Instances of the same or higher monetary
* value, with different configurations. If <code>standard</code>, it is not possible to perform an exchange.
* @return Returns a reference to this object so that method calls can be chained together.
* @see OfferingClassType
*/
public ReservedInstancesOffering withOfferingClass(OfferingClassType offeringClass) {
this.offeringClass = offeringClass.toString();
return this;
}
/**
* <p>
* The Reserved Instance offering type.
* </p>
*
* @param offeringType
* The Reserved Instance offering type.
* @see OfferingTypeValues
*/
public void setOfferingType(String offeringType) {
this.offeringType = offeringType;
}
/**
* <p>
* The Reserved Instance offering type.
* </p>
*
* @return The Reserved Instance offering type.
* @see OfferingTypeValues
*/
public String getOfferingType() {
return this.offeringType;
}
/**
* <p>
* The Reserved Instance offering type.
* </p>
*
* @param offeringType
* The Reserved Instance offering type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see OfferingTypeValues
*/
public ReservedInstancesOffering withOfferingType(String offeringType) {
setOfferingType(offeringType);
return this;
}
/**
* <p>
* The Reserved Instance offering type.
* </p>
*
* @param offeringType
* The Reserved Instance offering type.
* @see OfferingTypeValues
*/
public void setOfferingType(OfferingTypeValues offeringType) {
withOfferingType(offeringType);
}
/**
* <p>
* The Reserved Instance offering type.
* </p>
*
* @param offeringType
* The Reserved Instance offering type.
* @return Returns a reference to this object so that method calls can be chained together.
* @see OfferingTypeValues
*/
public ReservedInstancesOffering withOfferingType(OfferingTypeValues offeringType) {
this.offeringType = offeringType.toString();
return this;
}
/**
* <p>
* The pricing details of the Reserved Instance offering.
* </p>
*
* @return The pricing details of the Reserved Instance offering.
*/
public java.util.List<PricingDetail> getPricingDetails() {
if (pricingDetails == null) {
pricingDetails = new com.amazonaws.internal.SdkInternalList<PricingDetail>();
}
return pricingDetails;
}
/**
* <p>
* The pricing details of the Reserved Instance offering.
* </p>
*
* @param pricingDetails
* The pricing details of the Reserved Instance offering.
*/
public void setPricingDetails(java.util.Collection<PricingDetail> pricingDetails) {
if (pricingDetails == null) {
this.pricingDetails = null;
return;
}
this.pricingDetails = new com.amazonaws.internal.SdkInternalList<PricingDetail>(pricingDetails);
}
/**
* <p>
* The pricing details of the Reserved Instance offering.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setPricingDetails(java.util.Collection)} or {@link #withPricingDetails(java.util.Collection)} if you want
* to override the existing values.
* </p>
*
* @param pricingDetails
* The pricing details of the Reserved Instance offering.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withPricingDetails(PricingDetail... pricingDetails) {
if (this.pricingDetails == null) {
setPricingDetails(new com.amazonaws.internal.SdkInternalList<PricingDetail>(pricingDetails.length));
}
for (PricingDetail ele : pricingDetails) {
this.pricingDetails.add(ele);
}
return this;
}
/**
* <p>
* The pricing details of the Reserved Instance offering.
* </p>
*
* @param pricingDetails
* The pricing details of the Reserved Instance offering.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withPricingDetails(java.util.Collection<PricingDetail> pricingDetails) {
setPricingDetails(pricingDetails);
return this;
}
/**
* <p>
* The recurring charge tag assigned to the resource.
* </p>
*
* @return The recurring charge tag assigned to the resource.
*/
public java.util.List<RecurringCharge> getRecurringCharges() {
if (recurringCharges == null) {
recurringCharges = new com.amazonaws.internal.SdkInternalList<RecurringCharge>();
}
return recurringCharges;
}
/**
* <p>
* The recurring charge tag assigned to the resource.
* </p>
*
* @param recurringCharges
* The recurring charge tag assigned to the resource.
*/
public void setRecurringCharges(java.util.Collection<RecurringCharge> recurringCharges) {
if (recurringCharges == null) {
this.recurringCharges = null;
return;
}
this.recurringCharges = new com.amazonaws.internal.SdkInternalList<RecurringCharge>(recurringCharges);
}
/**
* <p>
* The recurring charge tag assigned to the resource.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setRecurringCharges(java.util.Collection)} or {@link #withRecurringCharges(java.util.Collection)} if you
* want to override the existing values.
* </p>
*
* @param recurringCharges
* The recurring charge tag assigned to the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withRecurringCharges(RecurringCharge... recurringCharges) {
if (this.recurringCharges == null) {
setRecurringCharges(new com.amazonaws.internal.SdkInternalList<RecurringCharge>(recurringCharges.length));
}
for (RecurringCharge ele : recurringCharges) {
this.recurringCharges.add(ele);
}
return this;
}
/**
* <p>
* The recurring charge tag assigned to the resource.
* </p>
*
* @param recurringCharges
* The recurring charge tag assigned to the resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ReservedInstancesOffering withRecurringCharges(java.util.Collection<RecurringCharge> recurringCharges) {
setRecurringCharges(recurringCharges);
return this;
}
/**
* <p>
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* </p>
*
* @param scope
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* @see Scope
*/
public void setScope(String scope) {
this.scope = scope;
}
/**
* <p>
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* </p>
*
* @return Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* @see Scope
*/
public String getScope() {
return this.scope;
}
/**
* <p>
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* </p>
*
* @param scope
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Scope
*/
public ReservedInstancesOffering withScope(String scope) {
setScope(scope);
return this;
}
/**
* <p>
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* </p>
*
* @param scope
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* @see Scope
*/
public void setScope(Scope scope) {
withScope(scope);
}
/**
* <p>
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* </p>
*
* @param scope
* Whether the Reserved Instance is applied to instances in a Region or an Availability Zone.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Scope
*/
public ReservedInstancesOffering withScope(Scope scope) {
this.scope = scope.toString();
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAvailabilityZone() != null)
sb.append("AvailabilityZone: ").append(getAvailabilityZone()).append(",");
if (getDuration() != null)
sb.append("Duration: ").append(getDuration()).append(",");
if (getFixedPrice() != null)
sb.append("FixedPrice: ").append(getFixedPrice()).append(",");
if (getInstanceType() != null)
sb.append("InstanceType: ").append(getInstanceType()).append(",");
if (getProductDescription() != null)
sb.append("ProductDescription: ").append(getProductDescription()).append(",");
if (getReservedInstancesOfferingId() != null)
sb.append("ReservedInstancesOfferingId: ").append(getReservedInstancesOfferingId()).append(",");
if (getUsagePrice() != null)
sb.append("UsagePrice: ").append(getUsagePrice()).append(",");
if (getCurrencyCode() != null)
sb.append("CurrencyCode: ").append(getCurrencyCode()).append(",");
if (getInstanceTenancy() != null)
sb.append("InstanceTenancy: ").append(getInstanceTenancy()).append(",");
if (getMarketplace() != null)
sb.append("Marketplace: ").append(getMarketplace()).append(",");
if (getOfferingClass() != null)
sb.append("OfferingClass: ").append(getOfferingClass()).append(",");
if (getOfferingType() != null)
sb.append("OfferingType: ").append(getOfferingType()).append(",");
if (getPricingDetails() != null)
sb.append("PricingDetails: ").append(getPricingDetails()).append(",");
if (getRecurringCharges() != null)
sb.append("RecurringCharges: ").append(getRecurringCharges()).append(",");
if (getScope() != null)
sb.append("Scope: ").append(getScope());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ReservedInstancesOffering == false)
return false;
ReservedInstancesOffering other = (ReservedInstancesOffering) obj;
if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null)
return false;
if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == false)
return false;
if (other.getDuration() == null ^ this.getDuration() == null)
return false;
if (other.getDuration() != null && other.getDuration().equals(this.getDuration()) == false)
return false;
if (other.getFixedPrice() == null ^ this.getFixedPrice() == null)
return false;
if (other.getFixedPrice() != null && other.getFixedPrice().equals(this.getFixedPrice()) == false)
return false;
if (other.getInstanceType() == null ^ this.getInstanceType() == null)
return false;
if (other.getInstanceType() != null && other.getInstanceType().equals(this.getInstanceType()) == false)
return false;
if (other.getProductDescription() == null ^ this.getProductDescription() == null)
return false;
if (other.getProductDescription() != null && other.getProductDescription().equals(this.getProductDescription()) == false)
return false;
if (other.getReservedInstancesOfferingId() == null ^ this.getReservedInstancesOfferingId() == null)
return false;
if (other.getReservedInstancesOfferingId() != null && other.getReservedInstancesOfferingId().equals(this.getReservedInstancesOfferingId()) == false)
return false;
if (other.getUsagePrice() == null ^ this.getUsagePrice() == null)
return false;
if (other.getUsagePrice() != null && other.getUsagePrice().equals(this.getUsagePrice()) == false)
return false;
if (other.getCurrencyCode() == null ^ this.getCurrencyCode() == null)
return false;
if (other.getCurrencyCode() != null && other.getCurrencyCode().equals(this.getCurrencyCode()) == false)
return false;
if (other.getInstanceTenancy() == null ^ this.getInstanceTenancy() == null)
return false;
if (other.getInstanceTenancy() != null && other.getInstanceTenancy().equals(this.getInstanceTenancy()) == false)
return false;
if (other.getMarketplace() == null ^ this.getMarketplace() == null)
return false;
if (other.getMarketplace() != null && other.getMarketplace().equals(this.getMarketplace()) == false)
return false;
if (other.getOfferingClass() == null ^ this.getOfferingClass() == null)
return false;
if (other.getOfferingClass() != null && other.getOfferingClass().equals(this.getOfferingClass()) == false)
return false;
if (other.getOfferingType() == null ^ this.getOfferingType() == null)
return false;
if (other.getOfferingType() != null && other.getOfferingType().equals(this.getOfferingType()) == false)
return false;
if (other.getPricingDetails() == null ^ this.getPricingDetails() == null)
return false;
if (other.getPricingDetails() != null && other.getPricingDetails().equals(this.getPricingDetails()) == false)
return false;
if (other.getRecurringCharges() == null ^ this.getRecurringCharges() == null)
return false;
if (other.getRecurringCharges() != null && other.getRecurringCharges().equals(this.getRecurringCharges()) == false)
return false;
if (other.getScope() == null ^ this.getScope() == null)
return false;
if (other.getScope() != null && other.getScope().equals(this.getScope()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode());
hashCode = prime * hashCode + ((getDuration() == null) ? 0 : getDuration().hashCode());
hashCode = prime * hashCode + ((getFixedPrice() == null) ? 0 : getFixedPrice().hashCode());
hashCode = prime * hashCode + ((getInstanceType() == null) ? 0 : getInstanceType().hashCode());
hashCode = prime * hashCode + ((getProductDescription() == null) ? 0 : getProductDescription().hashCode());
hashCode = prime * hashCode + ((getReservedInstancesOfferingId() == null) ? 0 : getReservedInstancesOfferingId().hashCode());
hashCode = prime * hashCode + ((getUsagePrice() == null) ? 0 : getUsagePrice().hashCode());
hashCode = prime * hashCode + ((getCurrencyCode() == null) ? 0 : getCurrencyCode().hashCode());
hashCode = prime * hashCode + ((getInstanceTenancy() == null) ? 0 : getInstanceTenancy().hashCode());
hashCode = prime * hashCode + ((getMarketplace() == null) ? 0 : getMarketplace().hashCode());
hashCode = prime * hashCode + ((getOfferingClass() == null) ? 0 : getOfferingClass().hashCode());
hashCode = prime * hashCode + ((getOfferingType() == null) ? 0 : getOfferingType().hashCode());
hashCode = prime * hashCode + ((getPricingDetails() == null) ? 0 : getPricingDetails().hashCode());
hashCode = prime * hashCode + ((getRecurringCharges() == null) ? 0 : getRecurringCharges().hashCode());
hashCode = prime * hashCode + ((getScope() == null) ? 0 : getScope().hashCode());
return hashCode;
}
@Override
public ReservedInstancesOffering clone() {
try {
return (ReservedInstancesOffering) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ReservedInstancesOffering.java | Java | apache-2.0 | 41,876 |
# Copyright 2016 Presslabs SRL
#
# 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.
class TestCobalt:
def test_stop_signals(self, mocker):
pass
| PressLabs/cobalt | tests/unit/cobalt/test_cobalt.py | Python | apache-2.0 | 650 |
/**
* Copyright [2014] Gaurav Gupta
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.netbeans.orm.converter.compiler;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.netbeans.orm.converter.util.ORMConverterUtil;
public class JoinTableSnippet implements Snippet {
private String catalog = null;
private String name = null;
private String schema = null;
private List<JoinColumnSnippet> inverseJoinColumns = Collections.EMPTY_LIST;
private List<JoinColumnSnippet> joinColumns = Collections.EMPTY_LIST;
private UniqueConstraintSnippet uniqueConstraint = null;
public String getCatalog() {
return catalog;
}
public void setCatalog(String catalog) {
this.catalog = catalog;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSchema() {
return schema;
}
public void setSchema(String schema) {
this.schema = schema;
}
public List<JoinColumnSnippet> getInverseJoinColumns() {
return inverseJoinColumns;
}
public void setInverseJoinColumns(List<JoinColumnSnippet> inverseJoinColumns) {
if (inverseJoinColumns != null) {
this.inverseJoinColumns = inverseJoinColumns;
}
}
public List<JoinColumnSnippet> getJoinColumns() {
return joinColumns;
}
public void setJoinColumns(List<JoinColumnSnippet> joinColumns) {
if (joinColumns != null) {
this.joinColumns = joinColumns;
}
}
public UniqueConstraintSnippet getUniqueConstraint() {
return uniqueConstraint;
}
public void setUniqueConstraints(UniqueConstraintSnippet uniqueConstraint) {
this.uniqueConstraint = uniqueConstraint;
}
public boolean isEmpty() {
return (catalog == null || catalog.trim().isEmpty())
&& (name == null || name.trim().isEmpty())
&& (schema == null || schema.trim().isEmpty())
&& joinColumns.isEmpty()
&& inverseJoinColumns.isEmpty()
&& uniqueConstraint == null;
}
public String getSnippet() throws InvalidDataException {
if ((catalog == null || catalog.trim().isEmpty())
&& (name == null || name.trim().isEmpty())
&& (schema == null || schema.trim().isEmpty())
&& inverseJoinColumns.isEmpty()
&& joinColumns.isEmpty()
&& uniqueConstraint == null) {
return null;
}
StringBuilder builder = new StringBuilder();
builder.append("@JoinTable(");
if (name != null && !name.trim().isEmpty()) {
builder.append("name=\"");
builder.append(name);
builder.append(ORMConverterUtil.QUOTE);
builder.append(ORMConverterUtil.COMMA);
}
if (schema != null && !schema.trim().isEmpty()) {
builder.append("schema=\"");
builder.append(schema);
builder.append(ORMConverterUtil.QUOTE);
builder.append(ORMConverterUtil.COMMA);
}
if (catalog != null && !catalog.trim().isEmpty()) {
builder.append("catalog=\"");
builder.append(catalog);
builder.append(ORMConverterUtil.QUOTE);
builder.append(ORMConverterUtil.COMMA);
}
if (uniqueConstraint != null) {
builder.append("uniqueConstraints=");
builder.append(uniqueConstraint.getSnippet());
builder.append(ORMConverterUtil.COMMA);
}
if (!joinColumns.isEmpty()) {
builder.append("joinColumns={");
for (JoinColumnSnippet joinColumn : joinColumns) {
builder.append(joinColumn.getSnippet());
builder.append(ORMConverterUtil.COMMA);
}
builder.deleteCharAt(builder.length() - 1);
builder.append(ORMConverterUtil.CLOSE_BRACES);
builder.append(ORMConverterUtil.COMMA);
}
if (!inverseJoinColumns.isEmpty()) {
builder.append("inverseJoinColumns={");
for (JoinColumnSnippet joinColumn : inverseJoinColumns) {
builder.append(joinColumn.getSnippet());
builder.append(ORMConverterUtil.COMMA);
}
builder.deleteCharAt(builder.length() - 1);
builder.append(ORMConverterUtil.CLOSE_BRACES);
builder.append(ORMConverterUtil.COMMA);
}
return builder.substring(0, builder.length() - 1)
+ ORMConverterUtil.CLOSE_PARANTHESES;
}
public Collection<String> getImportSnippets() throws InvalidDataException {
if (isEmpty()) {
return new ArrayList<String>();
}
if (inverseJoinColumns.isEmpty()
&& joinColumns.isEmpty()
&& uniqueConstraint == null) {
return Collections.singletonList("javax.persistence.JoinTable");
}
Collection<String> importSnippets = new ArrayList<String>();
importSnippets.add("javax.persistence.JoinTable");
if (!joinColumns.isEmpty()) {
Collection<String> joinColumnSnippets
= joinColumns.get(0).getImportSnippets();
importSnippets.addAll(joinColumnSnippets);
}
if (uniqueConstraint != null) {
Collection<String> uniqueConstraintSnippets
= uniqueConstraint.getImportSnippets();
importSnippets.addAll(uniqueConstraintSnippets);
}
return importSnippets;
}
}
| foxerfly/Netbeans-JPA-Modeler | ORM Converter/src/org/netbeans/orm/converter/compiler/JoinTableSnippet.java | Java | apache-2.0 | 6,262 |
package org.ebookdroid.xpsdroid.codec;
import org.ebookdroid.core.EBookDroidLibraryLoader;
import org.ebookdroid.core.codec.AbstractCodecContext;
import org.ebookdroid.core.codec.CodecDocument;
import android.graphics.Bitmap;
public class XpsContext extends AbstractCodecContext {
public static final boolean useNativeGraphics;
public static final Bitmap.Config BITMAP_CFG = Bitmap.Config.RGB_565;
public static final Bitmap.Config NATIVE_BITMAP_CFG = Bitmap.Config.ARGB_8888;
static {
EBookDroidLibraryLoader.load();
useNativeGraphics = isNativeGraphicsAvailable();
}
@Override
public Bitmap.Config getBitmapConfig() {
return useNativeGraphics ? NATIVE_BITMAP_CFG : BITMAP_CFG;
}
@Override
public CodecDocument openDocument(final String fileName, final String password) {
return new XpsDocument(this, fileName);
}
private static native boolean isNativeGraphicsAvailable();
}
| hk0792/UsefulClass | EBookDroid/src/org/ebookdroid/xpsdroid/codec/XpsContext.java | Java | apache-2.0 | 967 |
/*
* Copyright (c) 2010-2016 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.gui.api.component;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.web.security.MidPointApplication;
import com.evolveum.midpoint.web.security.MidPointAuthWebSession;
import com.evolveum.midpoint.web.security.WebApplicationConfiguration;
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.StringResourceModel;
/**
* Base class for most midPoint GUI panels. It has a constructor and
* utility methods for convenient handling of the model. It also has
* other utility methods often used in reusable components.
*
* Almost all reusable components should extend this class.
*
* @author lazyman
* @author semancik
*/
public class BasePanel<T> extends Panel {
private IModel<T> model;
public BasePanel(String id) {
this(id, null);
}
public BasePanel(String id, IModel<T> model) {
super(id);
this.model = model == null ? createModel() : model;
}
public IModel<T> createModel() {
return null;
}
public IModel<T> getModel() {
return model;
}
public T getModelObject() {
return model != null ? model.getObject() : null;
}
public String getString(String resourceKey, Object... objects) {
return createStringResource(resourceKey, objects).getString();
}
public StringResourceModel createStringResource(String resourceKey, Object... objects) {
return new StringResourceModel(resourceKey, this).setModel(null)
.setDefaultValue(resourceKey)
.setParameters(objects);
// return StringResourceModelMigration.of(resourceKey, this, null, resourceKey, objects);
}
public StringResourceModel createStringResource(Enum e) {
return createStringResource(e, null);
}
public StringResourceModel createStringResource(Enum e, String prefix) {
return createStringResource(e, prefix, null);
}
public StringResourceModel createStringResource(Enum e, String prefix, String nullKey) {
StringBuilder sb = new StringBuilder();
if (StringUtils.isNotEmpty(prefix)) {
sb.append(prefix).append('.');
}
if (e == null) {
if (StringUtils.isNotEmpty(nullKey)) {
sb.append(nullKey);
} else {
sb = new StringBuilder();
}
} else {
sb.append(e.getDeclaringClass().getSimpleName()).append('.');
sb.append(e.name());
}
return createStringResource(sb.toString());
}
public PageBase getPageBase() {
return WebComponentUtil.getPageBase(this);
}
protected String createComponentPath(String... components) {
return StringUtils.join(components, ":");
}
public WebApplicationConfiguration getWebApplicationConfiguration() {
MidPointApplication application = (MidPointApplication) MidPointApplication.get();
return application.getWebApplicationConfiguration();
}
@Override
public MidPointAuthWebSession getSession() {
return (MidPointAuthWebSession) super.getSession();
}
}
| PetrGasparik/midpoint | gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/BasePanel.java | Java | apache-2.0 | 3,904 |
/*
* Copyright 2012-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.android;
import com.facebook.buck.android.apkmodule.APKModule;
import com.facebook.buck.android.apkmodule.APKModuleGraph;
import com.facebook.buck.android.dalvik.DalvikAwareZipSplitterFactory;
import com.facebook.buck.android.dalvik.ZipSplitterFactory;
import com.facebook.buck.android.dalvik.firstorder.FirstOrderHelper;
import com.facebook.buck.io.file.MorePaths;
import com.facebook.buck.io.filesystem.ProjectFilesystem;
import com.facebook.buck.step.ExecutionContext;
import com.facebook.buck.step.Step;
import com.facebook.buck.step.StepExecutionResult;
import com.facebook.buck.step.StepExecutionResults;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Multimap;
import com.google.common.hash.Hashing;
import com.google.common.io.Files;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import javax.annotation.Nullable;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
/**
* Split zipping tool designed to divide input code blobs into a set of output jar files such that
* none will exceed the DexOpt LinearAlloc limit or the dx method limit when passed through dx
* --dex.
*/
public class SplitZipStep implements Step {
@VisibleForTesting
static final Pattern CANARY_CLASS_FILE_PATTERN = Pattern.compile("^([\\w/$]+)\\.Canary\\.class");
@VisibleForTesting
static final Pattern CLASS_FILE_PATTERN = Pattern.compile("^([\\w/$]+)\\.class");
public static final String SECONDARY_DEX_ID = "dex";
private final ProjectFilesystem filesystem;
private final Set<Path> inputPathsToSplit;
private final Path secondaryJarMetaPath;
private final Path primaryJarPath;
private final Path secondaryJarDir;
private final String secondaryJarPattern;
private final Path addtionalDexStoreJarMetaPath;
private final Path additionalDexStoreJarDir;
private final Optional<Path> proguardFullConfigFile;
private final Optional<Path> proguardMappingFile;
private final boolean skipProguard;
private final DexSplitMode dexSplitMode;
private final Path pathToReportDir;
private final Optional<Path> primaryDexScenarioFile;
private final Optional<Path> primaryDexClassesFile;
private final Optional<Path> secondaryDexHeadClassesFile;
private final Optional<Path> secondaryDexTailClassesFile;
private final ImmutableMultimap<APKModule, Path> apkModuleToJarPathMap;
private final APKModule rootAPKModule;
@Nullable private ImmutableMultimap<APKModule, Path> outputFiles;
private ImmutableMap<APKModule, ImmutableSortedSet<APKModule>> apkModuleMap;
/**
* @param inputPathsToSplit Input paths that would otherwise have been passed to a single dx --dex
* invocation.
* @param secondaryJarMetaPath Output location for the metadata text file describing each
* secondary jar artifact.
* @param primaryJarPath Output path for the primary jar file.
* @param secondaryJarDir Output location for secondary jar files. Note that this directory may be
* empty if no secondary jar files are needed.
* @param secondaryJarPattern Filename pattern for secondary jar files. Pattern contains one %d
* argument representing the enumerated secondary zip count (starting at 1).
* @param proguardFullConfigFile Path to the full generated ProGuard configuration, generated by
* the -printconfiguration flag. This is part of the *output* of ProGuard.
* @param proguardMappingFile Path to the mapping file generated by ProGuard's obfuscation.
* @param apkModuleMap
* @param rootAPKModule
*/
public SplitZipStep(
ProjectFilesystem filesystem,
Set<Path> inputPathsToSplit,
Path secondaryJarMetaPath,
Path primaryJarPath,
Path secondaryJarDir,
String secondaryJarPattern,
Path addtionalDexStoreJarMetaPath,
Path additionalDexStoreJarDir,
Optional<Path> proguardFullConfigFile,
Optional<Path> proguardMappingFile,
boolean skipProguard,
DexSplitMode dexSplitMode,
Optional<Path> primaryDexScenarioFile,
Optional<Path> primaryDexClassesFile,
Optional<Path> secondaryDexHeadClassesFile,
Optional<Path> secondaryDexTailClassesFile,
ImmutableMultimap<APKModule, Path> apkModuleToJarPathMap,
ImmutableSortedMap<APKModule, ImmutableSortedSet<APKModule>> apkModuleMap,
APKModule rootAPKModule,
Path pathToReportDir) {
this.filesystem = filesystem;
this.inputPathsToSplit = ImmutableSet.copyOf(inputPathsToSplit);
this.secondaryJarMetaPath = secondaryJarMetaPath;
this.primaryJarPath = primaryJarPath;
this.secondaryJarDir = secondaryJarDir;
this.secondaryJarPattern = secondaryJarPattern;
this.addtionalDexStoreJarMetaPath = addtionalDexStoreJarMetaPath;
this.additionalDexStoreJarDir = additionalDexStoreJarDir;
this.proguardFullConfigFile = proguardFullConfigFile;
this.proguardMappingFile = proguardMappingFile;
this.skipProguard = skipProguard;
this.dexSplitMode = dexSplitMode;
this.primaryDexScenarioFile = primaryDexScenarioFile;
this.primaryDexClassesFile = primaryDexClassesFile;
this.secondaryDexHeadClassesFile = secondaryDexHeadClassesFile;
this.secondaryDexTailClassesFile = secondaryDexTailClassesFile;
this.apkModuleToJarPathMap = apkModuleToJarPathMap;
this.pathToReportDir = pathToReportDir;
this.rootAPKModule = rootAPKModule;
this.apkModuleMap = apkModuleMap;
if (!skipProguard) {
Preconditions.checkArgument(
proguardFullConfigFile.isPresent() == proguardMappingFile.isPresent(),
"ProGuard configuration and mapping must both be present or absent.");
}
}
@Override
public StepExecutionResult execute(ExecutionContext context) throws IOException {
Set<Path> inputJarPaths =
inputPathsToSplit.stream().map(filesystem::resolve).collect(ImmutableSet.toImmutableSet());
Supplier<ImmutableList<ClassNode>> classes =
ClassNodeListSupplier.createMemoized(inputJarPaths);
ProguardTranslatorFactory translatorFactory =
ProguardTranslatorFactory.create(
filesystem, proguardFullConfigFile, proguardMappingFile, skipProguard);
Predicate<String> requiredInPrimaryZip =
createRequiredInPrimaryZipPredicate(translatorFactory, classes);
ImmutableSet<String> wantedInPrimaryZip =
getWantedPrimaryDexEntries(translatorFactory, classes);
ImmutableSet<String> secondaryHeadSet = getSecondaryHeadSet(translatorFactory);
ImmutableSet<String> secondaryTailSet = getSecondaryTailSet(translatorFactory);
ImmutableMultimap<APKModule, String> additionalDexStoreClasses =
APKModuleGraph.getAPKModuleToClassesMap(
apkModuleToJarPathMap,
translatorFactory.createNullableObfuscationFunction(),
filesystem);
ZipSplitterFactory zipSplitterFactory;
zipSplitterFactory =
new DalvikAwareZipSplitterFactory(
dexSplitMode.getLinearAllocHardLimit(), wantedInPrimaryZip);
outputFiles =
zipSplitterFactory
.newInstance(
filesystem,
inputJarPaths,
primaryJarPath,
secondaryJarDir,
secondaryJarPattern,
additionalDexStoreJarDir,
requiredInPrimaryZip,
secondaryHeadSet,
secondaryTailSet,
additionalDexStoreClasses,
rootAPKModule,
dexSplitMode.getDexSplitStrategy(),
filesystem.getPathForRelativePath(pathToReportDir))
.execute();
for (APKModule dexStore : outputFiles.keySet()) {
if (dexStore.getName().equals(SECONDARY_DEX_ID)) {
try (BufferedWriter secondaryMetaInfoWriter =
Files.newWriter(filesystem.resolve(secondaryJarMetaPath).toFile(), Charsets.UTF_8)) {
writeMetaList(
secondaryMetaInfoWriter,
SECONDARY_DEX_ID,
ImmutableSet.of(),
outputFiles
.get(dexStore)
.stream()
.map(filesystem::resolve)
.collect(Collectors.toList()),
dexSplitMode.getDexStore());
}
} else {
try (BufferedWriter secondaryMetaInfoWriter =
Files.newWriter(
addtionalDexStoreJarMetaPath
.resolve("assets")
.resolve(dexStore.getName())
.resolve("metadata.txt")
.toFile(),
Charsets.UTF_8)) {
writeMetaList(
secondaryMetaInfoWriter,
dexStore.getName(),
Objects.requireNonNull(apkModuleMap.get(dexStore)),
outputFiles
.get(dexStore)
.stream()
.map(filesystem::resolve)
.collect(Collectors.toList()),
dexSplitMode.getDexStore());
}
}
}
return StepExecutionResults.SUCCESS;
}
@VisibleForTesting
Predicate<String> createRequiredInPrimaryZipPredicate(
ProguardTranslatorFactory translatorFactory,
Supplier<ImmutableList<ClassNode>> classesSupplier)
throws IOException {
Function<String, String> deobfuscate = translatorFactory.createDeobfuscationFunction();
ImmutableSet<String> primaryDexClassNames =
getRequiredPrimaryDexClassNames(translatorFactory, classesSupplier);
ClassNameFilter primaryDexFilter =
ClassNameFilter.fromConfiguration(dexSplitMode.getPrimaryDexPatterns());
return classFileName -> {
// Drop the ".class" suffix and deobfuscate the class name before we apply our checks.
String internalClassName =
Objects.requireNonNull(deobfuscate.apply(classFileName.replaceAll("\\.class$", "")));
return primaryDexClassNames.contains(internalClassName)
|| primaryDexFilter.matches(internalClassName);
};
}
/**
* Construct a {@link Set} of internal class names that must go into the primary dex.
*
* <p>
*
* @return ImmutableSet of class internal names.
*/
private ImmutableSet<String> getRequiredPrimaryDexClassNames(
ProguardTranslatorFactory translatorFactory,
Supplier<ImmutableList<ClassNode>> classesSupplier)
throws IOException {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
if (primaryDexClassesFile.isPresent()) {
Iterable<String> classes =
filesystem
.readLines(primaryDexClassesFile.get())
.stream()
.map(String::trim)
.filter(SplitZipStep::isNeitherEmptyNorComment)
.collect(Collectors.toList());
builder.addAll(classes);
}
// If there is a scenario file but overflow is not allowed, then the scenario dependencies
// are required, and therefore get added here.
if (!dexSplitMode.isPrimaryDexScenarioOverflowAllowed() && primaryDexScenarioFile.isPresent()) {
addScenarioClasses(translatorFactory, classesSupplier, builder, primaryDexScenarioFile.get());
}
return builder.build();
}
/**
* Construct a {@link Set} of internal class names that must go into the beginning of the
* secondary dexes.
*
* <p>
*
* @return ImmutableSet of class internal names.
*/
private ImmutableSet<String> getSecondaryHeadSet(ProguardTranslatorFactory translatorFactory)
throws IOException {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
if (secondaryDexHeadClassesFile.isPresent()) {
filesystem
.readLines(secondaryDexHeadClassesFile.get())
.stream()
.map(String::trim)
.filter(SplitZipStep::isNeitherEmptyNorComment)
.map(translatorFactory.createObfuscationFunction())
.forEach(builder::add);
}
return builder.build();
}
/**
* Construct a {@link Set} of internal class names that must go into the beginning of the
* secondary dexes.
*
* <p>
*
* @return ImmutableSet of class internal names.
*/
private ImmutableSet<String> getSecondaryTailSet(ProguardTranslatorFactory translatorFactory)
throws IOException {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
if (secondaryDexTailClassesFile.isPresent()) {
filesystem
.readLines(secondaryDexTailClassesFile.get())
.stream()
.map(String::trim)
.filter(SplitZipStep::isNeitherEmptyNorComment)
.map(translatorFactory.createObfuscationFunction())
.forEach(builder::add);
}
return builder.build();
}
/**
* Construct a {@link Set} of zip file entry names that should go into the primary dex to improve
* performance.
*
* <p>
*
* @return ImmutableList of zip file entry names.
*/
private ImmutableSet<String> getWantedPrimaryDexEntries(
ProguardTranslatorFactory translatorFactory,
Supplier<ImmutableList<ClassNode>> classesSupplier)
throws IOException {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
// If there is a scenario file and overflow is allowed, then the scenario dependencies
// are wanted but not required, and therefore get added here.
if (dexSplitMode.isPrimaryDexScenarioOverflowAllowed() && primaryDexScenarioFile.isPresent()) {
addScenarioClasses(translatorFactory, classesSupplier, builder, primaryDexScenarioFile.get());
}
return builder
.build()
.stream()
.map(input -> input + ".class")
.collect(ImmutableSet.toImmutableSet());
}
/**
* Adds classes listed in the scenario file along with their dependencies. This adds classes plus
* dependencies in the order the classes appear in the scenario file.
*
* <p>
*
* @throws IOException
*/
private void addScenarioClasses(
ProguardTranslatorFactory translatorFactory,
Supplier<ImmutableList<ClassNode>> classesSupplier,
ImmutableSet.Builder<String> builder,
Path scenarioFile)
throws IOException {
Function<String, String> obfuscationFunction = translatorFactory.createObfuscationFunction();
Function<String, String> deObfuscationFunction =
translatorFactory.createDeobfuscationFunction();
ImmutableList<Type> scenarioClasses =
filesystem
.readLines(scenarioFile)
.stream()
.map(String::trim)
.filter(SplitZipStep::isNeitherEmptyNorComment)
.map(obfuscationFunction)
.map(Type::getObjectType)
.collect(ImmutableList.toImmutableList());
ImmutableSet.Builder<String> classBuilder = ImmutableSet.builder();
FirstOrderHelper.addTypesAndDependencies(scenarioClasses, classesSupplier.get(), classBuilder);
builder.addAll(
classBuilder.build().stream().map(deObfuscationFunction).collect(Collectors.toSet()));
}
@VisibleForTesting
static void writeMetaList(
BufferedWriter writer,
String id,
ImmutableSet<APKModule> requires,
List<Path> jarFiles,
DexStore dexStore)
throws IOException {
boolean isSecondaryDexStore = id.equals(SECONDARY_DEX_ID);
if (DexStore.RAW.equals(dexStore) && isSecondaryDexStore) {
writer.write(".root_relative");
writer.newLine();
}
if (!isSecondaryDexStore) {
writer.write(String.format(".id %s", id));
writer.newLine();
}
if (requires != null && !requires.isEmpty()) {
for (APKModule pkg : requires) {
writer.write(String.format(".requires %s", pkg.getName()));
writer.newLine();
}
}
for (int i = 0; i < jarFiles.size(); i++) {
String filename = dexStore.fileNameForSecondary(i);
if (!isSecondaryDexStore) {
filename = dexStore.fileNameForSecondary(id, i);
}
String jarHash = hexSha1(jarFiles.get(i));
String containedClass = findAnyClass(jarFiles.get(i));
Objects.requireNonNull(containedClass);
writer.write(String.format("%s %s %s", filename, jarHash, containedClass));
writer.newLine();
}
}
private static String findAnyClass(Path jarFile) throws IOException {
String className = findAnyClass(CANARY_CLASS_FILE_PATTERN, jarFile);
if (className == null) {
className = findAnyClass(CLASS_FILE_PATTERN, jarFile);
}
if (className != null) {
return className;
}
// TODO(dreiss): It's possible for this to happen by chance, so we should handle it better.
throw new IllegalStateException("Couldn't find any class in " + jarFile.toAbsolutePath());
}
@Nullable
private static String findAnyClass(Pattern pattern, Path jarFile) throws IOException {
try (ZipFile inZip = new ZipFile(jarFile.toFile())) {
for (ZipEntry entry : Collections.list(inZip.entries())) {
Matcher m = pattern.matcher(entry.getName());
if (m.matches()) {
return m.group(1).replace('/', '.');
}
}
}
return null;
}
private static String hexSha1(Path file) throws IOException {
Preconditions.checkState(file.isAbsolute());
return MorePaths.asByteSource(file).hash(Hashing.sha1()).toString();
}
@Override
public String getShortName() {
return "split_zip";
}
@Override
public String getDescription(ExecutionContext context) {
return Joiner.on(' ')
.join(
"split-zip",
Joiner.on(':').join(inputPathsToSplit),
secondaryJarMetaPath,
primaryJarPath,
secondaryJarDir,
secondaryJarPattern);
}
public Supplier<Multimap<Path, Path>> getOutputToInputsMapSupplier(
Path secondaryOutputDir, Path additionalOutputDir) {
return () -> {
Preconditions.checkState(
outputFiles != null,
"SplitZipStep must complete successfully before listing its outputs.");
ImmutableMultimap.Builder<Path, Path> builder = ImmutableMultimap.builder();
for (APKModule dexStore : outputFiles.keySet()) {
Path storeRoot;
if (dexStore.getName().equals(SECONDARY_DEX_ID)) {
storeRoot = secondaryOutputDir;
} else {
storeRoot = additionalOutputDir.resolve(dexStore.getName());
}
ImmutableList<Path> outputList = outputFiles.get(dexStore).asList();
for (int i = 0; i < outputList.size(); i++) {
String dexName;
if (dexStore.getName().equals(SECONDARY_DEX_ID)) {
dexName = dexSplitMode.getDexStore().fileNameForSecondary(i);
} else {
dexName = dexSplitMode.getDexStore().fileNameForSecondary(dexStore.getName(), i);
}
Path outputDexPath = storeRoot.resolve(dexName);
builder.put(outputDexPath, outputList.get(i));
}
}
return builder.build();
};
}
// Predicate that rejects blank lines and lines starting with '#'.
private static boolean isNeitherEmptyNorComment(String line) {
return !line.isEmpty() && !(line.charAt(0) == '#');
}
}
| brettwooldridge/buck | src/com/facebook/buck/android/SplitZipStep.java | Java | apache-2.0 | 20,539 |
package pl.zankowski.iextrading4j.api.stocks;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
class ChartRangeTest {
@Test
void shouldThrowAnExceptionForUnknownCode() {
final String code = "12m";
assertThrows(IllegalArgumentException.class, () -> ChartRange.getValueFromCode(code));
}
@Test
void shouldCreateEnumFromCode() {
final String code = "6m";
final ChartRange chartRange = ChartRange.getValueFromCode(code);
assertThat(chartRange).isEqualTo(ChartRange.SIX_MONTHS);
}
}
| WojciechZankowski/iextrading4j | iextrading4j-api/src/test/java/pl/zankowski/iextrading4j/api/stocks/ChartRangeTest.java | Java | apache-2.0 | 657 |
<!DOCTYPE html>
<html class="theme-next pisces use-motion" lang="en">
<head>
<!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="生活," />
<meta name="description" content="Reproduce from zhihu(Sorry I forget the username of original article) 想象一下其实你已经80岁了,碌碌无为的一生即将结束,你躺在床上望着天花板,想着如果我现在25岁就好了。 然后,你的愿望实现了,之后的记忆全都消失,但你真的回到了25岁。 如果现在的人生是你的第二人生,你还愿意像现在这样度过吗? 25岁的人,最应该知道的是,现">
<meta name="keywords" content="生活">
<meta property="og:type" content="article">
<meta property="og:title" content="What should I do at 25">
<meta property="og:url" content="http://yoursite.com/2018/01/13/What-should-I-do-at-25/index.html">
<meta property="og:site_name" content="Angus' MineCraft">
<meta property="og:description" content="Reproduce from zhihu(Sorry I forget the username of original article) 想象一下其实你已经80岁了,碌碌无为的一生即将结束,你躺在床上望着天花板,想着如果我现在25岁就好了。 然后,你的愿望实现了,之后的记忆全都消失,但你真的回到了25岁。 如果现在的人生是你的第二人生,你还愿意像现在这样度过吗? 25岁的人,最应该知道的是,现">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2018-01-13T23:46:31.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="What should I do at 25">
<meta name="twitter:description" content="Reproduce from zhihu(Sorry I forget the username of original article) 想象一下其实你已经80岁了,碌碌无为的一生即将结束,你躺在床上望着天花板,想着如果我现在25岁就好了。 然后,你的愿望实现了,之后的记忆全都消失,但你真的回到了25岁。 如果现在的人生是你的第二人生,你还愿意像现在这样度过吗? 25岁的人,最应该知道的是,现">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Pisces',
version: '5.1.4',
sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: 'Author'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://yoursite.com/2018/01/13/What-should-I-do-at-25/"/>
<title>What should I do at 25 | Angus' MineCraft</title><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="en">
<!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left page-post-detail">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Angus' MineCraft</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
Home
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
Archives
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<div id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/01/13/What-should-I-do-at-25/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Angus">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Angus' MineCraft">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">What should I do at 25</h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2018-01-13T15:45:04+08:00">
2018-01-13
</time>
</span>
<span class="post-meta-divider">|</span>
<span class="page-pv"><i class="fa fa-file-o"></i>
<span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>Reproduce from zhihu(Sorry I forget the username of original article)</p>
<p>想象一下其实你已经80岁了,碌碌无为的一生即将结束,你躺在床上望着天花板,想着如果我现在25岁就好了。</p>
<p>然后,你的愿望实现了,之后的记忆全都消失,但你真的回到了25岁。</p>
<p><strong>如果现在的人生是你的第二人生,你还愿意像现在这样度过吗?</strong></p>
<ol>
<li>25岁的人,最应该知道的是,现在每一个看似不经意的选择,都会影响你的发展。为了让自己轻松一点而逃避掉的烦恼,之后会加倍来让你痛苦。</li>
<li>25岁,看似健康的身体不过是年轻的附属品,只有现在开始锻炼运动,注意饮食,30岁的时候才能依然有健康的身体,保持充沛的精力。</li>
<li>25岁了,就不要把时间浪费在无谓的社交上,等到5年后,你就会发现很多当初如胶似漆的朋友不过是过客,真正留下来的还是那么几个。</li>
<li>25岁开始找一个目标,并为之奋斗,等到5年后,你就能成为行业内的专家,获得一定的成就和地位。在当下,专注和耐心已经成为最稀缺的东西。</li>
<li>25岁也要开始关注自己的外貌,长出的皱纹不会消失,脱掉的发不会长出来,现在开始护肤护理,不要嫌麻烦,5年后你会感激现在的自己。</li>
<li>25岁,是时候好好谈一场恋爱了,趁着还有爱的能力的时候,找一个值得爱的人,做一个耐心的好人,享受幸福的时光,无论最后会不会在一起。</li>
</ol>
<p><strong>25岁的时候,你不一定要去四处旅游,女生无需囤积200支口红,男生无需买一箱子的酒精,别装酷,别被自媒体洗脑,认真生活不是一件丢人的事情。</strong></p>
</div>
<footer class="post-footer">
<div class="post-tags">
<a href="/tags/生活/" rel="tag"># 生活</a>
</div>
<div class="post-nav">
<div class="post-nav-next post-nav-item">
<a href="/2018/01/03/TopCoder-Sorting/" rel="next" title="TopCoder-Sorting">
<i class="fa fa-chevron-left"></i> TopCoder-Sorting
</a>
</div>
<span class="post-nav-divider"></span>
<div class="post-nav-prev post-nav-item">
<a href="/2018/01/26/Reading-Notes-Multimedia-Systems-—-Algorithms-Standards-and-Industry-Practices-Chapter-1-Introducation-to-Multimedia/" rel="prev" title="[Reading Notes] Multimedia Systems — Algorithms, Standards and Industry Practices, Chapter 1 Introducation to Multimedia">
[Reading Notes] Multimedia Systems — Algorithms, Standards and Industry Practices, Chapter 1 Introducation to Multimedia <i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
</footer>
</div>
</article>
<div class="post-spread">
</div>
</div>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview-wrap sidebar-panel sidebar-panel-active">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">Angus</p>
<p class="site-description motion-element" itemprop="description">只要思想不滑坡,办法总比困难多</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">21</span>
<span class="site-state-item-name">posts</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/index.html">
<span class="site-state-item-count">2</span>
<span class="site-state-item-name">categories</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/index.html">
<span class="site-state-item-count">24</span>
<span class="site-state-item-name">tags</span>
</a>
</div>
</nav>
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">© <span itemprop="copyrightYear">2019</span>
<span class="with-love">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">Angus</span>
</div>
<div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>
<span class="post-meta-divider">|</span>
<div class="theme-info">Theme — <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>
<div class="busuanzi-count">
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span class="site-uv">
<i class="fa fa-user"></i>
<span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
</span>
<span class="site-pv">
<i class="fa fa-eye"></i>
<span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
</span>
</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</body>
</html>
| XingwenZhang/XingwenZhang.github.io | 2018/01/13/What-should-I-do-at-25/index.html | HTML | apache-2.0 | 15,974 |
/**
* Copyright (C) 2015 Orange
* 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.
*/
div.wicket-mask-dark {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
opacity: 0.5;
background-color: #000;
filter: alpha(opacity=50);
background-image: url('transparent2.png');
}
div.wicket-mask-transparent {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-image: url('transparent1.gif');
}
div.wicket-modal {
position: fixed;
_position: absolute;
z-index: 20001;
visibility: hidden;
overflow:auto;
background:#eef;
padding:10px;
border: .084em solid #A3A3A3 !important;
box-shadow:1px 1px 10px #000;
border-radius: 5px;
}
div.wicket-modal div.w_top_1 {
width: 100%;
overflow: hidden;
}
div.wicket-modal div.w_top {
height: 0px;
background-position: 0px -16px;
overflow: hidden;
cursor:n-resize;
padding: 0px; margin: 0px;
}
div.wicket-modal .w_topLeft {
/*
position: absolute;
top: 0px;
left: 0px;
*/
width: 14px;
height: 0px;
float: left;
background-position: 0px 0px;
overflow: hidden;
cursor: nw-resize;
}
div.wicket-modal div.w_topRight {
/*
position: absolute;
top: 0px;
right: 0px;
*/
width: 14px;
height: 0px;
float: right;
background-position: -16px 0px;
overflow: hidden;
cursor: ne-resize;
}
div.wicket-modal div.w_left {
background-position: 0px 0px;
background-repeat: repeat-y;
cursor: w-resize;
width: 100%;
}
div.wicket-modal div.w_right_1 {
margin-left:10px;
}
div.wicket-modal div.w_right {
background-position: right;
background-repeat: repeat-y;
cursor:e-resize;
width: 100%;
}
div.wicket-modal div.w_content_1 {
margin-right: 10px;
cursor: auto;
}
div.wicket-modal div.w_caption {
height: 2.1em;
overflow: hidden;
cursor: default;
position: relative;
background-color: white;
cursor: default;
line-height: 1.4em;
color: #666;
}
div.wicket-modal a.w_close {
height: 27px;
width: 27px;
overflow: hidden;
/* background-position: -64px 0px; */
/*background-position: 0px 0px;*/
position: absolute;
right: 3px;
padding: 0px;
margin: 0px;
background-position: 0px 0px;
background-image: url('popin_close_btn.gif');
background-repeat: no-repeat;
}
div.wicket-modal a.w_close:hover {
float: right;
height: 27px;
width: 27px;
overflow: hidden;
background-position: 0px 0px;
background-image: url('popin_close_btn.gif');
background-repeat: no-repeat;
}
div.wicket-modal span.w_captionText {
/*
height: 1.4em;
position: absolute;
margin-left: 3px;
font-weight: bold;
left: 0em;
*/
color:#444;
font:normal 1em/1.2 Arial, Helvetica, sans-serif;
text-transform:lowercase;
margin:0 0 10px 0;
font-size:1.83em;
}
div.wicket-modal div.w_content_container {
position: relative;
}
div.wicket-modal div.w_content_2 {
width: 100%;
background-color: white;
padding-top: 0.1em;
_overflow: auto;
}
div.wicket-modal div.w_content_3 {
border: 0px solid #bbb;
padding: 0px;
}
div.wicket-modal div.w_content {
width: 100%;
background-color: white;
}
div.wicket-modal iframe {
width: 100%;
height: 400px;
padding: 0px;
margin: 0px;
border-width: 0px;
position: relative;
}
div.wicket-modal div.w_bottom_1 {
width: 100%;
overflow: hidden;
/*cursor: n-resize; */
}
div.wicket-modal div.w_bottom {
height: 0px;
background-position: 0px -32px;
overflow:hidden;
}
div.wicket-modal div.w_bottomRight {
/*
position: absolute;
bottom: 0px;
right: 0px;
*/
width: 14px;
height: 0px;
float: right;
background-position: -48px 0px;
/*cursor: nw-resize; */
overflow: hidden;
}
div.wicket-modal div.w_bottomLeft {
/*
position: absolute;
bottom: 0px;
left: 0px;
*/
width: 14px;
height: 0px;
float: left;
background-position: -32px 0px;
overflow: hidden;
/*cursor: ne-resize;*/
}
div.wicket-modal div.w_orange div.w_left,
div.wicket-modal div.w_orange div.w_right {
background-image: none;
_background-image: none;
}
div.wicket-modal div.w_orange div.w_top,
div.wicket-modal div.w_orange div.w_bottom,
div.wicket-modal div.w_orange div.w_topLeft,
div.wicket-modal div.w_orange div.w_topRight,
div.wicket-modal div.w_orange div.w_bottomRight,
div.wicket-modal div.w_orange div.w_bottomLeft {
background-image: none;
}
div.wicket-modal div.w_orange a.w_close {
background-image: url('popin_close_btn.gif');
}
div.wicket-modal div.w_blue div.w_left,
div.wicket-modal div.w_blue div.w_right {
background-image: url('frame-blue-2-alpha.png');
_background-image: url('frame-blue-2-ie.png');
}
div.wicket-modal div.w_blue div.w_top,
div.wicket-modal div.w_blue div.w_bottom,
div.wicket-modal div.w_blue div.w_topLeft,
div.wicket-modal div.w_blue div.w_topRight,
div.wicket-modal div.w_blue div.w_bottomRight,
div.wicket-modal div.w_blue div.w_bottomLeft,
div.wicket-modal div.w_blue a.w_close {
background-image: url('frame-blue-1-alpha.png');
}
div.wicket-modal div.w_silver div.w_left,
div.wicket-modal div.w_silver div.w_right {
background-image: url('frame-gray-2-alpha.png');
_background-image: url('frame-gray-2-ie.png');
}
div.wicket-modal div.w_silver div.w_top,
div.wicket-modal div.w_silver div.w_bottom,
div.wicket-modal div.w_silver div.w_topLeft,
div.wicket-modal div.w_silver div.w_topRight,
div.wicket-modal div.w_silver div.w_bottomRight,
div.wicket-modal div.w_silver div.w_bottomLeft,
div.wicket-modal div.w_silver a.w_close {
background-image: url('frame-gray-1-alpha.png');
_background-image: url('frame-gray-1-ie.png');
}
| Orange-OpenSource/elpaaso-core | cloud-paas/cloud-paas-webapp/cloud-paas-webapp-war/src/main/webapp/styles/modal/pop-in.css | CSS | apache-2.0 | 6,035 |
package org.cache2k.benchmark.util;
/*
* #%L
* Benchmarks: utilities
* %%
* Copyright (C) 2013 - 2021 headissue GmbH, Munich
* %%
* 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.
* #L%
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.nio.charset.Charset;
/**
* Read in an access log trace from integer values.
*
* @author Jens Wilke; created: 2013-11-19
*/
public class IntegerTraceReader extends AccessPattern {
LineNumberReader reader;
int value;
/**
* Read in, default charset.
*/
public IntegerTraceReader(InputStream in, Charset cs) {
reader = new LineNumberReader(new InputStreamReader(in, cs));
}
@Override
public boolean isEternal() {
return false;
}
@Override
public boolean hasNext() {
try {
String s;
do {
s = reader.readLine();
if (s == null) {
return false;
}
} while (s.startsWith("#") || s.trim().length() == 0);
try {
value = Integer.parseInt(s);
} catch (NumberFormatException e) {
System.err.println("parse error line " + reader.getLineNumber() + ": " + s);
return hasNext();
}
return true;
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
@Override
public int next() {
return value;
}
@Override
public void close() {
try {
reader.close();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
| cache2k/cache2k-benchmark | util/src/main/java/org/cache2k/benchmark/util/IntegerTraceReader.java | Java | apache-2.0 | 2,050 |
// Copyright 2014 Will Fitzgerald. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file tests bit sets
package sparsebitset
import (
"math"
"math/rand"
"testing"
)
func TestEmptyBitSet(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Error("A zero-length bitset should be fine")
}
}()
b := New(0)
if b.Len() != 0 {
t.Errorf("Empty set should have capacity 0, not %d", b.Len())
}
}
func TestZeroValueBitSet(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Error("A zero-length bitset should be fine")
}
}()
var b BitSet
if b.Len() != 0 {
t.Errorf("Empty set should have capacity 0, not %d", b.Len())
}
}
func TestBitSetNew(t *testing.T) {
v := New(16)
if v.Test(0) != false {
t.Errorf("Unable to make a bit set and read its 0th value.")
}
}
func TestBitSetHuge(t *testing.T) {
v := New(uint64(math.MaxUint32))
if v.Test(0) != false {
t.Errorf("Unable to make a huge bit set and read its 0th value.")
}
}
// func TestLen(t *testing.T) {
// v := New(1000)
// if v.Len() != 1000 {
// t.Errorf("Len should be 1000, but is %d.", v.Len())
// }
// }
func TestBitSetIsClear(t *testing.T) {
v := New(1000)
for i := uint64(0); i < 1000; i++ {
if v.Test(i) != false {
t.Errorf("Bit %d is set, and it shouldn't be.", i)
}
}
}
func TestExendOnBoundary(t *testing.T) {
v := New(32)
defer func() {
if r := recover(); r != nil {
t.Error("Border out of index error should not have caused a panic")
}
}()
v.Set(32)
}
func TestExpand(t *testing.T) {
v := New(0)
defer func() {
if r := recover(); r != nil {
t.Error("Expansion should not have caused a panic")
}
}()
for i := uint64(0); i < 1000; i++ {
v.Set(i)
}
}
func TestBitSetAndGet(t *testing.T) {
v := New(1000)
v.Set(100)
if v.Test(100) != true {
t.Errorf("Bit %d is clear, and it shouldn't be.", 100)
}
}
func TestIterate(t *testing.T) {
v := New(10000)
v.Set(0)
v.Set(1)
v.Set(2)
data := make([]uint64, 3)
c := 0
for i, e := v.NextSet(0); e; i, e = v.NextSet(i + 1) {
data[c] = i
c++
}
if data[0] != 0 {
t.Errorf("bug 0")
}
if data[1] != 1 {
t.Errorf("bug 1")
}
if data[2] != 2 {
t.Errorf("bug 2")
}
v.Set(10)
v.Set(2000)
data = make([]uint64, 5)
c = 0
for i, e := v.NextSet(0); e; i, e = v.NextSet(i + 1) {
data[c] = i
c++
}
if data[0] != 0 {
t.Errorf("bug 0")
}
if data[1] != 1 {
t.Errorf("bug 1")
}
if data[2] != 2 {
t.Errorf("bug 2")
}
if data[3] != 10 {
t.Errorf("bug 3")
}
if data[4] != 2000 {
t.Errorf("bug 4")
}
}
func TestSetTo(t *testing.T) {
v := New(1000)
v.SetTo(100, true)
if v.Test(100) != true {
t.Errorf("Bit %d is clear, and it shouldn't be.", 100)
}
v.SetTo(100, false)
if v.Test(100) != false {
t.Errorf("Bit %d is set, and it shouldn't be.", 100)
}
}
func TestChain(t *testing.T) {
if New(1000).Set(100).Set(99).Clear(99).Test(100) != true {
t.Errorf("Bit %d is clear, and it shouldn't be.", 100)
}
}
func TestOutOfBoundsLong(t *testing.T) {
v := New(64)
defer func() {
if r := recover(); r != nil {
t.Error("Long distance out of index error should not have caused a panic")
}
}()
v.Set(1000)
}
func TestOutOfBoundsClose(t *testing.T) {
v := New(65)
defer func() {
if r := recover(); r != nil {
t.Error("Local out of index error should not have caused a panic")
}
}()
v.Set(66)
}
func TestCount(t *testing.T) {
tot := uint64(64*4 + 11) // just some multi unit64 number
v := New(tot)
checkLast := true
for i := uint64(0); i < tot; i++ {
sz := uint64(v.Count())
if sz != i {
t.Errorf("Count reported as %d, but it should be %d", sz, i)
checkLast = false
break
}
v.Set(i)
}
if checkLast {
sz := uint64(v.Count())
if sz != tot {
t.Errorf("After all bits set, size reported as %d, but it should be %d", sz, tot)
}
}
}
// test setting every 3rd bit, just in case something odd is happening
func TestCount2(t *testing.T) {
tot := uint64(64*4 + 11) // just some multi unit64 number
v := New(tot)
for i := uint64(0); i < tot; i += 3 {
sz := uint64(v.Count())
if sz != i/3 {
t.Errorf("Count reported as %d, but it should be %d", sz, i)
break
}
v.Set(i)
}
}
// nil tests
func TestNullTest(t *testing.T) {
var v *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Checking bit of null reference should have caused a panic")
}
}()
v.Test(66)
}
func TestNullSet(t *testing.T) {
var v *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Setting bit of null reference should have caused a panic")
}
}()
v.Set(66)
}
func TestNullClear(t *testing.T) {
var v *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Clearning bit of null reference should have caused a panic")
}
}()
v.Clear(66)
}
func TestPanicDifferenceBNil(t *testing.T) {
var b *BitSet
var compare = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil First should should have caused a panic")
}
}()
b.Difference(compare)
}
func TestPanicDifferenceCompareNil(t *testing.T) {
var compare *BitSet
var b = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil Second should should have caused a panic")
}
}()
if b.Difference(compare) == nil {
panic("empty bitset given")
}
}
func TestPanicUnionBNil(t *testing.T) {
var b *BitSet
var compare = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil First should should have caused a panic")
}
}()
b.Union(compare)
}
func TestPanicUnionCompareNil(t *testing.T) {
var compare *BitSet
var b = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil Second should should have caused a panic")
}
}()
if b.Union(compare) == nil {
panic("empty bitset given")
}
}
func TestPanicIntersectionBNil(t *testing.T) {
var b *BitSet
var compare = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil First should should have caused a panic")
}
}()
b.Intersection(compare)
}
func TestPanicIntersectionCompareNil(t *testing.T) {
var compare *BitSet
var b = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil Second should should have caused a panic")
}
}()
if b.Intersection(compare) == nil {
panic("empty bitset given")
}
}
func TestPanicSymmetricDifferenceBNil(t *testing.T) {
var b *BitSet
var compare = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil First should should have caused a panic")
}
}()
b.SymmetricDifference(compare)
}
func TestPanicSymmetricDifferenceCompareNil(t *testing.T) {
var compare *BitSet
var b = New(10)
defer func() {
if r := recover(); r == nil {
t.Error("Nil Second should should have caused a panic")
}
}()
if b.SymmetricDifference(compare) == nil {
panic("empty bitset given")
}
}
func TestPanicComplementBNil(t *testing.T) {
var b *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Nil should should have caused a panic")
}
}()
b.Complement()
}
func TestPanicAnytBNil(t *testing.T) {
var b *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Nil should should have caused a panic")
}
}()
b.Any()
}
func TestPanicNonetBNil(t *testing.T) {
var b *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Nil should should have caused a panic")
}
}()
b.None()
}
func TestPanicAlltBNil(t *testing.T) {
var b *BitSet
defer func() {
if r := recover(); r == nil {
t.Error("Nil should should have caused a panic")
}
}()
b.All()
}
func TestEqual(t *testing.T) {
a := New(100)
// b := New(99)
c := New(100)
// if a.Equal(b) {
// t.Error("Sets of different sizes should be not be equal")
// }
// if !a.Equal(c) {
// t.Error("Two empty sets of the same size should be equal")
// }
a.Set(99)
c.Set(0)
if a.Equal(c) {
t.Error("Two sets with differences should not be equal")
}
c.Set(99)
a.Set(0)
if !a.Equal(c) {
t.Error("Two sets with the same bits set should be equal")
}
}
func TestUnion(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i)
b.Set(i - 1)
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
na, _ := a.UnionCardinality(b)
if na != 200 {
t.Errorf("Union should have 200 bits set, but had %d", na)
}
nb, _ := b.UnionCardinality(a)
if na != nb {
t.Errorf("Union should be symmetric")
}
c := a.Union(b)
d := b.Union(a)
if c.Count() != 200 {
t.Errorf("Union should have 200 bits set, but had %d", c.Count())
}
if !c.Equal(d) {
t.Errorf("Union should be symmetric")
}
}
func TestInPlaceUnion(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i)
b.Set(i - 1)
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
c := a.Clone()
c.InPlaceUnion(b)
d := b.Clone()
d.InPlaceUnion(a)
if c.Count() != 200 {
t.Errorf("Union should have 200 bits set, but had %d", c.Count())
}
if d.Count() != 200 {
t.Errorf("Union should have 200 bits set, but had %d", d.Count())
}
if !c.Equal(d) {
t.Errorf("Union should be symmetric")
}
}
func TestIntersection(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i)
b.Set(i - 1).Set(i)
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
na, _ := a.IntersectionCardinality(b)
if na != 50 {
t.Errorf("Intersection should have 50 bits set, but had %d", na)
}
nb, _ := b.IntersectionCardinality(a)
if na != nb {
t.Errorf("Intersection should be symmetric")
}
c := a.Intersection(b)
d := b.Intersection(a)
if c.Count() != 50 {
t.Errorf("Intersection should have 50 bits set, but had %d", c.Count())
}
if !c.Equal(d) {
t.Errorf("Intersection should be symmetric")
}
}
func TestInplaceIntersection(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i)
b.Set(i - 1).Set(i)
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
c := a.Clone()
c.InPlaceIntersection(b)
d := b.Clone()
d.InPlaceIntersection(a)
e := New(100)
for i := uint64(76); i < 100; i++ {
e.Set(i)
}
f := a.Clone()
f.InPlaceIntersection(e)
if c.Count() != 50 {
t.Errorf("Intersection should have 50 bits set, but had %d", c.Count())
}
if d.Count() != 50 {
t.Errorf("Intersection should have 50 bits set, but had %d", d.Count())
}
if !c.Equal(d) {
t.Errorf("Intersection should be symmetric")
}
if f.Count() != 12 {
t.Errorf("Intersection should have 12 bits set, but had %d", f.Count())
}
}
func TestDifference(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i)
b.Set(i - 1)
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
na, _ := a.DifferenceCardinality(b)
if na != 50 {
t.Errorf("a-b Difference should have 50 bits set, but had %d", na)
}
nb, _ := b.DifferenceCardinality(a)
if nb != 150 {
t.Errorf("b-a Difference should have 150 bits set, but had %d", nb)
}
c := a.Difference(b)
d := b.Difference(a)
if c.Count() != 50 {
t.Errorf("a-b Difference should have 50 bits set, but had %d", c.Count())
}
if d.Count() != 150 {
t.Errorf("b-a Difference should have 150 bits set, but had %d", d.Count())
}
if c.Equal(d) {
t.Errorf("Difference, here, should not be symmetric")
}
}
func TestInPlaceDifference(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i)
b.Set(i - 1)
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
c := a.Clone()
c.InPlaceDifference(b)
d := b.Clone()
d.InPlaceDifference(a)
e := a.Clone()
for i := uint64(0); i < 100; i += 2 {
e.Set(i)
}
e.InPlaceDifference(b)
if c.Count() != 50 {
t.Errorf("a-b Difference should have 50 bits set, but had %d", c.Count())
}
if d.Count() != 150 {
t.Errorf("b-a Difference should have 150 bits set, but had %d", d.Count())
}
if c.Equal(d) {
t.Errorf("Difference, here, should not be symmetric")
}
if e.Count() != 50 {
t.Errorf("e-b Difference should have 50 bits set, but had %d", e.Count())
}
}
func TestSymmetricDifference(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i) // 01010101010 ... 0000000
b.Set(i - 1).Set(i) // 11111111111111111000000
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
na, _ := a.SymmetricDifferenceCardinality(b)
if na != 150 {
t.Errorf("a^b Difference should have 150 bits set, but had %d", na)
}
nb, _ := b.SymmetricDifferenceCardinality(a)
if nb != 150 {
t.Errorf("b^a Difference should have 150 bits set, but had %d", nb)
}
c := a.SymmetricDifference(b)
d := b.SymmetricDifference(a)
if c.Count() != 150 {
t.Errorf("a^b Difference should have 150 bits set, but had %d", c.Count())
}
if d.Count() != 150 {
t.Errorf("b^a Difference should have 150 bits set, but had %d", d.Count())
}
if !c.Equal(d) {
t.Errorf("SymmetricDifference should be symmetric")
}
}
func TestInPlaceSymmetricDifference(t *testing.T) {
a := New(100)
b := New(200)
for i := uint64(1); i < 100; i += 2 {
a.Set(i) // 01010101010 ... 0000000
b.Set(i - 1).Set(i) // 11111111111111111000000
}
for i := uint64(100); i < 200; i++ {
b.Set(i)
}
c := a.Clone()
c.InPlaceSymmetricDifference(b)
d := b.Clone()
d.InPlaceSymmetricDifference(a)
if c.Count() != 150 {
t.Errorf("a^b Difference should have 150 bits set, but had %d", c.Count())
}
if d.Count() != 150 {
t.Errorf("b^a Difference should have 150 bits set, but had %d", d.Count())
}
if !c.Equal(d) {
t.Errorf("SymmetricDifference should be symmetric")
}
}
func TestIsSuperSet(t *testing.T) {
a := New(500)
b := New(300)
c := New(200)
// Setup bitsets
// a and b overlap
// only c is (strict) super set
for i := uint64(0); i < 100; i++ {
a.Set(i)
}
for i := uint64(50); i < 150; i++ {
b.Set(i)
}
for i := uint64(0); i < 200; i++ {
c.Set(i)
}
if a.IsSuperSet(b) == true {
t.Errorf("IsSuperSet fails")
}
if a.IsSuperSet(c) == true {
t.Errorf("IsSuperSet fails")
}
if b.IsSuperSet(a) == true {
t.Errorf("IsSuperSet fails")
}
if b.IsSuperSet(c) == true {
t.Errorf("IsSuperSet fails")
}
if c.IsSuperSet(a) != true {
t.Errorf("IsSuperSet fails")
}
if c.IsSuperSet(b) != true {
t.Errorf("IsSuperSet fails")
}
if a.IsStrictSuperSet(b) == true {
t.Errorf("IsStrictSuperSet fails")
}
if a.IsStrictSuperSet(c) == true {
t.Errorf("IsStrictSuperSet fails")
}
if b.IsStrictSuperSet(a) == true {
t.Errorf("IsStrictSuperSet fails")
}
if b.IsStrictSuperSet(c) == true {
t.Errorf("IsStrictSuperSet fails")
}
if c.IsStrictSuperSet(a) != true {
t.Errorf("IsStrictSuperSet fails")
}
if c.IsStrictSuperSet(b) != true {
t.Errorf("IsStrictSuperSet fails")
}
}
// BENCHMARKS
func BenchmarkSet(b *testing.B) {
b.StopTimer()
r := rand.New(rand.NewSource(0))
sz := 100000
s := New(uint64(sz))
b.StartTimer()
for i := 0; i < b.N; i++ {
s.Set(uint64(r.Int31n(int32(sz))))
}
}
func BenchmarkGetTest(b *testing.B) {
b.StopTimer()
r := rand.New(rand.NewSource(0))
sz := 100000
s := New(uint64(sz))
b.StartTimer()
for i := 0; i < b.N; i++ {
s.Test(uint64(r.Int31n(int32(sz))))
}
}
func BenchmarkSetExpand(b *testing.B) {
b.StopTimer()
sz := uint64(100000)
b.StartTimer()
for i := 0; i < b.N; i++ {
var s BitSet
s.Set(sz)
}
}
// go test -bench=Count
func BenchmarkCount(b *testing.B) {
b.StopTimer()
s := New(100000)
for i := 0; i < 100000; i += 100 {
s.Set(uint64(i))
}
b.StartTimer()
for i := 0; i < b.N; i++ {
s.Count()
}
}
// go test -bench=Iterate
func BenchmarkIterate(b *testing.B) {
b.StopTimer()
s := New(10000)
for i := 0; i < 10000; i += 3 {
s.Set(uint64(i))
}
b.StartTimer()
for j := 0; j < b.N; j++ {
c := uint(0)
for i, e := s.NextSet(0); e; i, e = s.NextSet(i + 1) {
c++
}
}
}
// go test -bench=SparseIterate
func BenchmarkSparseIterate(b *testing.B) {
b.StopTimer()
s := New(100000)
for i := 0; i < 100000; i += 30 {
s.Set(uint64(i))
}
b.StartTimer()
for j := 0; j < b.N; j++ {
c := uint(0)
for i, e := s.NextSet(0); e; i, e = s.NextSet(i + 1) {
c++
}
}
}
| postfix/sparsebitset | bitset_test.go | GO | apache-2.0 | 16,137 |
##### ep-tapd
##### Version 1. 0. 4
1 增加外部测试接口
##### Version 1. 0. 3
1 回调改为postform
##### Version 1. 0. 2
1 修改url
##### Version 1. 0. 1
1 回调接分发包一层data
2 支持按workspaceid选项分发
##### Version 1. 0. 0
1 回调接口分发
| LQJJ/demo | 126-go-common-master/app/admin/ep/tapd/CHANGELOG.md | Markdown | apache-2.0 | 278 |
import resume.models as rmod
import random
import logging
from django.http import HttpResponse
from datetime import date
logger = logging.getLogger('default')
def generate(request):
cs_objs = rmod.Department.objects.filter(shortname='cs')
if len(cs_objs) == 0:
logger.info('created cs dept')
cs = rmod.Department(name='Computer Science', shortname='cs', lastChange=0,\
headerImage='', logoImage='', resumeImage='', headerBgImage='',\
brandColor='blue', contactName='Donald Knuth', contactEmail='test@example.com',\
techEmail='tech@example.com')
cs.save()
else:
logger.info('used pre-existing cs dept')
cs = cs_objs[0]
ct_objs = rmod.ComponentType.objects.filter(short='ta')
if len(ct_objs) == 0:
logger.info('created component type')
ct = rmod.ComponentType(type='contactlong', name='type a', short='ta', department=cs)
ct.save()
else:
logger.info('used existing component type')
ct = ct_objs[0]
ct_objs = rmod.ComponentType.objects.filter(short='stmt')
if len(ct_objs) == 0:
logger.info('created component type')
ct = rmod.ComponentType(type='statement', name='Research Statement', short='stmt', department=cs)
ct.save()
else:
logger.info('used existing component type')
ct = ct_objs[0]
auth_objs = rmod.AuthInfo.objects.all()
if len(auth_objs) == 0:
return HttpResponse("No auth_info objects to use")
auth = auth_objs[0]
pos_objs = rmod.ApplicantPosition.objects.filter(name='pos1')
if len(pos_objs) == 0:
logger.info('created app position')
pos = rmod.ApplicantPosition(department=cs, name='pos1', shortform='p1',\
autoemail=False)
pos.save()
else:
logger.info('used existing app position')
pos = pos_objs[0]
a_objs = rmod.Applicant.objects.filter(auth=auth)
if len(a_objs) == 0:
logger.error('ERROR: created applicant')
a = rmod.Applicant(auth=auth, firstname='john', lastname='doe', country='usa',\
department=cs, position=pos)
a.save()
else:
logger.info('used existing applicant')
a = a_objs[0]
c_objs = rmod.Component.objects.filter(applicant=a)
if len(c_objs) == 0:
logger.info('created component')
c = rmod.Component(applicant=a, type=ct, value='component 1', lastSubmitted=0,\
department=cs)
c.save()
else:
logger.info('used existing component')
c = c_objs[0]
reviewer_objs = rmod.Reviewer.objects.filter(auth=auth)
if len(reviewer_objs) == 0:
logger.info('created reviewer')
reviewer = rmod.Reviewer(auth=auth, department=cs)
reviewer.save()
else:
logger.info('used existing reviewer')
reviewer = reviewer_objs[0]
review_objs = rmod.Review.objects.filter(applicant=a)
if len(review_objs) == 0:
logger.info('created review')
review = rmod.Review(applicant=a, reviewer=reviewer, advocate='advocate',\
comments='this shit sucks', draft=False, department=cs)
review.save()
else:
logger.info('used existing review')
review = review_objs[0]
area_objs = rmod.Area.objects.filter(department=cs)
if len(area_objs) < 2:
a = rmod.Area(name='area two', abbr='a2', department=cs)
a.save()
a = rmod.Area(name='area one', abbr='a1', department=cs)
a.save()
score_cats = rmod.ScoreCategory.objects.filter(department=cs)
if len(score_cats) == 0:
sc = rmod.ScoreCategory(name='Awesomeness Level', shortform='AL', department=cs)
sc.save()
else:
sc = score_cats[0]
score_vals = rmod.ScoreValue.objects.filter(department=cs)
if len(score_vals) == 0:
for i in range(5):
sv = rmod.ScoreValue(category=sc, number=i, explanation='%d level of awesome' % i,\
department=cs)
sv.save()
return HttpResponse('OK')
| brownplt/k3 | dj-resume/resume/generate.py | Python | apache-2.0 | 3,738 |
Docker build command:
docker build -t xarray .
Docker run command:
docker run -it xarray
| ppc64le/build-scripts | x/xarray/Dockerfiles/latest_ubuntu_18.04/README.md | Markdown | apache-2.0 | 90 |
# Monix
<img src="https://monix.io/public/images/monix-logo.png?ts=20161024" align="right" width="280" />
Asynchronous, Reactive Programming for Scala and [Scala.js](http://www.scala-js.org/).
[](https://travis-ci.org/monix/monix)
[](https://codecov.io/gh/monix/monix?branch=master)
[](http://search.maven.org/#search|gav|1|g%3A%22io.monix%22%20AND%20a%3A%22monix_2.12%22)
[](https://gitter.im/monix/monix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Overview
Monix is a high-performance Scala / Scala.js library for composing asynchronous,
event-based programs.
It started as a proper implementation of [ReactiveX](http://reactivex.io/),
with stronger functional programming influences and designed from the ground up
for back-pressure and made to cleanly interact with Scala's standard library,
compatible out-of-the-box with the [Reactive Streams](http://www.reactive-streams.org/)
protocol. It then expanded to include abstractions for suspending side effects
and for resource handling, being one of the parents and implementors of
[cats-effect](https://typelevel.org/cats-effect/).
<a href="https://typelevel.org/"><img src="https://monix.io/public/images/typelevel.png" width="150" style="float:right;" align="right" /></a>
A [Typelevel project](http://typelevel.org/projects/), Monix proudly
exemplifies pure, typeful, functional programming in Scala, while making no
compromise on performance.
Highlights:
- exposes the kick-ass `Observable`, `Iterant`, `Task` and `Coeval` data types,
along with all the support they need
- modular, only use what you need
- designed for true asynchronicity, running on both the
JVM and [Scala.js](http://scala-js.org)
- really good test coverage, code quality and API documentation
as a primary project policy
## Usage
See **[monix-sample](https://github.com/monix/monix-sample)** for
a project exemplifying Monix used both on the server and on the client.
### Dependencies
The packages are published on Maven Central.
- Stable release: `2.3.3`
- Current release candidate: `3.0.0-RC1`
(compatible with Cats-Effect 0.10)
- Super experimental version: `3.0.0-RC2-c84f485`
(compatible with Cats-Effect 1.0.0)
For the 3.x series (that works with Cats `1.x` and Cats-Effect `0.10`):
```scala
libraryDependencies += "io.monix" %% "monix" % "3.0.0-RC1"
```
For the 2.x series:
```scala
libraryDependencies += "io.monix" %% "monix" % "2.3.3"
```
### Sub-projects
Monix 3.x is modular by design, so you can pick and choose:
- `monix-execution` exposes the low-level execution environment, or
more precisely `Scheduler`, `Cancelable`, `Atomic` and
`CancelableFuture`; depends on Cats 1.x and Cats-Effect
- `monix-eval` exposes `Task`, `Coeval`;
depends on `monix-execution`
- `monix-reactive` exposes `Observable` for modeling reactive,
push-based streams with back-pressure; depends on `monix-eval`
- `monix-tail` exposes `Iterant` streams for purely functional pull
based streaming; depends on `monix-eval` and makes heavy use of
Cats-Effect
- `monix` provides all of the above
### Versioning Scheme
The versioning scheme follows the
[Semantic Versioning](http://semver.org/) (semver) specification,
meaning that stable versions have the form `$major.$minor.$patch`,
such that:
1. `$major` version updates make binary incompatible API changes
2. `$minor` version updates adds functionality in a
backwards-compatible manner, and
3. `$patch` version updates makes backwards-compatible bug fixes
For development snapshots may be published to Sonatype at any time.
Development versions have the form: `$major.$minor.$patch-$hash`
(example `3.0.0-d3288bb`).
The `$hash` is the 7 character git hash prefix of the commit from
which the snapshot was published. Thus, "snapshots" can be used as
repeatable upstream dependencies if you're feeling courageous. NO
GUARANTEE is made for upgrades of development versions, use these at
your own risk.
## Documentation
See:
- Website: [Monix.io](https://monix.io/)
- [Documentation for 3.x](https://monix.io/docs/3x/)
- [Documentation for 2.x](https://monix.io/docs/2x/)
- [Presentations](https://monix.io/presentations/)
API Documentation:
- [3.0](https://monix.io/api/3.0/)
- [2.3](https://monix.io/api/2.3/)
- [1.2](https://monix.io/api/1.2/)
([contributions are welcome](https://github.com/monix/monix.io))
Related:
- [Typelevel Cats](https://typelevel.org/cats/)
- [Typelevel Cats-Effect](https://typelevel.org/cats-effect/)
## Contributing
The Monix project welcomes contributions from anybody wishing to
participate. All code or documentation that is provided must be
licensed with the same license that Monix is licensed with (Apache
2.0, see LICENSE.txt).
People are expected to follow the
[Scala Code of Conduct](./CODE_OF_CONDUCT.md) when
discussing Monix on GitHub, Gitter channel, or other venues.
Feel free to open an issue if you notice a bug, have an idea for a
feature, or have a question about the code. Pull requests are also
gladly accepted. For more information, check out the
[contributor guide](CONTRIBUTING.md).
If you'd like to donate in order to help with ongoing maintenance:
<a href="https://www.patreon.com/bePatron?u=6102596"><img label="Become a Patron!" src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" height="40" /></a>
## License
All code in this repository is licensed under the Apache License,
Version 2.0. See [LICENCE.txt](./LICENSE.txt).
## Acknowledgements
<img src="https://raw.githubusercontent.com/wiki/monix/monix/assets/yklogo.png" align="right" />
YourKit supports the Monix project with its full-featured Java Profiler.
YourKit, LLC is the creator [YourKit Java Profiler](https://www.yourkit.com/java/profiler/index.jsp)
and [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/index.jsp),
innovative and intelligent tools for profiling Java and .NET applications.
<img src="https://raw.githubusercontent.com/wiki/monix/monix/assets/logo-eloquentix@2x.png" align="right" width="130" />
Development of Monix has been initiated by [Eloquentix](http://eloquentix.com/)
engineers, with Monix being introduced at E.ON Connecting Energies,
powering the next generation energy grid solutions.
| ddworak/monix | README.md | Markdown | apache-2.0 | 6,528 |
import cython
def test_sizeof():
"""
>>> test_sizeof()
True
True
True
True
True
"""
x = cython.declare(cython.bint)
print(cython.sizeof(x) == cython.sizeof(cython.bint))
print(cython.sizeof(cython.char) <= cython.sizeof(cython.short) <= cython.sizeof(cython.int) <= cython.sizeof(cython.long) <= cython.sizeof(cython.longlong))
print(cython.sizeof(cython.uint) == cython.sizeof(cython.int))
print(cython.sizeof(cython.p_int) == cython.sizeof(cython.p_double))
if cython.compiled:
print(cython.sizeof(cython.char) < cython.sizeof(cython.longlong))
else:
print(cython.sizeof(cython.char) == 1)
## CURRENTLY BROKEN - FIXME!!
## def test_declare(n):
## """
## >>> test_declare(100)
## (100, 100)
## >>> test_declare(100.5)
## (100, 100)
## >>> test_declare(None)
## Traceback (most recent call last):
## ...
## TypeError: an integer is required
## """
## x = cython.declare(cython.int)
## y = cython.declare(cython.int, n)
## if cython.compiled:
## cython.declare(xx=cython.int, yy=cython.long)
## i = sizeof(xx)
## ptr = cython.declare(cython.p_int, cython.address(y))
## return y, ptr[0]
@cython.locals(x=cython.double, n=cython.int)
def test_cast(x):
"""
>>> test_cast(1.5)
1
"""
n = cython.cast(cython.int, x)
return n
@cython.locals(x=cython.int, y=cython.p_int)
def test_address(x):
"""
>>> test_address(39)
39
"""
y = cython.address(x)
return y[0]
## CURRENTLY BROKEN - FIXME!!
## @cython.locals(x=cython.int)
## @cython.locals(y=cython.bint)
## def test_locals(x):
## """
## >>> test_locals(5)
## True
## """
## y = x
## return y
def test_with_nogil(nogil):
"""
>>> raised = []
>>> class nogil(object):
... def __enter__(self):
... pass
... def __exit__(self, exc_class, exc, tb):
... raised.append(exc)
... return exc_class is None
>>> test_with_nogil(nogil())
WORKS
True
>>> raised
[None]
"""
result = False
with nogil:
print("WORKS")
with cython.nogil:
result = True
return result
## CURRENTLY BROKEN - FIXME!!
## MyUnion = cython.union(n=cython.int, x=cython.double)
## MyStruct = cython.struct(is_integral=cython.bint, data=MyUnion)
## MyStruct2 = cython.typedef(MyStruct[2])
## def test_struct(n, x):
## """
## >>> test_struct(389, 1.64493)
## (389, 1.64493)
## """
## a = cython.declare(MyStruct2)
## a[0] = MyStruct(True, data=MyUnion(n=n))
## a[1] = MyStruct(is_integral=False, data={'x': x})
## return a[0].data.n, a[1].data.x
import cython as cy
from cython import declare, cast, locals, address, typedef, p_void, compiled
from cython import declare as my_declare, locals as my_locals, p_void as my_void_star, typedef as my_typedef, compiled as my_compiled
@my_locals(a=cython.p_void)
def test_imports():
"""
>>> test_imports() # (True, True)
True
"""
a = cython.NULL
b = declare(p_void, cython.NULL)
c = my_declare(my_void_star, cython.NULL)
d = cy.declare(cy.p_void, cython.NULL)
## CURRENTLY BROKEN - FIXME!!
#return a == d, compiled == my_compiled
return compiled == my_compiled
## CURRENTLY BROKEN - FIXME!!
## MyStruct3 = typedef(MyStruct[3])
## MyStruct4 = my_typedef(MyStruct[4])
## MyStruct5 = cy.typedef(MyStruct[5])
def test_declare_c_types(n):
"""
>>> test_declare_c_types(0)
>>> test_declare_c_types(1)
>>> test_declare_c_types(2)
"""
#
b00 = cython.declare(cython.bint, 0)
b01 = cython.declare(cython.bint, 1)
b02 = cython.declare(cython.bint, 2)
#
i00 = cython.declare(cython.uchar, n)
i01 = cython.declare(cython.char, n)
i02 = cython.declare(cython.schar, n)
i03 = cython.declare(cython.ushort, n)
i04 = cython.declare(cython.short, n)
i05 = cython.declare(cython.sshort, n)
i06 = cython.declare(cython.uint, n)
i07 = cython.declare(cython.int, n)
i08 = cython.declare(cython.sint, n)
i09 = cython.declare(cython.slong, n)
i10 = cython.declare(cython.long, n)
i11 = cython.declare(cython.ulong, n)
i12 = cython.declare(cython.slonglong, n)
i13 = cython.declare(cython.longlong, n)
i14 = cython.declare(cython.ulonglong, n)
i20 = cython.declare(cython.Py_ssize_t, n)
i21 = cython.declare(cython.size_t, n)
#
f00 = cython.declare(cython.float, n)
f01 = cython.declare(cython.double, n)
f02 = cython.declare(cython.longdouble, n)
#
#z00 = cython.declare(cython.complex, n+1j)
#z01 = cython.declare(cython.floatcomplex, n+1j)
#z02 = cython.declare(cython.doublecomplex, n+1j)
#z03 = cython.declare(cython.longdoublecomplex, n+1j)
| bzzzz/cython | tests/run/pure_py.py | Python | apache-2.0 | 4,851 |
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.waf.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <note>
* <p>
* This is <b>AWS WAF Classic</b> documentation. For more information, see <a
* href="https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html">AWS WAF Classic</a> in the
* developer guide.
* </p>
* <p>
* <b>For the latest version of AWS WAF</b>, use the AWS WAFV2 API and see the <a
* href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html">AWS WAF Developer Guide</a>. With the
* latest version, AWS WAF has a single set of endpoints for regional and global use.
* </p>
* </note>
* <p>
* In an <a>UpdateByteMatchSet</a> request, <code>ByteMatchSetUpdate</code> specifies whether to insert or delete a
* <a>ByteMatchTuple</a> and includes the settings for the <code>ByteMatchTuple</code>.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/ByteMatchSetUpdate" target="_top">AWS
* API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ByteMatchSetUpdate implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* </p>
*/
private String action;
/**
* <p>
* Information about the part of a web request that you want AWS WAF to inspect and the value that you want AWS WAF
* to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that you want
* to delete from the <code>ByteMatchSet</code>.
* </p>
*/
private ByteMatchTuple byteMatchTuple;
/**
* <p>
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* </p>
*
* @param action
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* @see ChangeAction
*/
public void setAction(String action) {
this.action = action;
}
/**
* <p>
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* </p>
*
* @return Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* @see ChangeAction
*/
public String getAction() {
return this.action;
}
/**
* <p>
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* </p>
*
* @param action
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ChangeAction
*/
public ByteMatchSetUpdate withAction(String action) {
setAction(action);
return this;
}
/**
* <p>
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* </p>
*
* @param action
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* @see ChangeAction
*/
public void setAction(ChangeAction action) {
withAction(action);
}
/**
* <p>
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* </p>
*
* @param action
* Specifies whether to insert or delete a <a>ByteMatchTuple</a>.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ChangeAction
*/
public ByteMatchSetUpdate withAction(ChangeAction action) {
this.action = action.toString();
return this;
}
/**
* <p>
* Information about the part of a web request that you want AWS WAF to inspect and the value that you want AWS WAF
* to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that you want
* to delete from the <code>ByteMatchSet</code>.
* </p>
*
* @param byteMatchTuple
* Information about the part of a web request that you want AWS WAF to inspect and the value that you want
* AWS WAF to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that
* you want to delete from the <code>ByteMatchSet</code>.
*/
public void setByteMatchTuple(ByteMatchTuple byteMatchTuple) {
this.byteMatchTuple = byteMatchTuple;
}
/**
* <p>
* Information about the part of a web request that you want AWS WAF to inspect and the value that you want AWS WAF
* to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that you want
* to delete from the <code>ByteMatchSet</code>.
* </p>
*
* @return Information about the part of a web request that you want AWS WAF to inspect and the value that you want
* AWS WAF to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that
* you want to delete from the <code>ByteMatchSet</code>.
*/
public ByteMatchTuple getByteMatchTuple() {
return this.byteMatchTuple;
}
/**
* <p>
* Information about the part of a web request that you want AWS WAF to inspect and the value that you want AWS WAF
* to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that you want
* to delete from the <code>ByteMatchSet</code>.
* </p>
*
* @param byteMatchTuple
* Information about the part of a web request that you want AWS WAF to inspect and the value that you want
* AWS WAF to search for. If you specify <code>DELETE</code> for the value of <code>Action</code>, the
* <code>ByteMatchTuple</code> values must exactly match the values in the <code>ByteMatchTuple</code> that
* you want to delete from the <code>ByteMatchSet</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ByteMatchSetUpdate withByteMatchTuple(ByteMatchTuple byteMatchTuple) {
setByteMatchTuple(byteMatchTuple);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getByteMatchTuple() != null)
sb.append("ByteMatchTuple: ").append(getByteMatchTuple());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ByteMatchSetUpdate == false)
return false;
ByteMatchSetUpdate other = (ByteMatchSetUpdate) obj;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getByteMatchTuple() == null ^ this.getByteMatchTuple() == null)
return false;
if (other.getByteMatchTuple() != null && other.getByteMatchTuple().equals(this.getByteMatchTuple()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getByteMatchTuple() == null) ? 0 : getByteMatchTuple().hashCode());
return hashCode;
}
@Override
public ByteMatchSetUpdate clone() {
try {
return (ByteMatchSetUpdate) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.waf.model.waf_regional.transform.ByteMatchSetUpdateMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| aws/aws-sdk-java | aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/ByteMatchSetUpdate.java | Java | apache-2.0 | 9,852 |
package com.action.shejizhichan.chapter25.mult;
public interface ITotalVisitor extends IVisitor {
public void totalSalary();
}
| pearpai/java_action | src/main/java/com/action/shejizhichan/chapter25/mult/ITotalVisitor.java | Java | apache-2.0 | 134 |
<!DOCTYPE html>
<html>
<head>
<!--
###########################################################################
#
# Copyright 2020 Google LLC
#
# 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.
#
###########################################################################
#
# This code generated (see starthinker/scripts for possible source):
# - Command: "python starthinker_ui/manage.py github"
#
###########################################################################
-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-167283455-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-167283455-3');
</script>
<link rel="shortcut icon" href="https://google.github.io/starthinker/static/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://google.github.io/starthinker/static/favicon.ico" type="image/x-icon">
<!--Import Google Icon Font-->
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined" rel="stylesheet">
<!--Import materialize.css-->
<link rel="stylesheet" href="https://google.github.io/starthinker/static/css/materialize-1.0.0.min.css">
<style>
html { color: rgba(68,68,68,1); font-family: Roboto, sans-serif; }
.material-icons { line-height: normal; vertical-align: middle; }
#message { justify-content: center; font-size: 2em; padding: 0px 20px; }
#message i { font-size: 1.5em; margin: 10px; }
#message ul, #message li { display: inline; margin-left: 10px; }
#page { width: 100%; max-width: 1280px; min-height: 500px; margin: 0px auto; padding-bottom: 50px; }
div.nav-wrapper { padding-left: 10%; padding-right: 10%; }
h1 a i.material-icons { font-size: 4rem; }
a.brand-logo img { vertical-align: middle; width: 40px; height: 40px; }
span.brand-title { vertical-align: middle; padding-left: 10px;}
ol li { line-height: 1.8em; }
textarea { margin-top: 7px; height: 10rem; }
table.list { width: 96%; max-width: 800px; margin: 1vh auto; line-height: 1.8em; }
a.menu_link, span.menu_link { display: inline-block; margin: 8px; }
div.row { display: flex; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
#cards div.card { width: 300px; margin: 20px; padding: 0.1px; text-align: left; }
div.card h4 { width 100%; padding: 20px;}
div.card h4 i.material-icons { font-size: 2.28rem; }
div.card table { margin: 0px 5% 30px 5%; width: 90%; }
.card .card-content .card-title { word-wrap: break-word; }
div.input-field { padding-top: 0.1px; margin-top: 2.4em;}
div.switch { padding-top: 1rem; padding-bottom: 1rem; }
div.switch label { font-size: 1.05rem; }
div.switch label:first-child { font-size: 1.3rem; margin-right: 40px; }
p.flow-text { font-weight: 100; }
i.right { margin: 0px 15px; font-size: 1.5rem;}
.collapsible-body { padding: 0px; }
body { overflow: auto !important; }
#solution_image { margin: 10px auto; width: 100%; max-width: 800px; height: auto; display: block; }
.btn-large { margin: 1vh 1vw; }
.col { margin-right: auto; }
pre { overflow: scroll; }
</style>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<nav class="blue darken-1">
<div class="nav-wrapper">
<a href="/starthinker/" class="brand-logo">
<img src="https://google.github.io/starthinker/static/StarThinker.png" alt="StarThinker Logo"/>
<span class="brand-title">StarThinker</span>
</a>
<a href="#" data-target="mobile-menu" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="/starthinker/solution/">Solutions</a></li>
<li><a href="/starthinker/help/">Help</a></li>
</ul>
</div>
</nav>
<ul class="sidenav blue darken-2" id="mobile-menu">
<li><a class="white-text" href="/starthinker/solution/">Solutions</a></li>
<li><a class="white-text" href="/starthinker/help/">Help</a></li>
</ul>
<body>
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://google.github.io/starthinker/static/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="https://google.github.io/starthinker/static/js/materialize-1.0.0.min.js"></script>
<!--
Start of Floodlight Tag: Please do not remove
Activity name of this tag: Gallery Conversions
URL of the webpage where the tag is expected to be placed: https://google.github.io/starthinker/
This tag must be placed between the <body> and </body> tags, as close as possible to the opening tag.
Creation Date: 03/09/2020
-->
<script type="text/javascript">
var axel = Math.random() + "";
var a = axel * 10000000000000;
document.write('<img src="https://ad.doubleclick.net/ddm/activity/src=8657867;type=github;cat=galle0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=' + a + '?" width="1" height="1" alt=""/>');
</script>
<noscript>
<img src="https://ad.doubleclick.net/ddm/activity/src=8657867;type=github;cat=galle0;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;npa=;ord=1?" width="1" height="1" alt=""/>
</noscript>
<!-- End of Floodlight Tag: Please do not remove -->
<div id="page" class="center">
<br/><br/>
<a class="trigger_category menu_link waves-effect waves-dark btn-flat grey lighten-2" href="/starthinker/solution/">All</a>
<br/><br/>
<div class="row">
<div class="col s12 m6 l4">
<i class="large material-icons">gps_fixed</i><h1>DV360 Bulk Targeting Editor</h1>
<p class="flow-text">Allows bulk targeting DV360 through Sheets and BigQuery.</p>
</div>
<div class="col s12 m6 l8">
<img id="solution_image" src="https://github.com/google/starthinker/raw/master/tutorials/images/dv360_targeter.png" alt="DV360 Bulk Targeting Editor Sample Screenshot"/>
</div>
</div>
<br/><br/>
<div class="buttons">
<a class="btn-large blue waves-effect waves-light" href="https://groups.google.com/d/forum/starthinker-assets" target="_blank">
<i class="material-icons right">lock_open</i>Get Access
</a>
<a class="btn-large blue waves-effect waves-light" href="https://docs.google.com/spreadsheets/d/1ARkIvh0D-gltZeiwniUonMNrm0Mi1s2meZ9FUjutXOE/" target="_blank">
<i class="material-icons right">directions_bike</i>Sample
</a>
<a class="btn-large blue waves-effect waves-light" href="https://github.com/google/starthinker/blob/master/scripts/dv360_targeter.json" target="_blank">
<i class="material-icons right">list</i>Git Hub
</a>
<a class="btn-large blue waves-effect waves-light" href="https://github.com/google/starthinker/blob/master/examples/dv360_targeter_example.py" target="_blank">
<i class="material-icons right">source</i>Python
</a>
<a class="btn-large blue waves-effect waves-light" href="https://colab.research.google.com/github/google/starthinker/blob/master/colabs/dv360_targeter.ipynb" target="_blank">
<i class="material-icons right">menu_book</i>Colab
</a>
<a class="btn-large blue waves-effect waves-light" href="https://github.com/google/starthinker/blob/master/dags/dv360_targeter_dag.py" target="_blank">
<i class="material-icons right">air</i>Airflow
</a>
<a class="btn-large blue waves-effect waves-light" href="https://github.com/google/starthinker/blob/master/tests/dv360_targeter.json" target="_blank">
<i class="material-icons right">thumb_up</i>Test
</a>
</div>
<br/><br/>
<div class="row">
<div class="col s12 m6 l4">
<div class="card">
<br/>
<h4>Impact Level</h4>
<table class="bordered">
<tbody>
<tr>
<td width="50%">Spend Optimization</td>
<td>
<div class="progress">
<div class="determinate" style="width: 100%"></div>
</div>
</td>
</tr>
<tr>
<td width="50%">Spend Growth</td>
<td>
<div class="progress">
<div class="determinate" style="width: 80%"></div>
</div>
</td>
</tr>
<tr>
<td width="50%">Time Savings</td>
<td>
<div class="progress">
<div class="determinate" style="width: 100%"></div>
</div>
</td>
</tr>
<tr>
<td width="50%">Account Health</td>
<td>
<div class="progress">
<div class="determinate" style="width: 100%"></div>
</div>
</td>
</tr>
<tr>
<td width="50%">Csat Improvement</td>
<td>
<div class="progress">
<div class="determinate" style="width: 100%"></div>
</div>
</td>
</tr>
</tbody>
</table>
<h4>Value Proposition</h4>
<table class="bordered">
<tbody>
<tr>
<td>Speed up bulk targeting.</td>
</tr>
</tbody>
</table>
<h4>Instructions</h4>
<table class="bordered">
<tbody>
<tr>
<td>Select <strong>Load</strong>, click <strong>Save + Run</strong>, a sheet called <strong> DV Targeter</strong> will be created.</td>
</tr>
<tr>
<td>In the <strong>Partners</strong> sheet tab, fill in <strong>Filter</strong> column then select <strong>Load</strong>, click <strong>Save + Run</strong>.</td>
</tr>
<tr>
<td>In the <strong>Advertisers</strong> sheet tab, fill in <strong>Filter</strong> column. then select <strong>Load</strong>, click <strong>Save + Run</strong>.</td>
</tr>
<tr>
<td>Check the First And Third Party option to load audiences, which may be slow. If not loaded, user will enter audience ids into the sheet manually.</td>
</tr>
<tr>
<td>On the <strong>Line Items</strong> sheet tab, the <strong>Filter</strong> is used only to limit drop down choices in the rest of the tool.</td>
</tr>
<tr>
<td>Optionally edit or filter the <strong>Targeting Options</strong> or <strong>Inventory Sources</strong> sheets to limit choices.</td>
</tr>
<tr>
<td>Make targeting updates, fill in changes on all tabs with colored fields (RED FIELDS ARE NOT IMPLEMENTED, IGNORE).</td>
</tr>
<tr>
<td>Select <strong>Preview</strong>, click <strong>Save + Run</strong> then check the <strong>Preview</strong> tabs.</td>
</tr>
<tr>
<td>Select <strong>Update</strong>, click <strong>Save + Run</strong> then check the <strong>Success</strong> and <strong>Error</strong> tabs.</td>
</tr>
<tr>
<td>Load and Update can be run multiple times.</td>
</tr>
<tr>
<td>If an update fails, all parts of the update failed, break it up into multiple updates.</td>
</tr>
<tr>
<td>To refresh the Partner, Advertiser, or Line Item list, remove the filters and run load.</td>
</tr>
</tbody>
</table>
<h4>Details</h4>
<table class="bordered">
<tbody>
<tr>
<td>Open Source</td>
<td>YES
</tr>
<tr>
<td>Age</td>
<td>Jan. 12, 2021 (10 months, 1 week)</td>
</tr>
<tr>
<td>Authors</td>
<td><a href="mailto:kenjora@google.com?subject=Request+For+A+DV360+Bulk+Targeting+Editor+StarThinker+Solution&body=Hi%2C%0A%0AI%27d+like+to+learn+more+about+the+DV360+Bulk+Targeting+Editor+solution.%0A%0AStarThinker+Link%3A+https%3A%2F%2Fgoogle.github.io%2Fstarthinker%2Fsolution%2Fdv360_targeter%2F%0A%0ACan+we+set+up+some+time+to+over+it%3F%0A%0AThanks" target="_blank">kenjora@google.com</a>
</td>
</tr>
<tr>
<td>Manual</td>
<td>Triggered on demand by user.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col s12 m6 l8">
<pre id="code-workflow" class="card left-align"><code class="language-json">[
{
"<a href="https://github.com/google/starthinker/tree/master/starthinker/task/dataset/run.py" target="_blank">dataset</a>": {
"__comment__": "Ensure dataset exists.",
"auth": {
"field": {
"name": "auth_bigquery",
"kind": "authentication",
"order": 1,
"default": "service",
"description": "Credentials used for writing data."
}
},
"dataset": {
"field": {
"name": "recipe_slug",
"kind": "string",
"order": 2,
"default": "",
"description": "Name of Google BigQuery dataset to create."
}
}
}
},
{
"<a href="https://github.com/google/starthinker/tree/master/starthinker/task/drive/run.py" target="_blank">drive</a>": {
"__comment__": "Copy the default template to sheet with the recipe name",
"auth": {
"field": {
"name": "auth_sheet",
"kind": "authentication",
"order": 1,
"default": "user",
"description": "Credentials used for reading data."
}
},
"copy": {
"source": "https://docs.google.com/spreadsheets/d/1ARkIvh0D-gltZeiwniUonMNrm0Mi1s2meZ9FUjutXOE/",
"destination": {
"field": {
"name": "recipe_name",
"suffix": " DV Targeter",
"kind": "string",
"order": 3,
"default": "",
"description": "Name of Google Sheet to create."
}
}
}
}
},
{
"<a href="https://github.com/google/starthinker/tree/master/starthinker/task/dv_targeter/run.py" target="_blank">dv_targeter</a>": {
"__comment": "Depending on users choice, execute a different part of the solution.",
"auth_dv": {
"field": {
"name": "auth_dv",
"kind": "authentication",
"order": 1,
"default": "user",
"description": "Credentials used for dv."
}
},
"auth_sheets": {
"field": {
"name": "auth_sheet",
"kind": "authentication",
"order": 2,
"default": "user",
"description": "Credentials used for sheet."
}
},
"auth_bigquery": {
"field": {
"name": "auth_bigquery",
"kind": "authentication",
"order": 3,
"default": "service",
"description": "Credentials used for bigquery."
}
},
"sheet": {
"field": {
"name": "recipe_name",
"suffix": " DV Targeter",
"kind": "string",
"order": 4,
"default": "",
"description": "Name of Google Sheet to create."
}
},
"dataset": {
"field": {
"name": "recipe_slug",
"kind": "string",
"order": 5,
"default": "",
"description": "Name of Google BigQuery dataset to create."
}
},
"command": {
"field": {
"name": "command",
"kind": "choice",
"choices": [
"Clear",
"Load",
"Preview",
"Update"
],
"order": 6,
"default": "Load",
"description": "Action to take."
}
},
"first_and_third": {
"field": {
"name": "first_and_third",
"kind": "boolean",
"order": 6,
"default": false,
"description": "Load first and third party data (may be slow). If not selected, enter audience identifiers into sheet manually."
}
}
}
}
]</code></pre>
</div>
</div>
<br/><br/>
<h3 id="code-tasks">Run This Workflow In Minutes On Google Cloud</h3>
<p class="flow-text">Everything from a quick Google Cloud UI to reference developer code for your team in one GitHub repository.</p>
<p>
<a href="https://github.com/google/starthinker/blob/master/tutorials/README.md#deployment" class="waves-effect waves-light btn blue form_button modal-trigger" target="_blank">
Deployment Steps<i class="material-icons right">launch</i>
</a>
<a href="https://github.com/google/starthinker/blob/master/tutorials/README.md#development" class="waves-effect waves-light btn blue form_button modal-trigger" target="_blank">
Developer Guide<i class="material-icons right">build</i>
</a>
<a href="https://google.github.io/starthinker/help/" class="waves-effect waves-light btn blue form_button modal-trigger" target="_blank">
UI How To<i class="material-icons right">laptop</i>
</a>
</p>
</div>
</body>
<footer class="page-footer blue">
<div class="footer-copyright">
<div class="container center">
© 2019 Google LLC
</div>
</div>
</footer>
<script type="text/javascript">
$(document).ready(function() {
M.AutoInit(context=document.getElementById("form_recipe"));
});
</script>
</html>
| google/starthinker | docs/solution/dv360_targeter/index.html | HTML | apache-2.0 | 19,863 |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.tajo.master;
import com.google.common.base.Preconditions;
import com.google.protobuf.ByteString;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.util.StringUtils;
import org.apache.tajo.QueryId;
import org.apache.tajo.QueryIdFactory;
import org.apache.tajo.TajoConstants;
import org.apache.tajo.algebra.AlterTablespaceSetType;
import org.apache.tajo.algebra.Expr;
import org.apache.tajo.algebra.JsonHelper;
import org.apache.tajo.annotation.Nullable;
import org.apache.tajo.catalog.*;
import org.apache.tajo.catalog.exception.*;
import org.apache.tajo.catalog.partition.PartitionMethodDesc;
import org.apache.tajo.catalog.proto.CatalogProtos;
import org.apache.tajo.catalog.statistics.TableStats;
import org.apache.tajo.common.TajoDataTypes;
import org.apache.tajo.conf.TajoConf;
import org.apache.tajo.datum.DatumFactory;
import org.apache.tajo.engine.eval.EvalNode;
import org.apache.tajo.engine.exception.IllegalQueryStatusException;
import org.apache.tajo.engine.exception.VerifyException;
import org.apache.tajo.engine.parser.SQLAnalyzer;
import org.apache.tajo.engine.planner.*;
import org.apache.tajo.engine.planner.logical.*;
import org.apache.tajo.engine.planner.physical.EvalExprExec;
import org.apache.tajo.engine.planner.physical.StoreTableExec;
import org.apache.tajo.engine.query.QueryContext;
import org.apache.tajo.ipc.ClientProtos;
import org.apache.tajo.master.TajoMaster.MasterContext;
import org.apache.tajo.master.querymaster.Query;
import org.apache.tajo.master.querymaster.QueryInfo;
import org.apache.tajo.master.querymaster.QueryJobManager;
import org.apache.tajo.master.querymaster.QueryMasterTask;
import org.apache.tajo.master.session.Session;
import org.apache.tajo.storage.*;
import org.apache.tajo.worker.TaskAttemptContext;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import static org.apache.tajo.TajoConstants.DEFAULT_TABLESPACE_NAME;
import static org.apache.tajo.catalog.proto.CatalogProtos.AlterTablespaceProto;
import static org.apache.tajo.ipc.ClientProtos.SubmitQueryResponse;
import static org.apache.tajo.ipc.ClientProtos.SubmitQueryResponse.SerializedResultSet;
public class GlobalEngine extends AbstractService {
/** Class Logger */
private final static Log LOG = LogFactory.getLog(GlobalEngine.class);
private final MasterContext context;
private final AbstractStorageManager sm;
private SQLAnalyzer analyzer;
private CatalogService catalog;
private PreLogicalPlanVerifier preVerifier;
private LogicalPlanner planner;
private LogicalOptimizer optimizer;
private LogicalPlanVerifier annotatedPlanVerifier;
private DistributedQueryHookManager hookManager;
public GlobalEngine(final MasterContext context) {
super(GlobalEngine.class.getName());
this.context = context;
this.catalog = context.getCatalog();
this.sm = context.getStorageManager();
}
public void start() {
try {
analyzer = new SQLAnalyzer();
preVerifier = new PreLogicalPlanVerifier(context.getCatalog());
planner = new LogicalPlanner(context.getCatalog());
optimizer = new LogicalOptimizer(context.getConf());
annotatedPlanVerifier = new LogicalPlanVerifier(context.getConf(), context.getCatalog());
hookManager = new DistributedQueryHookManager();
hookManager.addHook(new CreateTableHook());
hookManager.addHook(new InsertHook());
} catch (Throwable t) {
LOG.error(t.getMessage(), t);
}
super.start();
}
public void stop() {
super.stop();
}
public SubmitQueryResponse executeQuery(Session session, String query, boolean isJson) {
LOG.info("Query: " + query);
QueryContext queryContext = new QueryContext();
queryContext.putAll(session.getAllVariables());
Expr planningContext;
try {
if (isJson) {
planningContext = buildExpressionFromJson(query);
} else {
// setting environment variables
String [] cmds = query.split(" ");
if(cmds != null) {
if(cmds[0].equalsIgnoreCase("set")) {
String[] params = cmds[1].split("=");
context.getConf().set(params[0], params[1]);
SubmitQueryResponse.Builder responseBuilder = SubmitQueryResponse.newBuilder();
responseBuilder.setUserName(context.getConf().getVar(TajoConf.ConfVars.USERNAME));
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
return responseBuilder.build();
}
}
planningContext = buildExpressionFromSql(queryContext, query);
}
String jsonExpr = planningContext.toJson();
LogicalPlan plan = createLogicalPlan(session, planningContext);
SubmitQueryResponse response = executeQueryInternal(queryContext, session, plan, query, jsonExpr);
return response;
} catch (Throwable t) {
context.getSystemMetrics().counter("Query", "errorQuery").inc();
LOG.error("\nStack Trace:\n" + StringUtils.stringifyException(t));
SubmitQueryResponse.Builder responseBuilder = SubmitQueryResponse.newBuilder();
responseBuilder.setUserName(context.getConf().getVar(TajoConf.ConfVars.USERNAME));
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setIsForwarded(true);
responseBuilder.setResultCode(ClientProtos.ResultCode.ERROR);
String errorMessage = t.getMessage();
if (t.getMessage() == null) {
errorMessage = t.getClass().getName();
}
responseBuilder.setErrorMessage(errorMessage);
responseBuilder.setErrorTrace(StringUtils.stringifyException(t));
return responseBuilder.build();
}
}
public Expr buildExpressionFromJson(String json) {
return JsonHelper.fromJson(json, Expr.class);
}
public Expr buildExpressionFromSql(QueryContext queryContext, String sql)
throws InterruptedException, IOException, IllegalQueryStatusException {
context.getSystemMetrics().counter("Query", "totalQuery").inc();
return analyzer.parse(sql);
}
private SubmitQueryResponse executeQueryInternal(QueryContext queryContext,
Session session,
LogicalPlan plan,
String sql,
String jsonExpr) throws Exception {
LogicalRootNode rootNode = plan.getRootBlock().getRoot();
SubmitQueryResponse.Builder responseBuilder = SubmitQueryResponse.newBuilder();
responseBuilder.setIsForwarded(false);
responseBuilder.setUserName(context.getConf().getVar(TajoConf.ConfVars.USERNAME));
if (PlannerUtil.checkIfDDLPlan(rootNode)) {
context.getSystemMetrics().counter("Query", "numDDLQuery").inc();
updateQuery(session, rootNode.getChild());
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
} else if (plan.isExplain()) { // explain query
String explainStr = PlannerUtil.buildExplainString(plan.getRootBlock().getRoot());
Schema schema = new Schema();
schema.addColumn("explain", TajoDataTypes.Type.TEXT);
RowStoreUtil.RowStoreEncoder encoder = RowStoreUtil.createEncoder(schema);
SerializedResultSet.Builder serializedResBuilder = SerializedResultSet.newBuilder();
VTuple tuple = new VTuple(1);
String[] lines = explainStr.split("\n");
int bytesNum = 0;
for (String line : lines) {
tuple.put(0, DatumFactory.createText(line));
byte [] encodedData = encoder.toBytes(tuple);
bytesNum += encodedData.length;
serializedResBuilder.addSerializedTuples(ByteString.copyFrom(encodedData));
}
serializedResBuilder.setSchema(schema.getProto());
serializedResBuilder.setBytesNum(bytesNum);
responseBuilder.setResultSet(serializedResBuilder.build());
responseBuilder.setMaxRowNum(lines.length);
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
// Simple query indicates a form of 'select * from tb_name [LIMIT X];'.
} else if (PlannerUtil.checkIfSimpleQuery(plan)) {
ScanNode scanNode = plan.getRootBlock().getNode(NodeType.SCAN);
TableDesc desc = scanNode.getTableDesc();
if (plan.getRootBlock().hasNode(NodeType.LIMIT)) {
LimitNode limitNode = plan.getRootBlock().getNode(NodeType.LIMIT);
responseBuilder.setMaxRowNum((int) limitNode.getFetchFirstNum());
} else {
if (desc.getStats().getNumBytes() > 0 && desc.getStats().getNumRows() == 0) {
responseBuilder.setMaxRowNum(Integer.MAX_VALUE);
}
}
responseBuilder.setTableDesc(desc.getProto());
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
// NonFromQuery indicates a form of 'select a, x+y;'
} else if (PlannerUtil.checkIfNonFromQuery(plan)) {
Target [] targets = plan.getRootBlock().getRawTargets();
if (targets == null) {
throw new PlanningException("No targets");
}
final Tuple outTuple = new VTuple(targets.length);
for (int i = 0; i < targets.length; i++) {
EvalNode eval = targets[i].getEvalTree();
outTuple.put(i, eval.eval(null, null));
}
boolean isInsert = rootNode.getChild() != null && rootNode.getChild().getType() == NodeType.INSERT;
if (isInsert) {
InsertNode insertNode = rootNode.getChild();
insertNonFromQuery(queryContext, insertNode, responseBuilder);
} else {
Schema schema = PlannerUtil.targetToSchema(targets);
RowStoreUtil.RowStoreEncoder encoder = RowStoreUtil.createEncoder(schema);
byte[] serializedBytes = encoder.toBytes(outTuple);
SerializedResultSet.Builder serializedResBuilder = SerializedResultSet.newBuilder();
serializedResBuilder.addSerializedTuples(ByteString.copyFrom(serializedBytes));
serializedResBuilder.setSchema(schema.getProto());
serializedResBuilder.setBytesNum(serializedBytes.length);
responseBuilder.setResultSet(serializedResBuilder);
responseBuilder.setMaxRowNum(1);
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
}
} else { // it requires distributed execution. So, the query is forwarded to a query master.
context.getSystemMetrics().counter("Query", "numDMLQuery").inc();
hookManager.doHooks(queryContext, plan);
QueryJobManager queryJobManager = this.context.getQueryJobManager();
QueryInfo queryInfo;
queryInfo = queryJobManager.createNewQueryJob(session, queryContext, sql, jsonExpr, rootNode);
if(queryInfo == null) {
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.ERROR);
responseBuilder.setErrorMessage("Fail starting QueryMaster.");
} else {
responseBuilder.setIsForwarded(true);
responseBuilder.setQueryId(queryInfo.getQueryId().getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
if(queryInfo.getQueryMasterHost() != null) {
responseBuilder.setQueryMasterHost(queryInfo.getQueryMasterHost());
}
responseBuilder.setQueryMasterPort(queryInfo.getQueryMasterClientPort());
LOG.info("Query is forwarded to " + queryInfo.getQueryMasterHost() + ":" + queryInfo.getQueryMasterPort());
}
}
SubmitQueryResponse response = responseBuilder.build();
return response;
}
private void insertNonFromQuery(QueryContext queryContext, InsertNode insertNode, SubmitQueryResponse.Builder responseBuilder)
throws Exception {
String nodeUniqName = insertNode.getTableName() == null ? insertNode.getPath().getName() : insertNode.getTableName();
String queryId = nodeUniqName + "_" + System.currentTimeMillis();
FileSystem fs = TajoConf.getWarehouseDir(context.getConf()).getFileSystem(context.getConf());
Path stagingDir = QueryMasterTask.initStagingDir(context.getConf(), fs, queryId.toString());
Path stagingResultDir = new Path(stagingDir, TajoConstants.RESULT_DIR_NAME);
fs.mkdirs(stagingResultDir);
TableDesc tableDesc = null;
Path finalOutputDir = null;
if (insertNode.getTableName() != null) {
tableDesc = this.catalog.getTableDesc(insertNode.getTableName());
finalOutputDir = tableDesc.getPath();
} else {
finalOutputDir = insertNode.getPath();
}
TaskAttemptContext taskAttemptContext =
new TaskAttemptContext(context.getConf(), queryContext, null, (CatalogProtos.FragmentProto[]) null, stagingDir);
taskAttemptContext.setOutputPath(new Path(stagingResultDir, "part-01-000000"));
EvalExprExec evalExprExec = new EvalExprExec(taskAttemptContext, (EvalExprNode) insertNode.getChild());
StoreTableExec exec = new StoreTableExec(taskAttemptContext, insertNode, evalExprExec);
try {
exec.init();
exec.next();
} finally {
exec.close();
}
if (insertNode.isOverwrite()) { // INSERT OVERWRITE INTO
// it moves the original table into the temporary location.
// Then it moves the new result table into the original table location.
// Upon failed, it recovers the original table if possible.
boolean movedToOldTable = false;
boolean committed = false;
Path oldTableDir = new Path(stagingDir, TajoConstants.INSERT_OVERWIRTE_OLD_TABLE_NAME);
try {
if (fs.exists(finalOutputDir)) {
fs.rename(finalOutputDir, oldTableDir);
movedToOldTable = fs.exists(oldTableDir);
} else { // if the parent does not exist, make its parent directory.
fs.mkdirs(finalOutputDir.getParent());
}
fs.rename(stagingResultDir, finalOutputDir);
committed = fs.exists(finalOutputDir);
} catch (IOException ioe) {
// recover the old table
if (movedToOldTable && !committed) {
fs.rename(oldTableDir, finalOutputDir);
}
}
} else {
FileStatus[] files = fs.listStatus(stagingResultDir);
for (FileStatus eachFile: files) {
Path targetFilePath = new Path(finalOutputDir, eachFile.getPath().getName());
if (fs.exists(targetFilePath)) {
targetFilePath = new Path(finalOutputDir, eachFile.getPath().getName() + "_" + System.currentTimeMillis());
}
fs.rename(eachFile.getPath(), targetFilePath);
}
}
if (insertNode.hasTargetTable()) {
TableStats stats = tableDesc.getStats();
long volume = Query.getTableVolume(context.getConf(), finalOutputDir);
stats.setNumBytes(volume);
stats.setNumRows(1);
catalog.dropTable(insertNode.getTableName());
catalog.createTable(tableDesc);
responseBuilder.setTableDesc(tableDesc.getProto());
} else {
TableStats stats = new TableStats();
long volume = Query.getTableVolume(context.getConf(), finalOutputDir);
stats.setNumBytes(volume);
stats.setNumRows(1);
// Empty TableDesc
List<CatalogProtos.ColumnProto> columns = new ArrayList<CatalogProtos.ColumnProto>();
CatalogProtos.TableDescProto tableDescProto = CatalogProtos.TableDescProto.newBuilder()
.setTableName(nodeUniqName)
.setMeta(CatalogProtos.TableProto.newBuilder().setStoreType(CatalogProtos.StoreType.CSV).build())
.setSchema(CatalogProtos.SchemaProto.newBuilder().addAllFields(columns).build())
.setStats(stats.getProto())
.build();
responseBuilder.setTableDesc(tableDescProto);
}
// If queryId == NULL_QUERY_ID and MaxRowNum == -1, TajoCli prints only number of inserted rows.
responseBuilder.setMaxRowNum(-1);
responseBuilder.setQueryId(QueryIdFactory.NULL_QUERY_ID.getProto());
responseBuilder.setResultCode(ClientProtos.ResultCode.OK);
}
public QueryId updateQuery(Session session, String sql, boolean isJson) throws IOException, SQLException, PlanningException {
try {
LOG.info("SQL: " + sql);
Expr expr;
if (isJson) {
expr = JsonHelper.fromJson(sql, Expr.class);
} else {
// parse the query
expr = analyzer.parse(sql);
}
LogicalPlan plan = createLogicalPlan(session, expr);
LogicalRootNode rootNode = plan.getRootBlock().getRoot();
if (!PlannerUtil.checkIfDDLPlan(rootNode)) {
throw new SQLException("This is not update query:\n" + sql);
} else {
updateQuery(session, rootNode.getChild());
return QueryIdFactory.NULL_QUERY_ID;
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new IOException(e.getMessage(), e);
}
}
private boolean updateQuery(Session session, LogicalNode root) throws IOException {
switch (root.getType()) {
case CREATE_DATABASE:
CreateDatabaseNode createDatabase = (CreateDatabaseNode) root;
createDatabase(session, createDatabase.getDatabaseName(), null, createDatabase.isIfNotExists());
return true;
case DROP_DATABASE:
DropDatabaseNode dropDatabaseNode = (DropDatabaseNode) root;
dropDatabase(session, dropDatabaseNode.getDatabaseName(), dropDatabaseNode.isIfExists());
return true;
case CREATE_TABLE:
CreateTableNode createTable = (CreateTableNode) root;
createTable(session, createTable, createTable.isIfNotExists());
return true;
case DROP_TABLE:
DropTableNode dropTable = (DropTableNode) root;
dropTable(session, dropTable.getTableName(), dropTable.isIfExists(), dropTable.isPurge());
return true;
case ALTER_TABLESPACE:
AlterTablespaceNode alterTablespace = (AlterTablespaceNode) root;
alterTablespace(session, alterTablespace);
return true;
case ALTER_TABLE:
AlterTableNode alterTable = (AlterTableNode) root;
alterTable(session,alterTable);
return true;
case TRUNCATE_TABLE:
TruncateTableNode truncateTable = (TruncateTableNode) root;
truncateTable(session, truncateTable);
return true;
default:
throw new InternalError("updateQuery cannot handle such query: \n" + root.toJson());
}
}
private LogicalPlan createLogicalPlan(Session session, Expr expression) throws PlanningException {
VerificationState state = new VerificationState();
preVerifier.verify(session, state, expression);
if (!state.verified()) {
StringBuilder sb = new StringBuilder();
for (String error : state.getErrorMessages()) {
sb.append(error).append("\n");
}
throw new VerifyException(sb.toString());
}
LogicalPlan plan = planner.createPlan(session, expression);
if (LOG.isDebugEnabled()) {
LOG.debug("=============================================");
LOG.debug("Non Optimized Query: \n" + plan.toString());
LOG.debug("=============================================");
}
LOG.info("Non Optimized Query: \n" + plan.toString());
optimizer.optimize(session, plan);
LOG.info("=============================================");
LOG.info("Optimized Query: \n" + plan.toString());
LOG.info("=============================================");
annotatedPlanVerifier.verify(session, state, plan);
if (!state.verified()) {
StringBuilder sb = new StringBuilder();
for (String error : state.getErrorMessages()) {
sb.append(error).append("\n");
}
throw new VerifyException(sb.toString());
}
return plan;
}
/**
* Alter a given table
*/
public void alterTablespace(final Session session, final AlterTablespaceNode alterTablespace) {
final CatalogService catalog = context.getCatalog();
final String spaceName = alterTablespace.getTablespaceName();
AlterTablespaceProto.Builder builder = AlterTablespaceProto.newBuilder();
builder.setSpaceName(spaceName);
if (alterTablespace.getSetType() == AlterTablespaceSetType.LOCATION) {
AlterTablespaceProto.AlterTablespaceCommand.Builder commandBuilder =
AlterTablespaceProto.AlterTablespaceCommand.newBuilder();
commandBuilder.setType(AlterTablespaceProto.AlterTablespaceType.LOCATION);
commandBuilder.setLocation(AlterTablespaceProto.SetLocation.newBuilder().setUri(alterTablespace.getLocation()));
commandBuilder.build();
builder.addCommand(commandBuilder);
} else {
throw new RuntimeException("This 'ALTER TABLESPACE' is not supported yet.");
}
catalog.alterTablespace(builder.build());
}
/**
* Alter a given table
*/
public void alterTable(final Session session, final AlterTableNode alterTable) throws IOException {
final CatalogService catalog = context.getCatalog();
final String tableName = alterTable.getTableName();
String databaseName;
String simpleTableName;
if (CatalogUtil.isFQTableName(tableName)) {
String[] split = CatalogUtil.splitFQTableName(tableName);
databaseName = split[0];
simpleTableName = split[1];
} else {
databaseName = session.getCurrentDatabase();
simpleTableName = tableName;
}
final String qualifiedName = CatalogUtil.buildFQName(databaseName, simpleTableName);
if (!catalog.existsTable(databaseName, simpleTableName)) {
throw new NoSuchTableException(qualifiedName);
}
switch (alterTable.getAlterTableOpType()) {
case RENAME_TABLE:
if (!catalog.existsTable(databaseName, simpleTableName)) {
throw new NoSuchTableException(alterTable.getTableName());
}
if (catalog.existsTable(databaseName, alterTable.getNewTableName())) {
throw new AlreadyExistsTableException(alterTable.getNewTableName());
}
TableDesc desc = catalog.getTableDesc(databaseName, simpleTableName);
if (!desc.isExternal()) { // if the table is the managed table
Path oldPath = StorageUtil.concatPath(context.getConf().getVar(TajoConf.ConfVars.WAREHOUSE_DIR),
databaseName, simpleTableName);
Path newPath = StorageUtil.concatPath(context.getConf().getVar(TajoConf.ConfVars.WAREHOUSE_DIR),
databaseName, alterTable.getNewTableName());
FileSystem fs = oldPath.getFileSystem(context.getConf());
if (!fs.exists(oldPath)) {
throw new IOException("No such a table directory: " + oldPath);
}
if (fs.exists(newPath)) {
throw new IOException("Already table directory exists: " + newPath);
}
fs.rename(oldPath, newPath);
}
catalog.alterTable(CatalogUtil.renameTable(qualifiedName, alterTable.getNewTableName(),
AlterTableType.RENAME_TABLE));
break;
case RENAME_COLUMN:
if (existColumnName(qualifiedName, alterTable.getNewColumnName())) {
throw new ColumnNameAlreadyExistException(alterTable.getNewColumnName());
}
catalog.alterTable(CatalogUtil.renameColumn(qualifiedName, alterTable.getColumnName(), alterTable.getNewColumnName(), AlterTableType.RENAME_COLUMN));
break;
case ADD_COLUMN:
if (existColumnName(qualifiedName, alterTable.getAddNewColumn().getSimpleName())) {
throw new ColumnNameAlreadyExistException(alterTable.getAddNewColumn().getSimpleName());
}
catalog.alterTable(CatalogUtil.addNewColumn(qualifiedName, alterTable.getAddNewColumn(), AlterTableType.ADD_COLUMN));
break;
default:
//TODO
}
}
/**
* Truncate table a given table
*/
public void truncateTable(final Session session, final TruncateTableNode truncateTableNode) throws IOException {
List<String> tableNames = truncateTableNode.getTableNames();
final CatalogService catalog = context.getCatalog();
String databaseName;
String simpleTableName;
List<TableDesc> tableDescList = new ArrayList<TableDesc>();
for (String eachTableName: tableNames) {
if (CatalogUtil.isFQTableName(eachTableName)) {
String[] split = CatalogUtil.splitFQTableName(eachTableName);
databaseName = split[0];
simpleTableName = split[1];
} else {
databaseName = session.getCurrentDatabase();
simpleTableName = eachTableName;
}
final String qualifiedName = CatalogUtil.buildFQName(databaseName, simpleTableName);
if (!catalog.existsTable(databaseName, simpleTableName)) {
throw new NoSuchTableException(qualifiedName);
}
Path warehousePath = new Path(TajoConf.getWarehouseDir(context.getConf()), databaseName);
TableDesc tableDesc = catalog.getTableDesc(databaseName, simpleTableName);
Path tablePath = tableDesc.getPath();
if (tablePath.getParent() == null ||
!tablePath.getParent().toUri().getPath().equals(warehousePath.toUri().getPath())) {
throw new IOException("Can't truncate external table:" + eachTableName + ", data dir=" + tablePath +
", warehouse dir=" + warehousePath);
}
tableDescList.add(tableDesc);
}
for (TableDesc eachTable: tableDescList) {
Path path = eachTable.getPath();
LOG.info("Truncate table: " + eachTable.getName() + ", delete all data files in " + path);
FileSystem fs = path.getFileSystem(context.getConf());
FileStatus[] files = fs.listStatus(path);
if (files != null) {
for (FileStatus eachFile: files) {
fs.delete(eachFile.getPath(), true);
}
}
}
}
private boolean existColumnName(String tableName, String columnName) {
final TableDesc tableDesc = catalog.getTableDesc(tableName);
return tableDesc.getSchema().containsByName(columnName) ? true : false;
}
private TableDesc createTable(Session session, CreateTableNode createTable, boolean ifNotExists) throws IOException {
TableMeta meta;
if (createTable.hasOptions()) {
meta = CatalogUtil.newTableMeta(createTable.getStorageType(), createTable.getOptions());
} else {
meta = CatalogUtil.newTableMeta(createTable.getStorageType());
}
if(createTable.isExternal()){
Preconditions.checkState(createTable.hasPath(), "ERROR: LOCATION must be given.");
} else {
String databaseName;
String tableName;
if (CatalogUtil.isFQTableName(createTable.getTableName())) {
databaseName = CatalogUtil.extractQualifier(createTable.getTableName());
tableName = CatalogUtil.extractSimpleName(createTable.getTableName());
} else {
databaseName = session.getCurrentDatabase();
tableName = createTable.getTableName();
}
// create a table directory (i.e., ${WAREHOUSE_DIR}/${DATABASE_NAME}/${TABLE_NAME} )
Path tablePath = StorageUtil.concatPath(sm.getWarehouseDir(), databaseName, tableName);
createTable.setPath(tablePath);
}
return createTableOnPath(session, createTable.getTableName(), createTable.getTableSchema(),
meta, createTable.getPath(), createTable.isExternal(), createTable.getPartitionMethod(), ifNotExists);
}
public TableDesc createTableOnPath(Session session, String tableName, Schema schema, TableMeta meta,
Path path, boolean isExternal, PartitionMethodDesc partitionDesc,
boolean ifNotExists)
throws IOException {
String databaseName;
String simpleTableName;
if (CatalogUtil.isFQTableName(tableName)) {
String [] splitted = CatalogUtil.splitFQTableName(tableName);
databaseName = splitted[0];
simpleTableName = splitted[1];
} else {
databaseName = session.getCurrentDatabase();
simpleTableName = tableName;
}
String qualifiedName = CatalogUtil.buildFQName(databaseName, simpleTableName);
boolean exists = catalog.existsTable(databaseName, simpleTableName);
if (exists) {
if (ifNotExists) {
LOG.info("relation \"" + qualifiedName + "\" is already exists." );
return catalog.getTableDesc(databaseName, simpleTableName);
} else {
throw new AlreadyExistsTableException(CatalogUtil.buildFQName(databaseName, tableName));
}
}
FileSystem fs = path.getFileSystem(context.getConf());
if (isExternal) {
if(!fs.exists(path)) {
LOG.error("ERROR: " + path.toUri() + " does not exist");
throw new IOException("ERROR: " + path.toUri() + " does not exist");
}
} else {
fs.mkdirs(path);
}
long totalSize = 0;
try {
totalSize = sm.calculateSize(path);
} catch (IOException e) {
LOG.warn("Cannot calculate the size of the relation", e);
}
TableStats stats = new TableStats();
stats.setNumBytes(totalSize);
TableDesc desc = new TableDesc(CatalogUtil.buildFQName(databaseName, simpleTableName),
schema, meta, path, isExternal);
desc.setStats(stats);
if (partitionDesc != null) {
desc.setPartitionMethod(partitionDesc);
}
if (catalog.createTable(desc)) {
LOG.info("Table " + desc.getName() + " is created (" + desc.getStats().getNumBytes() + ")");
return desc;
} else {
LOG.info("Table creation " + tableName + " is failed.");
throw new CatalogException("Cannot create table \"" + tableName + "\".");
}
}
public boolean createDatabase(@Nullable Session session, String databaseName,
@Nullable String tablespace,
boolean ifNotExists) throws IOException {
String tablespaceName;
if (tablespace == null) {
tablespaceName = DEFAULT_TABLESPACE_NAME;
} else {
tablespaceName = tablespace;
}
// CREATE DATABASE IF NOT EXISTS
boolean exists = catalog.existDatabase(databaseName);
if (exists) {
if (ifNotExists) {
LOG.info("database \"" + databaseName + "\" is already exists." );
return true;
} else {
throw new AlreadyExistsDatabaseException(databaseName);
}
}
if (catalog.createDatabase(databaseName, tablespaceName)) {
String normalized = databaseName;
Path databaseDir = StorageUtil.concatPath(context.getConf().getVar(TajoConf.ConfVars.WAREHOUSE_DIR), normalized);
FileSystem fs = databaseDir.getFileSystem(context.getConf());
fs.mkdirs(databaseDir);
}
return true;
}
public boolean dropDatabase(Session session, String databaseName, boolean ifExists) {
boolean exists = catalog.existDatabase(databaseName);
if(!exists) {
if (ifExists) { // DROP DATABASE IF EXISTS
LOG.info("database \"" + databaseName + "\" does not exists." );
return true;
} else { // Otherwise, it causes an exception.
throw new NoSuchDatabaseException(databaseName);
}
}
if (session.getCurrentDatabase().equals(databaseName)) {
throw new RuntimeException("ERROR: Cannot drop the current open database");
}
boolean result = catalog.dropDatabase(databaseName);
LOG.info("database " + databaseName + " is dropped.");
return result;
}
/**
* Drop a given named table
*
* @param tableName to be dropped
* @param purge Remove all data if purge is true.
*/
public boolean dropTable(Session session, String tableName, boolean ifExists, boolean purge) {
CatalogService catalog = context.getCatalog();
String databaseName;
String simpleTableName;
if (CatalogUtil.isFQTableName(tableName)) {
String [] splitted = CatalogUtil.splitFQTableName(tableName);
databaseName = splitted[0];
simpleTableName = splitted[1];
} else {
databaseName = session.getCurrentDatabase();
simpleTableName = tableName;
}
String qualifiedName = CatalogUtil.buildFQName(databaseName, simpleTableName);
boolean exists = catalog.existsTable(qualifiedName);
if(!exists) {
if (ifExists) { // DROP TABLE IF EXISTS
LOG.info("relation \"" + qualifiedName + "\" is already exists." );
return true;
} else { // Otherwise, it causes an exception.
throw new NoSuchTableException(qualifiedName);
}
}
Path path = catalog.getTableDesc(qualifiedName).getPath();
catalog.dropTable(qualifiedName);
if (purge) {
try {
FileSystem fs = path.getFileSystem(context.getConf());
fs.delete(path, true);
} catch (IOException e) {
throw new InternalError(e.getMessage());
}
}
LOG.info(String.format("relation \"%s\" is " + (purge ? " purged." : " dropped."), qualifiedName));
return true;
}
public interface DistributedQueryHook {
boolean isEligible(QueryContext queryContext, LogicalPlan plan);
void hook(QueryContext queryContext, LogicalPlan plan) throws Exception;
}
public static class DistributedQueryHookManager {
private List<DistributedQueryHook> hooks = new ArrayList<DistributedQueryHook>();
public void addHook(DistributedQueryHook hook) {
hooks.add(hook);
}
public void doHooks(QueryContext queryContext, LogicalPlan plan) {
for (DistributedQueryHook hook : hooks) {
if (hook.isEligible(queryContext, plan)) {
try {
hook.hook(queryContext, plan);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
}
public class CreateTableHook implements DistributedQueryHook {
@Override
public boolean isEligible(QueryContext queryContext, LogicalPlan plan) {
LogicalRootNode rootNode = plan.getRootBlock().getRoot();
return rootNode.getChild().getType() == NodeType.CREATE_TABLE;
}
@Override
public void hook(QueryContext queryContext, LogicalPlan plan) throws Exception {
LogicalRootNode rootNode = plan.getRootBlock().getRoot();
CreateTableNode createTableNode = rootNode.getChild();
String [] splitted = CatalogUtil.splitFQTableName(createTableNode.getTableName());
String databaseName = splitted[0];
String tableName = splitted[1];
queryContext.setOutputTable(tableName);
queryContext.setOutputPath(
StorageUtil.concatPath(TajoConf.getWarehouseDir(context.getConf()), databaseName, tableName));
if(createTableNode.getPartitionMethod() != null) {
queryContext.setPartitionMethod(createTableNode.getPartitionMethod());
}
queryContext.setCreateTable();
}
}
public static class InsertHook implements DistributedQueryHook {
@Override
public boolean isEligible(QueryContext queryContext, LogicalPlan plan) {
return plan.getRootBlock().getRootType() == NodeType.INSERT;
}
@Override
public void hook(QueryContext queryContext, LogicalPlan plan) throws Exception {
queryContext.setInsert();
InsertNode insertNode = plan.getRootBlock().getNode(NodeType.INSERT);
// Set QueryContext settings, such as output table name and output path.
// It also remove data files if overwrite is true.
Path outputPath;
if (insertNode.hasTargetTable()) { // INSERT INTO [TB_NAME]
queryContext.setOutputTable(insertNode.getTableName());
queryContext.setOutputPath(insertNode.getPath());
if (insertNode.hasPartition()) {
queryContext.setPartitionMethod(insertNode.getPartitionMethod());
}
} else { // INSERT INTO LOCATION ...
// When INSERT INTO LOCATION, must not set output table.
outputPath = insertNode.getPath();
queryContext.setFileOutput();
queryContext.setOutputPath(outputPath);
}
if (insertNode.isOverwrite()) {
queryContext.setOutputOverwrite();
}
}
}
}
| yeeunshim/tajo_test | tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java | Java | apache-2.0 | 37,099 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>IISExpress - FAKE - F# Make</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Steffen Forkmann, Mauricio Scheffer, Colin Bull">
<script src="http://code.jquery.com/jquery-1.8.0.js"></script>
<script src="http://code.jquery.com/ui/1.8.23/jquery-ui.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="http://fsharp.github.io/FAKE/content/style.css" />
<script type="text/javascript" src="http://fsharp.github.io/FAKE/content/tips.js"></script>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="masthead">
<ul class="nav nav-pills pull-right">
<li><a href="http://fsharp.org">fsharp.org</a></li>
<li><a href="http://github.com/fsharp/fake">github page</a></li>
</ul>
<h3 class="muted">FAKE - F# Make</h3>
</div>
<hr />
<div class="row">
<div class="span9" id="main">
<h1>IISExpress</h1>
<div class="xmldoc">
<p>Contains tasks to host webprojects in IIS Express.</p>
</div>
<!-- Render nested types and modules, if there are any -->
<h2>Nested types and modules</h2>
<div>
<table class="table table-bordered type-list">
<thead>
<tr><td>Type</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td class="type-name">
<a href="fake-iisexpress-iisexpressoptions.html">IISExpressOptions</a>
</td>
<td class="xmldoc"><p>Options for using IISExpress</p>
</td>
</tr>
</tbody>
</table>
</div>
<h3>Functions and values</h3>
<table class="table table-bordered member-list">
<thead>
<tr><td>Function or value</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '11', 11)" onmouseover="showTip(event, '11', 11)">
createConfigFile (...)
</code>
<div class="tip" id="11">
<strong>Signature:</strong>(name:'?6085 * siteId:int * templateFileName:string * path:string * hostName:string * port:int) -> string<br />
<strong>Type parameters:</strong> '?6085 </div>
</td>
<td class="xmldoc">
<p>Create a IISExpress config file from a given template</p>
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/Fake.IIS/IISExpress.fs#L24-24" class="github-link">Go to GitHub source</a>
</td>
</tr>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '12', 12)" onmouseover="showTip(event, '12', 12)">
HostWebsite (...)
</code>
<div class="tip" id="12">
<strong>Signature:</strong>setParams:(IISExpressOptions -> IISExpressOptions) -> configFileName:string -> siteId:int -> Process<br />
</div>
</td>
<td class="xmldoc">
<p>This task starts the given site in IISExpress with the given ConfigFile.</p>
<h2>Parameters</h2>
<ul>
<li><code>setParams</code> - Function used to overwrite the default parameters.</li>
<li><code>configFileName</code> - The file name of the IISExpress configfile.</li>
<li><code>siteId</code> - The id (in the config file) of the website to run.</li>
</ul>
<h2>Sample</h2>
<pre><code> HostWebsite (fun p -> { p with ToolPath = "iisexpress.exe" }) "configfile.config" 1
</code></pre>
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/Fake.IIS/IISExpress.fs#L65-65" class="github-link">Go to GitHub source</a>
</td>
</tr>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '13', 13)" onmouseover="showTip(event, '13', 13)">
IISExpressDefaults
</code>
<div class="tip" id="13">
<strong>Signature:</strong>IISExpressOptions<br />
</div>
</td>
<td class="xmldoc">
<p>IISExpress default parameters - tries to locate the iisexpress.exe</p>
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/Fake.IIS/IISExpress.fs#L14-14" class="github-link">Go to GitHub source</a>
</td>
</tr>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '14', 14)" onmouseover="showTip(event, '14', 14)">
OpenUrlInBrowser url
</code>
<div class="tip" id="14">
<strong>Signature:</strong>url:string -> unit<br />
</div>
</td>
<td class="xmldoc">
<p>Opens the given url in the browser</p>
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/Fake.IIS/IISExpress.fs#L81-81" class="github-link">Go to GitHub source</a>
</td>
</tr>
<tr>
<td class="member-name">
<code onmouseout="hideTip(event, '15', 15)" onmouseover="showTip(event, '15', 15)">
OpenWebsiteInBrowser hostName port
</code>
<div class="tip" id="15">
<strong>Signature:</strong>hostName:string -> port:int -> unit<br />
</div>
</td>
<td class="xmldoc">
<p>Opens the given website in the browser</p>
<a href="https://github.com/fsharp/FAKE/blob/master/src/app/Fake.IIS/IISExpress.fs#L84-84" class="github-link">Go to GitHub source</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="span3">
<img src="http://fsharp.github.io/FAKE/pics/logo.png" alt="FAKE - F# Make" style="width:150px;margin-left: 20px;" />
<ul class="nav nav-list" id="menu" style="margin-top: 20px;">
<li class="nav-header">FAKE - F# Make</li>
<li><a href="http://fsharp.github.io/FAKE/index.html">Home page</a></li>
<li class="divider"></li>
<li><a href="https://nuget.org/packages/Fake">Get FAKE via NuGet</a></li>
<li><a href="http://github.com/fsharp/fake">Source Code on GitHub</a></li>
<li><a href="https://github.com/fsharp/FAKE/blob/develop/License.txt">License (MS-PL)</a></li>
<li><a href="http://fsharp.github.io/FAKE/users.html">Who is using FAKE?</a></li>
<li><a href="http://fsharp.github.io/FAKE/RELEASE_NOTES.html">Release Notes</a></li>
<li><a href="http://fsharp.github.io/FAKE/contributing.html">Contributing to FAKE</a></li>
<li><a href="http://stackoverflow.com/questions/tagged/f%23-fake">Ask a question</a></li>
<li class="nav-header">Articles</li>
<li><a href="http://fsharp.github.io/FAKE/gettingstarted.html">Getting started</a></li>
<li class="divider"></li>
<li><a href="http://fsharp.github.io/FAKE/nuget.html">NuGet package restore</a></li>
<li><a href="http://fsharp.github.io/FAKE/fxcop.html">Using FxCop in a build</a></li>
<li><a href="http://fsharp.github.io/FAKE/assemblyinfo.html">Generating AssemblyInfo</a></li>
<li><a href="http://fsharp.github.io/FAKE/create-nuget-package.html">Create NuGet packages</a></li>
<li><a href="http://fsharp.github.io/FAKE/specifictargets.html">Running specific targets</a></li>
<li><a href="http://fsharp.github.io/FAKE/commandline.html">Running FAKE from command line</a></li>
<li><a href="http://fsharp.github.io/FAKE/customtasks.html">Creating custom tasks</a></li>
<li><a href="http://fsharp.github.io/FAKE/teamcity.html">TeamCity integration</a></li>
<li><a href="http://fsharp.github.io/FAKE/canopy.html">Running canopy tests</a></li>
<li><a href="http://fsharp.github.io/FAKE/octopusdeploy.html">Octopus Deploy</a></li>
<li><a href="http://fsharp.github.io/FAKE/typescript.html">TypeScript support</a></li>
<li class="divider"></li>
<li><a href="http://fsharp.github.io/FAKE/deploy.html">Fake.Deploy</a></li>
<li class="nav-header">Documentation</li>
<li><a href="http://fsharp.github.io/FAKE/apidocs/index.html">API Reference</a></li>
</ul>
</div>
</div>
</div>
<a href="http://github.com/fsharp/fake"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
</body>
</html>
| Elders/Hermes | tools/FAKE/docs/apidocs/fake-iisexpress.html | HTML | apache-2.0 | 9,323 |
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.ui;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Weighted;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.IdeGlassPane;
import com.intellij.openapi.wm.IdeGlassPaneUtil;
import com.intellij.ui.ClickListener;
import com.intellij.ui.UIBundle;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.Activatable;
import com.intellij.util.ui.update.UiNotifyConnector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* @author Vladimir Kondratyev
*/
public class ThreeComponentsSplitter extends JPanel implements Disposable {
private int myDividerWidth;
/**
* /------/
* | 1 |
* This is vertical split |------|
* | 2 |
* /------/
*
* /-------/
* | | |
* This is horizontal split | 1 | 2 |
* | | |
* /-------/
*/
private boolean myVerticalSplit;
private boolean myHonorMinimumSize = false;
private final Divider myFirstDivider;
private final Divider myLastDivider;
@Nullable private JComponent myFirstComponent;
@Nullable private JComponent myInnerComponent;
@Nullable private JComponent myLastComponent;
private int myFirstSize = 0;
private int myLastSize = 0;
private int myMinSize = 0;
private boolean myShowDividerControls;
private int myDividerZone;
private class MyFocusTraversalPolicy extends FocusTraversalPolicy {
@Override
public Component getComponentAfter(Container aContainer, Component aComponent) {
if (aComponent == myFirstComponent) {
return findChildToFocus(myInnerComponent);
}
if (aComponent == myInnerComponent) {
return findChildToFocus(myLastComponent);
}
return findChildToFocus(myFirstComponent);
}
@Override
public Component getComponentBefore(Container aContainer, Component aComponent) {
if (aComponent == myInnerComponent) {
return findChildToFocus(myFirstComponent);
}
if (aComponent == myLastComponent) {
return findChildToFocus(myInnerComponent);
}
return findChildToFocus(myFirstComponent);
}
@Override
public Component getFirstComponent(Container aContainer) {
return findChildToFocus(myFirstComponent);
}
@Override
public Component getLastComponent(Container aContainer) {
return findChildToFocus(myLastComponent);
}
@Override
public Component getDefaultComponent(Container aContainer) {
return findChildToFocus(myInnerComponent);
}
Component findChildToFocus (Component component) {
if (component instanceof JPanel) {
JPanel container = (JPanel)component;
final FocusTraversalPolicy policy = container.getFocusTraversalPolicy();
if (policy == null) {
return container;
}
final Component defaultComponent = policy.getDefaultComponent(container);
if (defaultComponent == null) {
return container;
}
return policy.getDefaultComponent(container);
}
return component;
}
}
/**
* Creates horizontal split with proportion equals to .5f
*/
public ThreeComponentsSplitter() {
this(false);
}
public ThreeComponentsSplitter(boolean vertical) {
this(vertical, false);
}
public ThreeComponentsSplitter(boolean vertical, boolean onePixelDividers) {
myVerticalSplit = vertical;
myShowDividerControls = false;
myFirstDivider = new Divider(true, onePixelDividers);
Disposer.register(this, myFirstDivider);
myLastDivider = new Divider(false, onePixelDividers);
Disposer.register(this, myLastDivider);
myDividerWidth = onePixelDividers ? 1 : 7;
if (onePixelDividers) {
Color bg = UIUtil.CONTRAST_BORDER_COLOR;
myFirstDivider.setBackground(bg);
myLastDivider.setBackground(bg);
}
setFocusCycleRoot(true);
setFocusTraversalPolicy(new MyFocusTraversalPolicy());
setFocusable(false);
setOpaque(false);
add(myFirstDivider);
add(myLastDivider);
}
public void setShowDividerControls(boolean showDividerControls) {
myShowDividerControls = showDividerControls;
setOrientation(myVerticalSplit);
}
public void setDividerMouseZoneSize(int size) {
myDividerZone = JBUI.scale(size);
}
public boolean isHonorMinimumSize() {
return myHonorMinimumSize;
}
public void setHonorComponentsMinimumSize(boolean honorMinimumSize) {
myHonorMinimumSize = honorMinimumSize;
}
public boolean isVisible() {
return super.isVisible() && (firstVisible() || innerVisible() || lastVisible());
}
private boolean lastVisible() {
return !Splitter.isNull(myLastComponent) && myLastComponent.isVisible();
}
private boolean innerVisible() {
return !Splitter.isNull(myInnerComponent) && myInnerComponent.isVisible();
}
private boolean firstVisible() {
return !Splitter.isNull(myFirstComponent) && myFirstComponent.isVisible();
}
private int visibleDividersCount() {
int count = 0;
if (firstDividerVisible()) count++;
if (lastDividerVisible()) count++;
return count;
}
private boolean firstDividerVisible() {
return firstVisible() && innerVisible() || firstVisible() && lastVisible() && !innerVisible();
}
private boolean lastDividerVisible() {
return innerVisible() && lastVisible();
}
public Dimension getMinimumSize() {
if (isHonorMinimumSize()) {
final int dividerWidth = getDividerWidth();
final Dimension firstSize = myFirstComponent != null ? myFirstComponent.getMinimumSize() : JBUI.emptySize();
final Dimension lastSize = myLastComponent != null ? myLastComponent.getMinimumSize() : JBUI.emptySize();
final Dimension innerSize = myInnerComponent != null ? myInnerComponent.getMinimumSize() : JBUI.emptySize();
if (getOrientation()) {
int width = Math.max(firstSize.width, Math.max(lastSize.width, innerSize.width));
int height = visibleDividersCount() * dividerWidth;
height += firstSize.height;
height += lastSize.height;
height += innerSize.height;
return new Dimension(width, height);
}
else {
int heigth = Math.max(firstSize.height, Math.max(lastSize.height, innerSize.height));
int width = visibleDividersCount() * dividerWidth;
width += firstSize.width;
width += lastSize.width;
width += innerSize.width;
return new Dimension(width, heigth);
}
}
return super.getMinimumSize();
}
public void doLayout() {
final int width = getWidth();
final int height = getHeight();
Rectangle firstRect = new Rectangle();
Rectangle firstDividerRect = new Rectangle();
Rectangle lastDividerRect = new Rectangle();
Rectangle lastRect = new Rectangle();
Rectangle innerRect = new Rectangle();
final int componentSize = getOrientation() ? height : width;
int dividerWidth = getDividerWidth();
int dividersCount = visibleDividersCount();
int firstCompontSize;
int lastComponentSize;
int innerComponentSize;
if(componentSize <= dividersCount * dividerWidth) {
firstCompontSize = 0;
lastComponentSize = 0;
innerComponentSize = 0;
dividerWidth = componentSize;
}
else {
firstCompontSize = getFirstSize();
lastComponentSize = getLastSize();
int sizeLack = firstCompontSize + lastComponentSize - (componentSize - dividersCount * dividerWidth - myMinSize);
if (sizeLack > 0) {
// Lacking size. Reduce first & last component's size, inner -> MIN_SIZE
double firstSizeRatio = (double)firstCompontSize / (firstCompontSize + lastComponentSize);
if (firstCompontSize > 0) {
firstCompontSize -= sizeLack * firstSizeRatio;
firstCompontSize = Math.max(myMinSize, firstCompontSize);
}
if (lastComponentSize > 0) {
lastComponentSize -= sizeLack * (1 - firstSizeRatio);
lastComponentSize = Math.max(myMinSize, lastComponentSize);
}
innerComponentSize = getMinSize(myInnerComponent);
}
else {
innerComponentSize = Math.max(getMinSize(myInnerComponent), componentSize - dividersCount * dividerWidth - getFirstSize() - getLastSize());
}
if (!innerVisible()) {
lastComponentSize += innerComponentSize;
innerComponentSize = 0;
if (!lastVisible()) {
firstCompontSize = componentSize;
}
}
}
if (getOrientation()) {
int space = firstCompontSize;
firstRect.setBounds(0, 0, width, firstCompontSize);
if (firstDividerVisible()) {
firstDividerRect.setBounds(0, space, width, dividerWidth);
space += dividerWidth;
}
innerRect.setBounds(0, space, width, innerComponentSize);
space += innerComponentSize;
if (lastDividerVisible()) {
lastDividerRect.setBounds(0, space, width, dividerWidth);
space += dividerWidth;
}
lastRect.setBounds(0, space, width, lastComponentSize);
}
else {
int space = firstCompontSize;
firstRect.setBounds(0, 0, firstCompontSize, height);
if (firstDividerVisible()) {
firstDividerRect.setBounds(space, 0, dividerWidth, height);
space += dividerWidth;
}
innerRect.setBounds(space, 0, innerComponentSize, height);
space += innerComponentSize;
if (lastDividerVisible()) {
lastDividerRect.setBounds(space, 0, dividerWidth, height);
space += dividerWidth;
}
lastRect.setBounds(space, 0, lastComponentSize, height);
}
myFirstDivider.setVisible(firstDividerVisible());
myFirstDivider.setBounds(firstDividerRect);
myFirstDivider.doLayout();
myLastDivider.setVisible(lastDividerVisible());
myLastDivider.setBounds(lastDividerRect);
myLastDivider.doLayout();
validateIfNeeded(myFirstComponent, firstRect);
validateIfNeeded(myInnerComponent, innerRect);
validateIfNeeded(myLastComponent, lastRect);
}
private static void validateIfNeeded(final JComponent c, final Rectangle rect) {
if (!Splitter.isNull(c)) {
if (!c.getBounds().equals(rect)) {
c.setBounds(rect);
c.revalidate();
}
} else {
Splitter.hideNull(c);
}
}
public int getDividerWidth() {
return myDividerWidth;
}
public void setDividerWidth(int width) {
if (width < 0) {
throw new IllegalArgumentException("Wrong divider width: " + width);
}
if (myDividerWidth != width) {
myDividerWidth = width;
doLayout();
repaint();
}
}
/**
* @return <code>true</code> if splitter has vertical orientation, <code>false</code> otherwise
*/
public boolean getOrientation() {
return myVerticalSplit;
}
/**
* @param verticalSplit <code>true</code> means that splitter will have vertical split
*/
public void setOrientation(boolean verticalSplit) {
myVerticalSplit = verticalSplit;
myFirstDivider.setOrientation(verticalSplit);
myLastDivider.setOrientation(verticalSplit);
doLayout();
repaint();
}
@Nullable
public JComponent getFirstComponent() {
return myFirstComponent;
}
/**
* Sets component which is located as the "first" splitted area. The method doesn't validate and
* repaint the splitter. If there is already
*
*/
public void setFirstComponent(@Nullable JComponent component) {
if (myFirstComponent != component) {
if (myFirstComponent != null) {
remove(myFirstComponent);
}
myFirstComponent = component;
if (myFirstComponent != null) {
add(myFirstComponent);
myFirstComponent.invalidate();
}
}
}
@Nullable
public JComponent getLastComponent() {
return myLastComponent;
}
/**
* Sets component which is located as the "secont" splitted area. The method doesn't validate and
* repaint the splitter.
*
*/
public void setLastComponent(@Nullable JComponent component) {
if (myLastComponent != component) {
if (myLastComponent != null) {
remove(myLastComponent);
}
myLastComponent = component;
if (myLastComponent != null) {
add(myLastComponent);
myLastComponent.invalidate();
}
}
}
@Nullable
public JComponent getInnerComponent() {
return myInnerComponent;
}
/**
* Sets component which is located as the "inner" splitted area. The method doesn't validate and
* repaint the splitter.
*
*/
public void setInnerComponent(@Nullable JComponent component) {
if (myInnerComponent != component) {
if (myInnerComponent != null) {
remove(myInnerComponent);
}
myInnerComponent = component;
if (myInnerComponent != null) {
add(myInnerComponent);
myInnerComponent.invalidate();
}
}
}
public void setMinSize(int minSize) {
myMinSize = Math.max(0, minSize);
doLayout();
repaint();
}
public void setFirstSize(final int size) {
myFirstSize = size;
doLayout();
repaint();
}
public void setLastSize(final int size) {
myLastSize = size;
doLayout();
repaint();
}
public int getFirstSize() {
return firstVisible() ? myFirstSize : 0;
}
public int getLastSize() {
return lastVisible() ? myLastSize : 0;
}
public int getMinSize(boolean first) {
return getMinSize(first? myFirstComponent : myLastComponent);
}
public int getMaxSize(boolean first) {
final int size = getOrientation() ? this.getHeight() : this.getWidth();
return size - (first? myLastSize: myFirstSize) - myMinSize;
}
private int getMinSize(JComponent component) {
if (isHonorMinimumSize()) {
if (component != null && myFirstComponent != null && myFirstComponent.isVisible() && myLastComponent != null && myLastComponent.isVisible()) {
if (getOrientation()) {
return component.getMinimumSize().height;
}
else {
return component.getMinimumSize().width;
}
}
}
return myMinSize;
}
@Override
public void dispose() {
myLastComponent = null;
myFirstComponent = null;
myInnerComponent = null;
removeAll();
Container container = getParent();
if (container != null) {
container.remove(this);
}
}
private class Divider extends JPanel implements Disposable {
private final boolean myIsOnePixel;
protected boolean myDragging;
protected Point myPoint;
private final boolean myIsFirst;
@Override
public void paint(Graphics g) {
super.paint(g);
}
private IdeGlassPane myGlassPane;
private class MyMouseAdapter extends MouseAdapter implements Weighted {
@Override
public void mousePressed(MouseEvent e) {
_processMouseEvent(e);
}
@Override
public void mouseReleased(MouseEvent e) {
_processMouseEvent(e);
}
@Override
public void mouseMoved(MouseEvent e) {
_processMouseMotionEvent(e);
}
@Override
public void mouseDragged(MouseEvent e) {
_processMouseMotionEvent(e);
}
@Override
public double getWeight() {
return 1;
}
private void _processMouseMotionEvent(MouseEvent e) {
MouseEvent event = getTargetEvent(e);
if (event == null) {
myGlassPane.setCursor(null, myListener);
return;
}
processMouseMotionEvent(event);
if (event.isConsumed()) {
e.consume();
}
}
private void _processMouseEvent(MouseEvent e) {
MouseEvent event = getTargetEvent(e);
if (event == null) {
myGlassPane.setCursor(null, myListener);
return;
}
processMouseEvent(event);
if (event.isConsumed()) {
e.consume();
}
}
}
private final MouseAdapter myListener = new MyMouseAdapter();
private MouseEvent getTargetEvent(MouseEvent e) {
return SwingUtilities.convertMouseEvent(e.getComponent(), e, this);
}
private boolean myWasPressedOnMe;
public Divider(boolean isFirst, boolean isOnePixel) {
super(new GridBagLayout());
myIsOnePixel = isOnePixel;
setFocusable(false);
enableEvents(MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK);
myIsFirst = isFirst;
setOrientation(myVerticalSplit);
new UiNotifyConnector.Once(this, new Activatable.Adapter() {
@Override
public void showNotify() {
init();
}
});
}
private boolean isInside(Point p) {
if (!isVisible()) return false;
int dndOff = myIsOnePixel ? JBUI.scale(Registry.intValue("ide.splitter.mouseZone")) / 2 : 0;
if (myVerticalSplit) {
if (p.x >= 0 && p.x < getWidth()) {
if (getHeight() > 0) {
return p.y >= -dndOff && p.y < getHeight() + dndOff;
}
else {
return p.y >= -myDividerZone / 2 && p.y <= myDividerZone / 2;
}
}
}
else {
if (p.y >= 0 && p.y < getHeight()) {
if (getWidth() > 0) {
return p.x >= -dndOff && p.x < getWidth() + dndOff;
}
else {
return p.x >= -myDividerZone / 2 && p.x <= myDividerZone / 2;
}
}
}
return false;
}
private void init() {
myGlassPane = IdeGlassPaneUtil.find(this);
myGlassPane.addMouseMotionPreprocessor(myListener, this);
myGlassPane.addMousePreprocessor(myListener, this);
}
public void dispose() {
}
private void setOrientation(boolean isVerticalSplit) {
removeAll();
if (!myShowDividerControls) {
return;
}
int xMask = isVerticalSplit ? 1 : 0;
int yMask = isVerticalSplit ? 0 : 1;
Icon glueIcon = isVerticalSplit ? AllIcons.General.SplitGlueV : AllIcons.General.SplitCenterH;
int glueFill = isVerticalSplit ? GridBagConstraints.VERTICAL : GridBagConstraints.HORIZONTAL;
add(new JLabel(glueIcon),
new GridBagConstraints(0, 0, 1, 1, 0, 0, isVerticalSplit ? GridBagConstraints.EAST : GridBagConstraints.NORTH, glueFill, new Insets(0, 0, 0, 0), 0, 0));
JLabel splitDownlabel = new JLabel(isVerticalSplit ? AllIcons.General.SplitDown : AllIcons.General.SplitRight);
splitDownlabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
splitDownlabel.setToolTipText(isVerticalSplit ? UIBundle.message("splitter.down.tooltip.text") : UIBundle
.message("splitter.right.tooltip.text"));
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
if (myInnerComponent != null) {
final int income = myVerticalSplit ? myInnerComponent.getHeight() : myInnerComponent.getWidth();
if (myIsFirst) {
setFirstSize(myFirstSize + income);
}
else {
setLastSize(myLastSize + income);
}
}
return true;
}
}.installOn(splitDownlabel);
add(splitDownlabel,
new GridBagConstraints(isVerticalSplit ? 1 : 0,
isVerticalSplit ? 0 : 5,
1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
//
add(new JLabel(glueIcon),
new GridBagConstraints(2 * xMask, 2 * yMask, 1, 1, 0, 0, GridBagConstraints.CENTER, glueFill, new Insets(0, 0, 0, 0), 0, 0));
JLabel splitCenterlabel = new JLabel(isVerticalSplit ? AllIcons.General.SplitCenterV : AllIcons.General.SplitCenterH);
splitCenterlabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
splitCenterlabel.setToolTipText(UIBundle.message("splitter.center.tooltip.text"));
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
center();
return true;
}
}.installOn(splitCenterlabel);
add(splitCenterlabel,
new GridBagConstraints(3 * xMask, 3 * yMask, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
add(new JLabel(glueIcon),
new GridBagConstraints(4 * xMask, 4 * yMask, 1, 1, 0, 0, GridBagConstraints.CENTER, glueFill, new Insets(0, 0, 0, 0), 0, 0));
//
JLabel splitUpLabel = new JLabel(isVerticalSplit ? AllIcons.General.SplitUp : AllIcons.General.SplitLeft);
splitUpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
splitUpLabel.setToolTipText(isVerticalSplit ? UIBundle.message("splitter.up.tooltip.text") : UIBundle
.message("splitter.left.tooltip.text"));
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
if (myInnerComponent != null) {
final int income = myVerticalSplit ? myInnerComponent.getHeight() : myInnerComponent.getWidth();
if (myIsFirst) {
setFirstSize(myFirstSize + income);
}
else {
setLastSize(myLastSize + income);
}
}
return true;
}
}.installOn(splitUpLabel);
add(splitUpLabel,
new GridBagConstraints(isVerticalSplit ? 5 : 0,
isVerticalSplit ? 0 : 1,
1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
add(new JLabel(glueIcon),
new GridBagConstraints(6 * xMask, 6 * yMask, 1, 1, 0, 0,
isVerticalSplit ? GridBagConstraints.WEST : GridBagConstraints.SOUTH, glueFill, new Insets(0, 0, 0, 0), 0, 0));
}
private void center() {
if (myInnerComponent != null) {
final int total = myFirstSize + (myVerticalSplit ? myInnerComponent.getHeight() : myInnerComponent.getWidth());
if (myIsFirst) {
setFirstSize(total / 2);
}
else {
setLastSize(total / 2);
}
}
}
protected void processMouseMotionEvent(MouseEvent e) {
super.processMouseMotionEvent(e);
if (!isShowing()) return;
if (MouseEvent.MOUSE_DRAGGED == e.getID() && myWasPressedOnMe) {
myDragging = true;
setCursor(getResizeCursor());
if (myGlassPane != null) {
myGlassPane.setCursor(getResizeCursor(), myListener);
}
myPoint = SwingUtilities.convertPoint(this, e.getPoint(), ThreeComponentsSplitter.this);
final int size = getOrientation() ? ThreeComponentsSplitter.this.getHeight() : ThreeComponentsSplitter.this.getWidth();
if (getOrientation()) {
if (size > 0 || myDividerZone > 0) {
if (myIsFirst) {
setFirstSize(Math.min(size - myLastSize - getMinSize(myInnerComponent) - getDividerWidth() * visibleDividersCount(), Math.max(getMinSize(myFirstComponent), myPoint.y)));
}
else {
setLastSize(Math.min(size - myFirstSize - getMinSize(myInnerComponent) - getDividerWidth() * visibleDividersCount(), Math.max(getMinSize(myLastComponent), size - myPoint.y - getDividerWidth())));
}
}
}
else {
if (size > 0 || myDividerZone > 0) {
if (myIsFirst) {
setFirstSize(Math.min(size - myLastSize - getMinSize(myInnerComponent) - getDividerWidth() * visibleDividersCount(), Math.max(getMinSize(myFirstComponent), myPoint.x)));
}
else {
setLastSize(Math.min(size - myFirstSize - getMinSize(myInnerComponent) - getDividerWidth() * visibleDividersCount(), Math.max(getMinSize(myLastComponent), size - myPoint.x - getDividerWidth())));
}
}
}
ThreeComponentsSplitter.this.doLayout();
} else if (MouseEvent.MOUSE_MOVED == e.getID()) {
if (myGlassPane != null) {
if (isInside(e.getPoint())) {
myGlassPane.setCursor(getResizeCursor(), myListener);
e.consume();
} else {
myGlassPane.setCursor(null, myListener);
}
}
}
if (myWasPressedOnMe) {
e.consume();
}
}
protected void processMouseEvent(MouseEvent e) {
super.processMouseEvent(e);
if (!isShowing()) {
return;
}
switch (e.getID()) {
case MouseEvent.MOUSE_ENTERED:
setCursor(getResizeCursor());
break;
case MouseEvent.MOUSE_EXITED:
if (!myDragging) {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
break;
case MouseEvent.MOUSE_PRESSED:
if (isInside(e.getPoint())) {
myWasPressedOnMe = true;
if (myGlassPane != null) {
myGlassPane.setCursor(getResizeCursor(), myListener);
}
e.consume();
} else {
myWasPressedOnMe = false;
}
break;
case MouseEvent.MOUSE_RELEASED:
if (myWasPressedOnMe) {
e.consume();
}
if (isInside(e.getPoint()) && myGlassPane != null) {
myGlassPane.setCursor(getResizeCursor(), myListener);
}
myWasPressedOnMe = false;
myDragging = false;
myPoint = null;
break;
case MouseEvent.MOUSE_CLICKED:
if (e.getClickCount() == 2) {
center();
}
break;
}
}
}
private Cursor getResizeCursor() {
return getOrientation() ? Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR) : Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
}
}
| youdonghai/intellij-community | platform/platform-api/src/com/intellij/openapi/ui/ThreeComponentsSplitter.java | Java | apache-2.0 | 26,904 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_111) on Wed Jan 04 22:31:26 EST 2017 -->
<title>org.drip.measure.continuousmarginal</title>
<meta name="date" content="2017-01-04">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../../../org/drip/measure/continuousmarginal/package-summary.html" target="classFrame">org.drip.measure.continuousmarginal</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="R1.html" title="class in org.drip.measure.continuousmarginal" target="classFrame">R1</a></li>
<li><a href="Rd.html" title="class in org.drip.measure.continuousmarginal" target="classFrame">Rd</a></li>
</ul>
</div>
</body>
</html>
| lakshmiDRIP/DRIP | Javadoc/org/drip/measure/continuousmarginal/package-frame.html | HTML | apache-2.0 | 967 |
# AUTOGENERATED FILE
FROM balenalib/am571x-evm-debian:sid-build
ENV GO_VERSION 1.16
RUN mkdir -p /usr/local/go \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/golang/v$GO_VERSION/go$GO_VERSION.linux-armv7hf.tar.gz" \
&& echo "5d2c637632fc23139c992e7f5adce1e46bccebd5a43fc90f797050ae71f46ab9 go$GO_VERSION.linux-armv7hf.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.linux-armv7hf.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.linux-armv7hf.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Sid \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.16 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/golang/am571x-evm/debian/sid/1.16/build/Dockerfile | Dockerfile | apache-2.0 | 2,018 |
import { Component } from '@angular/core';
@Component({
selector: 'cs-fancy-select',
templateUrl: 'fancy-select.component.html',
styleUrls: ['fancy-select.component.scss'],
})
export class FancySelectComponent {}
| bwsw/cloudstack-ui | src/app/shared/components/fancy-select/fancy-select.component.ts | TypeScript | apache-2.0 | 220 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Red Hat, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import unicode_literals
import mock
import requests
GITHUB_TRACKER = "dci.trackers.github.requests"
BUGZILLA_TRACKER = "dci.trackers.bugzilla.requests"
def test_attach_issue_to_job(user, job_user_id, topic_user_id):
with mock.patch(GITHUB_TRACKER, spec=requests) as mock_github_request:
mock_github_result = mock.Mock()
mock_github_request.get.return_value = mock_github_result
mock_github_result.status_code = 200
mock_github_result.json.return_value = {
"number": 1, # issue_id
"title": "Create a GET handler for /componenttype/<ct_name>",
"user": {"login": "Spredzy"}, # reporter
"assignee": None,
"state": "closed", # status
"product": "redhat-cip",
"component": "dci-control-server",
"created_at": "2015-12-09T09:29:26Z",
"updated_at": "2015-12-18T15:19:41Z",
"closed_at": "2015-12-18T15:19:41Z",
}
data = {
"url": "https://github.com/redhat-cip/dci-control-server/issues/1",
"topic_id": topic_user_id,
}
issue = user.post("/api/v1/jobs/%s/issues" % job_user_id, data=data).data
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data
assert result["issues"][0]["id"] == issue["issue"]["id"]
assert result["issues"][0]["url"] == data["url"]
def test_attach_issue_to_component(admin, user, topic_user_id):
with mock.patch(GITHUB_TRACKER, spec=requests) as mock_github_request:
data = {
"name": "pname",
"type": "gerrit_review",
"url": "http://example.com/",
"topic_id": topic_user_id,
"state": "active",
}
pc = admin.post("/api/v1/components", data=data).data
component_id = pc["component"]["id"]
gc = user.get("/api/v1/components/%s" % component_id).data
assert gc["component"]["name"] == "pname"
assert gc["component"]["state"] == "active"
mock_github_result = mock.Mock()
mock_github_request.get.return_value = mock_github_result
mock_github_result.status_code = 200
mock_github_result.json.return_value = {
"number": 1, # issue_id
"title": "Create a GET handler for /componenttype/<ct_name>",
"user": {"login": "Spredzy"}, # reporter
"assignee": None,
"state": "closed", # status
"product": "redhat-cip",
"component": "dci-control-server",
"created_at": "2015-12-09T09:29:26Z",
"updated_at": "2015-12-18T15:19:41Z",
"closed_at": "2015-12-18T15:19:41Z",
}
data = {
"url": "https://github.com/redhat-cip/dci-control-server/issues/1",
"topic_id": topic_user_id,
}
admin.post("/api/v1/components/%s/issues" % component_id, data=data)
result = user.get("/api/v1/components/%s/issues" % component_id).data
assert result["issues"][0]["url"] == data["url"]
def test_attach_invalid_issue(admin, job_user_id, topic_user_id):
data = {"url": '<script>alert("booo")</script>', "topic_id": topic_user_id}
r = admin.post("/api/v1/jobs/%s/issues" % job_user_id, data=data)
assert r.status_code == 400
def test_unattach_issue_from_job(user, job_user_id, topic_user_id):
with mock.patch(GITHUB_TRACKER, spec=requests) as mock_github_request:
mock_github_result = mock.Mock()
mock_github_request.get.return_value = mock_github_result
mock_github_result.status_code = 200
mock_github_result.json.return_value = {
"number": 1, # issue_id
"title": "Create a GET handler for /componenttype/<ct_name>",
"user": {"login": "Spredzy"}, # reporter
"assignee": None,
"state": "closed", # status
"product": "redhat-cip",
"component": "dci-control-server",
"created_at": "2015-12-09T09:29:26Z",
"updated_at": "2015-12-18T15:19:41Z",
"closed_at": "2015-12-18T15:19:41Z",
}
data = {
"url": "https://github.com/redhat-cip/dci-control-server/issues/1",
"topic_id": topic_user_id,
}
result = user.post("/api/v1/jobs/%s/issues" % job_user_id, data=data)
issue_id = result.data["issue"]["id"]
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data
assert result["_meta"]["count"] == 1
user.delete("/api/v1/jobs/%s/issues/%s" % (job_user_id, issue_id))
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data
assert result["_meta"]["count"] == 0
def test_unattach_issue_from_component(admin, user, topic_user_id):
with mock.patch(GITHUB_TRACKER, spec=requests) as mock_github_request:
data = {
"name": "pname",
"type": "gerrit_review",
"url": "http://example.com/",
"topic_id": topic_user_id,
"state": "active",
}
pc = admin.post("/api/v1/components", data=data).data
component_id = pc["component"]["id"]
gc = user.get("/api/v1/components/%s" % component_id).data
assert gc["component"]["name"] == "pname"
assert gc["component"]["state"] == "active"
mock_github_result = mock.Mock()
mock_github_request.get.return_value = mock_github_result
mock_github_result.status_code = 200
mock_github_result.json.return_value = {
"number": 1, # issue_id
"title": "Create a GET handler for /componenttype/<ct_name>",
"user": {"login": "Spredzy"}, # reporter
"assignee": None,
"state": "closed", # status
"product": "redhat-cip",
"component": "dci-control-server",
"created_at": "2015-12-09T09:29:26Z",
"updated_at": "2015-12-18T15:19:41Z",
"closed_at": "2015-12-18T15:19:41Z",
}
data = {
"url": "https://github.com/redhat-cip/dci-control-server/issues/1",
"topic_id": topic_user_id,
}
result = admin.post("/api/v1/components/%s/issues" % component_id, data=data)
issue_id = result.data["issue"]["id"]
result = user.get("/api/v1/components/%s/issues" % component_id).data
assert result["_meta"]["count"] == 1
user.delete("/api/v1/components/%s/issues/%s" % (component_id, issue_id))
result = user.get("/api/v1/components/%s/issues" % component_id).data
assert result["_meta"]["count"] == 0
def test_github_tracker(user, job_user_id, topic_user_id):
with mock.patch(GITHUB_TRACKER, spec=requests) as mock_github_request:
mock_github_result = mock.Mock()
mock_github_request.get.return_value = mock_github_result
mock_github_result.status_code = 200
mock_github_result.json.return_value = {
"number": 1, # issue_id
"title": "Create a GET handler for /componenttype/<ct_name>",
"user": {"login": "Spredzy"}, # reporter
"assignee": None,
"state": "closed", # status
"product": "redhat-cip",
"component": "dci-control-server",
"created_at": "2015-12-09T09:29:26Z",
"updated_at": "2015-12-18T15:19:41Z",
"closed_at": "2015-12-18T15:19:41Z",
}
data = {
"url": "https://github.com/redhat-cip/dci-control-server/issues/1",
"topic_id": topic_user_id,
}
user.post("/api/v1/jobs/%s/issues" % job_user_id, data=data)
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data["issues"][0]
assert result["status_code"] == 200
assert result["issue_id"] == 1
assert result["title"] == ("Create a GET handler for /componenttype/<ct_name>")
assert result["reporter"] == "Spredzy"
assert result["status"] == "closed"
assert result["product"] == "redhat-cip"
assert result["component"] == "dci-control-server"
assert result["created_at"] == "2015-12-09T09:29:26Z"
assert result["updated_at"] == "2015-12-18T15:19:41Z"
assert result["closed_at"] == "2015-12-18T15:19:41Z"
assert result["assignee"] is None
def test_github_tracker_with_private_issue(user, job_user_id, topic_user_id):
with mock.patch(GITHUB_TRACKER, spec=requests) as mock_github_request:
mock_github_result = mock.Mock()
mock_github_request.get.return_value = mock_github_result
mock_github_result.status_code = 404
data = {
"url": "https://github.com/redhat-cip/dci-control-server/issues/1",
"topic_id": topic_user_id,
}
user.post("/api/v1/jobs/%s/issues" % job_user_id, data=data)
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data["issues"][0]
assert result["status_code"] == 404
assert result["issue_id"] == 1
assert result["title"] == "private issue"
assert result["reporter"] is None
assert result["status"] is None
assert result["product"] == "redhat-cip"
assert result["component"] == "dci-control-server"
assert result["created_at"] is None
assert result["updated_at"] is None
assert result["closed_at"] is None
assert result["assignee"] is None
def test_bugzilla_tracker(user, job_user_id, topic_user_id):
with mock.patch(BUGZILLA_TRACKER, spec=requests) as mock_bugzilla_request:
mock_bugzilla_result = mock.Mock()
mock_bugzilla_request.get.return_value = mock_bugzilla_result
mock_bugzilla_result.status_code = 200
mock_bugzilla_result.content = """
<bugzilla version="4.4.12051.1"
urlbase="https://bugzilla.redhat.com/"
maintainer="bugzilla-requests@redhat.com" >
<bug>
<bug_id>1184949</bug_id>
<creation_ts>2015-01-22 09:46:00 -0500</creation_ts>
<short_desc>Timeouts in haproxy for keystone can be</short_desc>
<delta_ts>2016-06-29 18:50:43 -0400</delta_ts>
<product>Red Hat OpenStack</product>
<component>rubygem-staypuft</component>
<bug_status>NEW</bug_status>
<reporter name="Alfredo Moralejo">amoralej</reporter>
<assigned_to name="Mike Burns">mburns</assigned_to>
</bug>
</bugzilla>
"""
data = {
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=1184949",
"topic_id": topic_user_id,
}
user.post("/api/v1/jobs/%s/issues" % job_user_id, data=data)
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data["issues"][0]
assert result["status_code"] == 200
assert result["issue_id"] == "1184949"
assert result["title"] == "Timeouts in haproxy for keystone can be"
assert result["reporter"] == "amoralej"
assert result["assignee"] == "mburns"
assert result["status"] == "NEW"
assert result["product"] == "Red Hat OpenStack"
assert result["component"] == "rubygem-staypuft"
assert result["created_at"] == "2015-01-22 09:46:00 -0500"
assert result["updated_at"] == "2016-06-29 18:50:43 -0400"
assert result["closed_at"] is None
def test_bugzilla_tracker_with_non_existent_issue(user, job_user_id, topic_user_id):
with mock.patch(BUGZILLA_TRACKER, spec=requests) as mock_bugzilla_request:
mock_bugzilla_result = mock.Mock()
mock_bugzilla_request.get.return_value = mock_bugzilla_result
mock_bugzilla_result.status_code = 400
data = {
"url": "https://bugzilla.redhat.com/show_bug.cgi?id=1184949",
"topic_id": topic_user_id,
}
user.post("/api/v1/jobs/%s/issues" % job_user_id, data=data)
result = user.get("/api/v1/jobs/%s/issues" % job_user_id).data["issues"][0]
assert result["status_code"] == 400
assert result["issue_id"] is None
assert result["title"] is None
assert result["reporter"] is None
assert result["assignee"] is None
assert result["status"] is None
assert result["product"] is None
assert result["component"] is None
assert result["created_at"] is None
assert result["updated_at"] is None
assert result["closed_at"] is None
def test_create_get_issues(user, topic_user_id):
issues = user.get("/api/v1/issues")
assert issues.data["issues"] == []
pissue = user.post(
"/api/v1/issues", data={"url": "http://bugzilla/42", "topic_id": topic_user_id}
)
assert pissue.status_code == 201
pissue_id1 = pissue.data["issue"]["id"]
pissue = user.post(
"/api/v1/issues", data={"url": "http://bugzilla/43", "topic_id": topic_user_id}
)
assert pissue.status_code == 201
pissue_id2 = pissue.data["issue"]["id"]
issues = user.get("/api/v1/issues")
assert len(issues.data["issues"]) == 2
assert set([pissue_id1, pissue_id2]) == {i["id"] for i in issues.data["issues"]}
g_issue_id1 = user.get("/api/v1/issues/%s" % pissue_id1)
assert g_issue_id1.status_code == 200
assert g_issue_id1.data["issue"]["url"] == "http://bugzilla/42"
g_issue_id2 = user.get("/api/v1/issues/%s" % pissue_id2)
assert g_issue_id2.status_code == 200
assert g_issue_id2.data["issue"]["url"] == "http://bugzilla/43"
def test_delete_issues(admin, user, topic_user_id):
pissue = user.post(
"/api/v1/issues", data={"url": "http://bugzilla/42", "topic_id": topic_user_id}
)
assert pissue.status_code == 201
pissue_id1 = pissue.data["issue"]["id"]
issues = user.get("/api/v1/issues")
assert len(issues.data["issues"]) == 1
pissue_etag = pissue.headers.get("ETag")
dissue = admin.delete(
"/api/v1/issues/%s" % pissue_id1, headers={"If-match": pissue_etag}
)
assert dissue.status_code == 204
issues = user.get("/api/v1/issues")
assert len(issues.data["issues"]) == 0
# test issues - tests
def test_crd_test_to_issue(admin, user, topic_user_id):
pissue = user.post(
"/api/v1/issues", data={"url": "http://bugzilla/42", "topic_id": topic_user_id}
)
pissue_id1 = pissue.data["issue"]["id"]
test = user.post("/api/v1/tests", data={"name": "pname1"})
test_id1 = test.data["test"]["id"]
# 0 tests from issues pissue_id1
issues_tests = user.get("/api/v1/issues/%s/tests" % pissue_id1)
assert len(issues_tests.data["tests"]) == 0
# associate test_id1 to issue pissue_id1
ptest = user.post(
"/api/v1/issues/%s/tests" % pissue_id1, data={"test_id": test_id1}
)
assert ptest.status_code == 201
issues_tests = user.get("/api/v1/issues/%s/tests" % pissue_id1)
assert len(issues_tests.data["tests"]) == 1
assert issues_tests.data["tests"][0]["id"] == test_id1
# remove test_id1 from issue pissue_id1
admin.delete("/api/v1/issues/%s/tests/%s" % (pissue_id1, test_id1))
issues_tests = user.get("/api/v1/issues/%s/tests" % pissue_id1)
assert len(issues_tests.data["tests"]) == 0
| redhat-cip/dci-control-server | tests/api/v1/test_issues.py | Python | apache-2.0 | 15,798 |
package com.example.android.sunshine.utilities;
import android.content.Context;
import android.util.Log;
import com.example.android.sunshine.R;
import com.example.android.sunshine.data.SunshinePreferences;
/**
* Contains useful utilities for a weather app, such as conversion between Celsius and Fahrenheit,
* from kph to mph, and from degrees to NSEW. It also contains the mapping of weather condition
* codes in OpenWeatherMap to strings. These strings are contained
*/
public final class SunshineWeatherUtils {
private static final String LOG_TAG = SunshineWeatherUtils.class.getSimpleName();
/**
* This method will convert a temperature from Celsius to Fahrenheit.
*
* @param temperatureInCelsius Temperature in degrees Celsius(°C)
*
* @return Temperature in degrees Fahrenheit (°F)
*/
private static double celsiusToFahrenheit(double temperatureInCelsius) {
double temperatureInFahrenheit = (temperatureInCelsius * 1.8) + 32;
return temperatureInFahrenheit;
}
/**
* Temperature data is stored in Celsius by our app. Depending on the user's preference,
* the app may need to display the temperature in Fahrenheit. This method will perform that
* temperature conversion if necessary. It will also format the temperature so that no
* decimal points show. Temperatures will be formatted to the following form: "21°"
*
* @param context Android Context to access preferences and resources
* @param temperature Temperature in degrees Celsius (°C)
*
* @return Formatted temperature String in the following form:
* "21°"
*/
public static String formatTemperature(Context context, double temperature) {
if (!SunshinePreferences.isMetric(context)) {
temperature = celsiusToFahrenheit(temperature);
}
int temperatureFormatResourceId = R.string.format_temperature;
/* For presentation, assume the user doesn't care about tenths of a degree. */
return String.format(context.getString(temperatureFormatResourceId), temperature);
}
/**
* This method will format the temperatures to be displayed in the
* following form: "HIGH° / LOW°"
*
* @param context Android Context to access preferences and resources
* @param high High temperature for a day in user's preferred units
* @param low Low temperature for a day in user's preferred units
*
* @return String in the form: "HIGH° / LOW°"
*/
public static String formatHighLows(Context context, double high, double low) {
long roundedHigh = Math.round(high);
long roundedLow = Math.round(low);
String formattedHigh = formatTemperature(context, roundedHigh);
String formattedLow = formatTemperature(context, roundedLow);
String highLowStr = formattedHigh + " / " + formattedLow;
return highLowStr;
}
/**
* This method uses the wind direction in degrees to determine compass direction as a
* String. (eg NW) The method will return the wind String in the following form: "2 km/h SW"
*
* @param context Android Context to access preferences and resources
* @param windSpeed Wind speed in kilometers / hour
* @param degrees Degrees as measured on a compass, NOT temperature degrees!
* See https://www.mathsisfun.com/geometry/degrees.html
*
* @return Wind String in the following form: "2 km/h SW"
*/
public static String getFormattedWind(Context context, float windSpeed, float degrees) {
int windFormat = R.string.format_wind_kmh;
if (!SunshinePreferences.isMetric(context)) {
windFormat = R.string.format_wind_mph;
windSpeed = .621371192237334f * windSpeed;
}
/*
* You know what's fun? Writing really long if/else statements with tons of possible
* conditions. Seriously, try it!
*/
String direction = "Unknown";
if (degrees >= 337.5 || degrees < 22.5) {
direction = "N";
} else if (degrees >= 22.5 && degrees < 67.5) {
direction = "NE";
} else if (degrees >= 67.5 && degrees < 112.5) {
direction = "E";
} else if (degrees >= 112.5 && degrees < 157.5) {
direction = "SE";
} else if (degrees >= 157.5 && degrees < 202.5) {
direction = "S";
} else if (degrees >= 202.5 && degrees < 247.5) {
direction = "SW";
} else if (degrees >= 247.5 && degrees < 292.5) {
direction = "W";
} else if (degrees >= 292.5 && degrees < 337.5) {
direction = "NW";
}
return String.format(context.getString(windFormat), windSpeed, direction);
}
/**
* Helper method to provide the string according to the weather
* condition id returned by the OpenWeatherMap call.
*
* @param context Android context
* @param weatherId from OpenWeatherMap API response
* See http://openweathermap.org/weather-conditions for a list of all IDs
*
* @return String for the weather condition, null if no relation is found.
*/
public static String getStringForWeatherCondition(Context context, int weatherId) {
int stringId;
if (weatherId >= 200 && weatherId <= 232) {
stringId = R.string.condition_2xx;
} else if (weatherId >= 300 && weatherId <= 321) {
stringId = R.string.condition_3xx;
} else switch (weatherId) {
case 500:
stringId = R.string.condition_500;
break;
case 501:
stringId = R.string.condition_501;
break;
case 502:
stringId = R.string.condition_502;
break;
case 503:
stringId = R.string.condition_503;
break;
case 504:
stringId = R.string.condition_504;
break;
case 511:
stringId = R.string.condition_511;
break;
case 520:
stringId = R.string.condition_520;
break;
case 531:
stringId = R.string.condition_531;
break;
case 600:
stringId = R.string.condition_600;
break;
case 601:
stringId = R.string.condition_601;
break;
case 602:
stringId = R.string.condition_602;
break;
case 611:
stringId = R.string.condition_611;
break;
case 612:
stringId = R.string.condition_612;
break;
case 615:
stringId = R.string.condition_615;
break;
case 616:
stringId = R.string.condition_616;
break;
case 620:
stringId = R.string.condition_620;
break;
case 621:
stringId = R.string.condition_621;
break;
case 622:
stringId = R.string.condition_622;
break;
case 701:
stringId = R.string.condition_701;
break;
case 711:
stringId = R.string.condition_711;
break;
case 721:
stringId = R.string.condition_721;
break;
case 731:
stringId = R.string.condition_731;
break;
case 741:
stringId = R.string.condition_741;
break;
case 751:
stringId = R.string.condition_751;
break;
case 761:
stringId = R.string.condition_761;
break;
case 762:
stringId = R.string.condition_762;
break;
case 771:
stringId = R.string.condition_771;
break;
case 781:
stringId = R.string.condition_781;
break;
case 800:
stringId = R.string.condition_800;
break;
case 801:
stringId = R.string.condition_801;
break;
case 802:
stringId = R.string.condition_802;
break;
case 803:
stringId = R.string.condition_803;
break;
case 804:
stringId = R.string.condition_804;
break;
case 900:
stringId = R.string.condition_900;
break;
case 901:
stringId = R.string.condition_901;
break;
case 902:
stringId = R.string.condition_902;
break;
case 903:
stringId = R.string.condition_903;
break;
case 904:
stringId = R.string.condition_904;
break;
case 905:
stringId = R.string.condition_905;
break;
case 906:
stringId = R.string.condition_906;
break;
case 951:
stringId = R.string.condition_951;
break;
case 952:
stringId = R.string.condition_952;
break;
case 953:
stringId = R.string.condition_953;
break;
case 954:
stringId = R.string.condition_954;
break;
case 955:
stringId = R.string.condition_955;
break;
case 956:
stringId = R.string.condition_956;
break;
case 957:
stringId = R.string.condition_957;
break;
case 958:
stringId = R.string.condition_958;
break;
case 959:
stringId = R.string.condition_959;
break;
case 960:
stringId = R.string.condition_960;
break;
case 961:
stringId = R.string.condition_961;
break;
case 962:
stringId = R.string.condition_962;
break;
default:
return context.getString(R.string.condition_unknown, weatherId);
}
return context.getString(stringId);
}
/**
* Helper method to provide the icon resource id according to the weather condition id returned
* by the OpenWeatherMap call. This method is very similar to
*
* {@link #getLargeArtResourceIdForWeatherCondition(int)}.
*
* The difference between these two methods is that this method provides smaller assets, used
* in the list item layout for a "future day", as well as
*
* @param weatherId from OpenWeatherMap API response
* See http://openweathermap.org/weather-conditions for a list of all IDs
*
* @return resource id for the corresponding icon. -1 if no relation is found.
*/
public static int getSmallArtResourceIdForWeatherCondition(int weatherId) {
/*
* Based on weather code data for Open Weather Map.
*/
if (weatherId >= 200 && weatherId <= 232) {
return R.drawable.ic_storm;
} else if (weatherId >= 300 && weatherId <= 321) {
return R.drawable.ic_light_rain;
} else if (weatherId >= 500 && weatherId <= 504) {
return R.drawable.ic_rain;
} else if (weatherId == 511) {
return R.drawable.ic_snow;
} else if (weatherId >= 520 && weatherId <= 531) {
return R.drawable.ic_rain;
} else if (weatherId >= 600 && weatherId <= 622) {
return R.drawable.ic_snow;
} else if (weatherId >= 701 && weatherId <= 761) {
return R.drawable.ic_fog;
} else if (weatherId == 761 || weatherId == 771 || weatherId == 781) {
return R.drawable.ic_storm;
} else if (weatherId == 800) {
return R.drawable.ic_clear;
} else if (weatherId == 801) {
return R.drawable.ic_light_clouds;
} else if (weatherId >= 802 && weatherId <= 804) {
return R.drawable.ic_cloudy;
} else if (weatherId >= 900 && weatherId <= 906) {
return R.drawable.ic_storm;
} else if (weatherId >= 958 && weatherId <= 962) {
return R.drawable.ic_storm;
} else if (weatherId >= 951 && weatherId <= 957) {
return R.drawable.ic_clear;
}
Log.e(LOG_TAG, "Unknown Weather: " + weatherId);
return R.drawable.ic_storm;
}
/**
* Helper method to provide the art resource ID according to the weather condition ID returned
* by the OpenWeatherMap call. This method is very similar to
*
* {@link #getSmallArtResourceIdForWeatherCondition(int)}.
*
* The difference between these two methods is that this method provides larger assets, used
* in the "today view" of the list, as well as in the DetailActivity.
*
* @param weatherId from OpenWeatherMap API response
* See http://openweathermap.org/weather-conditions for a list of all IDs
*
* @return resource ID for the corresponding icon. -1 if no relation is found.
*/
public static int getLargeArtResourceIdForWeatherCondition(int weatherId) {
/*
* Based on weather code data for Open Weather Map.
*/
if (weatherId >= 200 && weatherId <= 232) {
return R.drawable.art_storm;
} else if (weatherId >= 300 && weatherId <= 321) {
return R.drawable.art_light_rain;
} else if (weatherId >= 500 && weatherId <= 504) {
return R.drawable.art_rain;
} else if (weatherId == 511) {
return R.drawable.art_snow;
} else if (weatherId >= 520 && weatherId <= 531) {
return R.drawable.art_rain;
} else if (weatherId >= 600 && weatherId <= 622) {
return R.drawable.art_snow;
} else if (weatherId >= 701 && weatherId <= 761) {
return R.drawable.art_fog;
} else if (weatherId == 761 || weatherId == 771 || weatherId == 781) {
return R.drawable.art_storm;
} else if (weatherId == 800) {
return R.drawable.art_clear;
} else if (weatherId == 801) {
return R.drawable.art_light_clouds;
} else if (weatherId >= 802 && weatherId <= 804) {
return R.drawable.art_clouds;
} else if (weatherId >= 900 && weatherId <= 906) {
return R.drawable.art_storm;
} else if (weatherId >= 958 && weatherId <= 962) {
return R.drawable.art_storm;
} else if (weatherId >= 951 && weatherId <= 957) {
return R.drawable.art_clear;
}
Log.e(LOG_TAG, "Unknown Weather: " + weatherId);
return R.drawable.art_storm;
}
} | totoroNmei/android-Sunshine | app/src/main/java/com/example/android/sunshine/utilities/SunshineWeatherUtils.java | Java | apache-2.0 | 15,371 |
# Meliola conigera F. Stevens & Tehon SPECIES
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
Mycologia 18(1): 9 (1926)
#### Original name
Meliola conigera F. Stevens & Tehon
### Remarks
null | mdoering/backbone | life/Fungi/Ascomycota/Dothideomycetes/Meliolales/Meliolaceae/Meliola/Meliola conigera/README.md | Markdown | apache-2.0 | 220 |
@echo off
cd %~dp0
if /i "%1"=="help" goto help
if /i "%1"=="--help" goto help
if /i "%1"=="-help" goto help
if /i "%1"=="/help" goto help
if /i "%1"=="?" goto help
if /i "%1"=="-?" goto help
if /i "%1"=="--?" goto help
if /i "%1"=="/?" goto help
@rem Process arguments.
set config=Release
set target=Build
set target_arch=x86
set noprojgen=
set nobuild=
set nosign=
set nosnapshot=
set test_args=
set msi=
set upload=
set licensertf=
set jslint=
set buildnodeweak=
set noetw=
set noetw_msi_arg=
set noperfctr=
set noperfctr_msi_arg=
set i18n_arg=
set download_arg=
set release_urls_arg=
set build_release=
set enable_vtune_profiling=
set configure_flags=
:next-arg
if "%1"=="" goto args-done
if /i "%1"=="debug" set config=Debug&goto arg-ok
if /i "%1"=="release" set config=Release&goto arg-ok
if /i "%1"=="clean" set target=Clean&goto arg-ok
if /i "%1"=="ia32" set target_arch=x86&goto arg-ok
if /i "%1"=="x86" set target_arch=x86&goto arg-ok
if /i "%1"=="x64" set target_arch=x64&goto arg-ok
if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok
if /i "%1"=="nobuild" set nobuild=1&goto arg-ok
if /i "%1"=="nosign" set nosign=1&goto arg-ok
if /i "%1"=="nosnapshot" set nosnapshot=1&goto arg-ok
if /i "%1"=="noetw" set noetw=1&goto arg-ok
if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok
if /i "%1"=="licensertf" set licensertf=1&goto arg-ok
if /i "%1"=="test" set test_args=%test_args% sequential parallel message -J&set jslint=1&goto arg-ok
if /i "%1"=="test-ci" set test_args=%test_args% %test_ci_args% -p tap --logfile test.tap message sequential parallel&goto arg-ok
if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok
if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok
if /i "%1"=="test-gc" set test_args=%test_args% gc&set buildnodeweak=1&goto arg-ok
if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok
if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok
if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc internet pummel&set buildnodeweak=1&set jslint=1&goto arg-ok
if /i "%1"=="jslint" set jslint=1&goto arg-ok
if /i "%1"=="msi" set msi=1&set licensertf=1&set download_arg="--download=all"&set i18n_arg=small-icu&goto arg-ok
if /i "%1"=="build-release" set build_release=1&goto arg-ok
if /i "%1"=="upload" set upload=1&goto arg-ok
if /i "%1"=="small-icu" set i18n_arg=%1&goto arg-ok
if /i "%1"=="full-icu" set i18n_arg=%1&goto arg-ok
if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok
if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok
if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok
if /i "%1"=="enable-vtune" set enable_vtune_profiling="--enable-vtune-profiling"&goto arg-ok
echo Warning: ignoring invalid command line option `%1`.
:arg-ok
:arg-ok
shift
goto next-arg
:args-done
if defined build_release (
set config=Release
set msi=1
set licensertf=1
set download_arg="--download=all"
set i18n_arg=small-icu
)
if "%config%"=="Debug" set configure_flags=%configure_flags% --debug
if defined nosnapshot set configure_flags=%configure_flags% --without-snapshot
if defined noetw set configure_flags=%configure_flags% --without-etw& set noetw_msi_arg=/p:NoETW=1
if defined noperfctr set configure_flags=%configure_flags% --without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1
if defined release_urlbase set release_urlbase_arg=--release-urlbase=%release_urlbase%
if defined download_arg set configure_flags=%configure_flags% %download_arg%
if "%i18n_arg%"=="full-icu" set configure_flags=%configure_flags% --with-intl=full-icu
if "%i18n_arg%"=="small-icu" set configure_flags=%configure_flags% --with-intl=small-icu
if "%i18n_arg%"=="intl-none" set configure_flags=%configure_flags% --with-intl=none
if defined config_flags set configure_flags=%configure_flags% %config_flags%
if not exist "%~dp0deps\icu" goto no-depsicu
if "%target%"=="Clean" echo deleting %~dp0deps\icu
if "%target%"=="Clean" rmdir /S /Q %~dp0deps\icu
:no-depsicu
call :getnodeversion || exit /b 1
@rem Set environment for msbuild
@rem Look for Visual Studio 2015
echo Looking for Visual Studio 2015
if not defined VS140COMNTOOLS goto vc-set-2013
if not exist "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2013
echo Found Visual Studio 2015
if defined msi (
echo Looking for WiX installation for Visual Studio 2015...
if not exist "%WIX%\SDK\VS2015" (
echo Failed to find WiX install for Visual Studio 2015
echo VS2015 support for WiX is only present starting at version 3.10
goto vc-set-2013
)
)
if "%VCVARS_VER%" NEQ "140" (
call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat"
SET VCVARS_VER=140
)
if not defined VCINSTALLDIR goto vc-set-2013
set GYP_MSVS_VERSION=2015
set PLATFORM_TOOLSET=v140
goto msbuild-found
:vc-set-2013
@rem Look for Visual Studio 2013
echo Looking for Visual Studio 2013
if not defined VS120COMNTOOLS goto msbuild-not-found
if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
echo Found Visual Studio 2013
if defined msi (
echo Looking for WiX installation for Visual Studio 2013...
if not exist "%WIX%\SDK\VS2013" (
echo Failed to find WiX install for Visual Studio 2013
echo VS2013 support for WiX is only present starting at version 3.8
goto vc-set-2012
)
)
if "%VCVARS_VER%" NEQ "120" (
call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat"
SET VCVARS_VER=120
)
if not defined VCINSTALLDIR goto msbuild-not-found
set GYP_MSVS_VERSION=2013
set PLATFORM_TOOLSET=v120
goto msbuild-found
:msbuild-not-found
echo Failed to find Visual Studio installation.
goto exit
:wix-not-found
echo Build skipped. To generate installer, you need to install Wix.
goto run
:msbuild-found
:project-gen
@rem Skip project generation if requested.
if defined noprojgen goto msbuild
@rem Generate the VS project.
echo configure %configure_flags% %enable_vtune_profiling% --dest-cpu=%target_arch% --tag=%TAG%
python configure %configure_flags% %enable_vtune_profiling% --dest-cpu=%target_arch% --tag=%TAG%
if errorlevel 1 goto create-msvs-files-failed
if not exist node.sln goto create-msvs-files-failed
echo Project files generated.
:msbuild
@rem Skip build if requested.
if defined nobuild goto sign
@rem Build the sln with msbuild.
msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
if "%target%" == "Clean" goto exit
:sign
@rem Skip signing if the `nosign` option was specified.
if defined nosign goto licensertf
signtool sign /a /d "Node.js" /du "https://nodejs.org" /t http://timestamp.globalsign.com/scripts/timestamp.dll Release\node.exe
if errorlevel 1 echo Failed to sign exe&goto exit
:licensertf
@rem Skip license.rtf generation if not requested.
if not defined licensertf goto msi
%config%\node tools\license2rtf.js < LICENSE > %config%\license.rtf
if errorlevel 1 echo Failed to generate license.rtf&goto exit
:msi
@rem Skip msi generation if not requested
if not defined msi goto run
:msibuild
echo Building node-v%FULLVERSION%-%target_arch%.msi
msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%target_arch% /p:NodeVersion=%NODE_VERSION% /p:FullVersion=%FULLVERSION% /p:DistTypeDir=%DISTTYPEDIR% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
if defined nosign goto upload
signtool sign /a /d "Node.js" /du "https://nodejs.org" /t http://timestamp.globalsign.com/scripts/timestamp.dll node-v%FULLVERSION%-%target_arch%.msi
if errorlevel 1 echo Failed to sign msi&goto exit
:upload
@rem Skip upload if not requested
if not defined upload goto run
if not defined SSHCONFIG (
echo SSHCONFIG is not set for upload
exit /b 1
)
if not defined STAGINGSERVER set STAGINGSERVER=node-www
ssh -F %SSHCONFIG% %STAGINGSERVER% "mkdir -p nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%"
scp -F %SSHCONFIG% Release\node.exe %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%/node.exe
scp -F %SSHCONFIG% Release\node.lib %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%/node.lib
scp -F %SSHCONFIG% node-v%FULLVERSION%-%target_arch%.msi %STAGINGSERVER%:nodejs/%DISTTYPEDIR%/v%FULLVERSION%/
ssh -F %SSHCONFIG% %STAGINGSERVER% "touch nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-%target_arch%.msi.done nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%.done && chmod -R ug=rw-x+X,o=r+X nodejs/%DISTTYPEDIR%/v%FULLVERSION%/node-v%FULLVERSION%-%target_arch%.msi* nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%*"
:run
@rem Run tests if requested.
:build-node-weak
@rem Build node-weak if required
if "%buildnodeweak%"=="" goto run-tests
"%config%\node" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild --directory="%~dp0test\gc\node_modules\weak" --nodedir="%~dp0."
if errorlevel 1 goto build-node-weak-failed
goto run-tests
:build-node-weak-failed
echo Failed to build node-weak.
goto exit
:run-tests
if "%test_args%"=="" goto jslint
if "%config%"=="Debug" set test_args=--mode=debug %test_args%
if "%config%"=="Release" set test_args=--mode=release %test_args%
echo running 'cctest'
"%config%\cctest"
echo running 'python tools\test.py %test_args%'
python tools\test.py %test_args%
goto jslint
:jslint
if not defined jslint goto exit
echo running jslint
%config%\node tools\eslint\bin\eslint.js src lib test tools\eslint-rules --rulesdir tools\eslint-rules --reset --quiet
goto exit
:create-msvs-files-failed
echo Failed to create vc project files.
goto exit
:help
echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/intl-none] [nobuild] [nosign] [x86/x64] [download-all] [enable-vtune]
echo Examples:
echo vcbuild.bat : builds release build
echo vcbuild.bat debug : builds debug build
echo vcbuild.bat release msi : builds release build and MSI installer package
echo vcbuild.bat test : builds debug build and runs tests
echo vcbuild.bat build-release : builds the release distribution as used by nodejs.org
echo vcbuild.bat enable-vtune : builds nodejs with Intel Vtune profiling support to profile JavaScript
goto exit
:exit
goto :EOF
rem ***************
rem Subroutines
rem ***************
:getnodeversion
set NODE_VERSION=
set TAG=
set FULLVERSION=
for /F "usebackq tokens=*" %%i in (`python "%~dp0tools\getnodeversion.py"`) do set NODE_VERSION=%%i
if not defined NODE_VERSION (
echo Cannot determine current version of Node.js
exit /b 1
)
if not defined DISTTYPE set DISTTYPE=release
if "%DISTTYPE%"=="release" (
set FULLVERSION=%NODE_VERSION%
goto exit
)
if "%DISTTYPE%"=="custom" (
if not defined CUSTOMTAG (
echo "CUSTOMTAG is not set for DISTTYPE=custom"
exit /b 1
)
set TAG=%CUSTOMTAG%
)
if not "%DISTTYPE%"=="custom" (
if not defined DATESTRING (
echo "DATESTRING is not set for nightly"
exit /b 1
)
if not defined COMMIT (
echo "COMMIT is not set for nightly"
exit /b 1
)
if not "%DISTTYPE%"=="nightly" (
if not "%DISTTYPE%"=="next-nightly" (
echo "DISTTYPE is not release, custom, nightly or next-nightly"
exit /b 1
)
)
set TAG=%DISTTYPE%%DATESTRING%%COMMIT%
)
set FULLVERSION=%NODE_VERSION%-%TAG%
:exit
if not defined DISTTYPEDIR set DISTTYPEDIR=%DISTTYPE%
goto :EOF
| dreamllq/node | vcbuild.bat | Batchfile | apache-2.0 | 11,727 |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>垃圾回收</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Wu, Shanliang" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="../../css/main.css" />
<script type="text/javascript">
// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.add("code-highlighted");
target.classList.add("code-highlighted");
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.remove("code-highlighted");
target.classList.remove("code-highlighted");
}
}
/*]]>*///-->
// @license-end
</script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="taint_toleration.html"> UP </a>
|
<a accesskey="H" href="cluster.html"> HOME </a>
</div><div id="content">
<h1 class="title">垃圾回收</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org1bf52b5">Owner 和 Dependent</a></li>
<li><a href="#orga6e3b3f">控制垃圾收集器删除 Dependent</a>
<ul>
<li><a href="#org5311dc2">Background 级联删除</a></li>
<li><a href="#orgeb98a34">Foreground 级联删除</a></li>
<li><a href="#org2cf6980">设置级联删除策略</a></li>
</ul>
</li>
</ul>
</div>
</div>
<p>
Kubernetes 垃圾收集器的角色是删除指定的对象,这些对象曾经有但以后不再拥有 Owner 了
</p>
<pre class="example" id="org7e09e92">
注意:垃圾收集是 beta 特性,在 Kubernetes 1.4 及以上版本默认启用
</pre>
<div id="outline-container-org1bf52b5" class="outline-2">
<h2 id="org1bf52b5">Owner 和 Dependent</h2>
<div class="outline-text-2" id="text-org1bf52b5">
<p>
一些 Kubernetes 对象是其它一些的 Owner,具有 Owner 的对象被称为是 Owner 的 Dependent
</p>
<pre class="example" id="org2d2b0fa">
例如,一个 ReplicaSet 是一组 Pod 的 Owner
</pre>
<p>
每个 Dependent 对象具有一个指向其所属对象的 <span class="underline">metadata.ownerReferences</span> 字段:
</p>
<ul class="org-ul">
<li><p>
有时,Kubernetes 会自动设置 ownerReference 的值
</p>
<pre class="example" id="org3584260">
例如,当创建一个 ReplicaSet 时,Kubernetes 自动设置 ReplicaSet 中每个 Pod 的 ownerReference 字段值
在 1.6 版本,Kubernetes 会自动为一些对象设置 ownerReference 的值,这些对象是由 ReplicationController、ReplicaSet、StatefulSet、DaemonSet 和 Deployment 所创建或管理
</pre></li>
<li>也可以通过手动设置 ownerReference 的值,来指定 Owner 和 Dependent 之间的关系:</li>
</ul>
<pre class="example" id="org71993dd">
apiVersion: extensions/v1beta1
kind: ReplicaSet
metadata:
name: my-repset
spec:
replicas: 3
selector:
matchLabels:
pod-is-for: garbage-collection-example
template:
metadata:
labels:
pod-is-for: garbage-collection-example
spec:
containers:
- name: nginx
image: nginx
</pre>
<p>
如果创建该 ReplicaSet,然后查看 Pod 的 metadata 字段,能够看到 OwnerReferences 字段:
</p>
<div class="org-src-container">
<pre class="src src-sh">$ kubectl create -f https://k8s.io/docs/concepts/abstractions/controllers/my-repset.yaml
$ kubectl get pods --output=yaml
</pre>
</div>
<p>
输出显示了 Pod 的 Owner 是名为 my-repset 的 ReplicaSet:
</p>
<pre class="example" id="orgc705e15">
apiVersion: v1
kind: Pod
metadata:
...
ownerReferences:
- apiVersion: extensions/v1beta1
controller: true
blockOwnerDeletion: true
kind: ReplicaSet
name: my-repset
uid: d9607e19-f88f-11e6-a518-42010a800195
...
</pre>
</div>
</div>
<div id="outline-container-orga6e3b3f" class="outline-2">
<h2 id="orga6e3b3f">控制垃圾收集器删除 Dependent</h2>
<div class="outline-text-2" id="text-orga6e3b3f">
<p>
当删除对象时,可以指定是否该对象的 Dependent 也自动删除掉。自动删除 Dependent 也称为 <span class="underline">级联删除</span> 。Kubernetes 中有两种 级联删除 的模式:
</p>
<ul class="org-ul">
<li>background 模式</li>
<li>foreground 模式</li>
</ul>
<p>
如果删除对象时,不自动删除它的 Dependent,这些 Dependent 被称作是原对象的 <span class="underline">孤儿</span>
</p>
</div>
<div id="outline-container-org5311dc2" class="outline-3">
<h3 id="org5311dc2">Background 级联删除</h3>
<div class="outline-text-3" id="text-org5311dc2">
<p>
在 background 级联删除 模式下,Kubernetes 会立即删除 Owner 对象,然后垃圾收集器会在后台删除这些 Dependent
</p>
</div>
</div>
<div id="outline-container-orgeb98a34" class="outline-3">
<h3 id="orgeb98a34">Foreground 级联删除</h3>
<div class="outline-text-3" id="text-orgeb98a34">
<p>
在 foreground 级联删除 模式下,根对象首先进入 <span class="underline">删除中</span> 状态。在 “删除中” 状态会有如下的情况:
</p>
<ul class="org-ul">
<li>对象仍然可以通过 <b>REST API 可见</b></li>
<li>会设置对象的 <span class="underline">deletionTimestamp</span> 字段</li>
<li>对象的 <span class="underline">metadata.finalizers</span> 字段包含了值 <span class="underline">foregroundDeletion</span></li>
</ul>
<p>
一旦被设置为 “删除中” 状态,垃圾收集器会删除对象的所有 Dependent。垃圾收集器 <b>删除</b> 了所有 <b>Blocking</b> 的 <span class="underline">Dependent_(对象的 _ownerReference.blockOwnerDeletion</span> =true)之后,它会删除 Owner 对象。
</p>
<pre class="example" id="orgeda680b">
注意,在 “foreground 删除” 模式下,Dependent 只有通过 ownerReference.blockOwnerDeletion 才能阻止删除 Owner 对象
在 Kubernetes 1.7 版本中将增加 admission controller,基于 Owner 对象上的删除权限来控制用户去设置 blockOwnerDeletion 的值为 true,所以未授权的 Dependent 不能够延迟 Owner 对象的删除
如果一个对象的ownerReferences 字段被一个 Controller(例如 Deployment 或 ReplicaSet)设置,blockOwnerDeletion 会被自动设置,没必要手动修改这个字段
</pre>
</div>
</div>
<div id="outline-container-org2cf6980" class="outline-3">
<h3 id="org2cf6980">设置级联删除策略</h3>
<div class="outline-text-3" id="text-org2cf6980">
<p>
通过为 <span class="underline">Owner 对象</span> 设置 <span class="underline">deleteOptions.propagationPolicy</span> 字段,可以控制级联删除策略。可能的取值包括: <span class="underline">orphan</span> 、 <span class="underline">Foreground</span> 或 <span class="underline">Background</span>
</p>
<p>
对很多 <span class="underline">Controller</span> 资源,包括 ReplicationController、ReplicaSet、StatefulSet、DaemonSet 和 Deployment, 默认的 <span class="underline">垃圾收集策略</span> 是 <b>orphan</b> 。因此,除非指定其它的垃圾收集策略,否则所有 Dependent 对象使用的都是 orphan 策略
</p>
<pre class="example" id="orgfe40505">
注意:这里所指的默认值是指 REST API 的默认值,并非 kubectl 命令的默认值,kubectl 默认为级联删除
</pre>
<p>
在后台删除 Dependent 对象的例子:
</p>
<div class="org-src-container">
<pre class="src src-sh">$ kubectl proxy --port=8080
$ curl -X DELETE localhost:8080/apis/extensions/v1beta1/namespaces/default/replicasets/my-repset <span style="color: #deb887;">\</span>
-d <span style="color: #deb887;">'{"kind":"DeleteOptions","apiVersion":"v1","propagationPolicy":"Background"}'</span> <span style="color: #deb887;">\</span>
-H <span style="color: #deb887;">"Content-Type: application/json"</span>
</pre>
</div>
<p>
在前台删除 Dependent 对象的例子:
</p>
<div class="org-src-container">
<pre class="src src-sh">$ kubectl proxy --port=8080
$ curl -X DELETE localhost:8080/apis/extensions/v1beta1/namespaces/default/replicasets/my-repset <span style="color: #deb887;">\</span>
-d <span style="color: #deb887;">'{"kind":"DeleteOptions","apiVersion":"v1","propagationPolicy":"Foreground"}'</span> <span style="color: #deb887;">\</span>
-H <span style="color: #deb887;">"Content-Type: application/json"</span>
</pre>
</div>
<p>
一个孤儿 Dependent 的例子:
</p>
<div class="org-src-container">
<pre class="src src-sh">$ kubectl proxy --port=8080
$ curl -X DELETE localhost:8080/apis/extensions/v1beta1/namespaces/default/replicasets/my-repset <span style="color: #deb887;">\</span>
-d <span style="color: #deb887;">'{"kind":"DeleteOptions","apiVersion":"v1","propagationPolicy":"Orphan"}'</span> <span style="color: #deb887;">\</span>
-H <span style="color: #deb887;">"Content-Type: application/json"</span>
</pre>
</div>
<p>
kubectl 也支持级联删除:
</p>
<ul class="org-ul">
<li>设置 <span class="underline">–cascade</span> 为 true,使 kubectl 自动删除 Dependent 对象</li>
<li>设置 –cascade 为 false,会使 Dependent 对象成为孤儿 Dependent 对象</li>
<li>–cascade 的默认值是 true</li>
</ul>
<p>
使一个 ReplicaSet 的 Dependent 对象成为孤儿 Dependent的例子:
</p>
<div class="org-src-container">
<pre class="src src-sh">kubectl delete replicaset my-repset --cascade=false
</pre>
</div>
<p>
<a href="taint_toleration.html">Previous:Taint 和 Toleration</a>
</p>
<p>
<a href="cluster.html">Home:Cluster</a>
</p>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<br/>
<div class='ds-thread'></div>
<script>
var duoshuoQuery = {short_name:'klose911'};
(function() {
var dsThread = document.getElementsByClassName('ds-thread')[0];
dsThread.setAttribute('data-thread-key', document.title);
dsThread.setAttribute('data-title', document.title);
dsThread.setAttribute('data-url', window.location.href);
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-90850421-1', 'auto');
ga('send', 'pageview');
</script>
</div>
</body>
</html>
| klose911/klose911.github.io | html/docker/kubernates-handbook/theory/cluster/garbage_collection.html | HTML | apache-2.0 | 18,483 |
import os
from dataclasses import dataclass
from typing import Iterable
from dbt.contracts.graph.manifest import SourceFile
from dbt.contracts.graph.parsed import ParsedSqlNode, ParsedMacro
from dbt.contracts.graph.unparsed import UnparsedMacro
from dbt.exceptions import InternalException
from dbt.node_types import NodeType
from dbt.parser.base import SimpleSQLParser
from dbt.parser.macros import MacroParser
from dbt.parser.search import FileBlock
@dataclass
class SqlBlock(FileBlock):
block_name: str
@property
def name(self):
return self.block_name
class SqlBlockParser(SimpleSQLParser[ParsedSqlNode]):
def parse_from_dict(self, dct, validate=True) -> ParsedSqlNode:
if validate:
ParsedSqlNode.validate(dct)
return ParsedSqlNode.from_dict(dct)
@property
def resource_type(self) -> NodeType:
return NodeType.SqlOperation
@staticmethod
def get_compiled_path(block: FileBlock):
# we do it this way to make mypy happy
if not isinstance(block, SqlBlock):
raise InternalException(
'While parsing SQL operation, got an actual file block instead of '
'an SQL block: {}'.format(block)
)
return os.path.join('sql', block.name)
def parse_remote(self, sql: str, name: str) -> ParsedSqlNode:
source_file = SourceFile.remote(sql, self.project.project_name)
contents = SqlBlock(block_name=name, file=source_file)
return self.parse_node(contents)
class SqlMacroParser(MacroParser):
def parse_remote(self, contents) -> Iterable[ParsedMacro]:
base = UnparsedMacro(
path='from remote system',
original_file_path='from remote system',
package_name=self.project.project_name,
raw_sql=contents,
root_path=self.project.project_root,
resource_type=NodeType.Macro,
)
for node in self.parse_unparsed_macros(base):
yield node
| analyst-collective/dbt | core/dbt/parser/sql.py | Python | apache-2.0 | 2,013 |
package rescala.core
import scala.annotation.implicitNotFound
import scala.util.Try
@implicitNotFound("${T} is not serializable")
trait ReSerializable[T] {
def serialize(value: T): String
def deserialize(value: String): Try[T]
}
| volkc/REScala | Main/shared/src/main/scala/rescala/core/ReSerializable.scala | Scala | apache-2.0 | 235 |
# GetsharesfilterResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**shareid** | **string** | share id no. |
**sharename** | **string** | share name |
**sharelocation** | **string** | location of the shared file |
**shareurl** | **string** | url of the shared file |
**viewmode** | **string** | set if user sets any view mode |
**validityperiod** | **string** | expiry date of share |
**sharesizelimit** | **string** | size limit of share |
**maxdownloads** | **float** | maximum download limit is set |
**downloadcount** | **float** | no. of time the file has been downloaded |
**viewsize** | **float** | specifies view size |
**thumbsize** | **float** | specifies thumb size |
**allowpublicaccess** | **float** | whether is to allow public access or not |
**allowpublicupload** | **float** | whether is to allow public upload or not |
**allowpublicviewonly** | **float** | whether is to allow public view only or not |
**isdir** | **float** | whether is directory or not |
**isvalid** | **float** | whether is valid or not |
**createddate** | **float** | created date of share |
**allowedit** | **float** | whether to allow to edit or not |
**allowdelete** | **float** | whether to allow to delete or not |
**allowsync** | **float** | whether to allow to sync or not |
**allowshare** | **float** | whether to allow share or not |
**shareowner** | **string** | share owner name |
**hidenotification** | **float** | disable or enable email notification |
**ispublicsecure** | **float** | 0 | 1 password protected share disabled or enabled |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
| CN-Consult/FileCloud-PHP | docs/Model/GetsharesfilterResponse.md | Markdown | apache-2.0 | 1,799 |
# Insightface MNN NCNN MXNET
## 说明
| 名称 | **insightface** |
| ------ | ------------------------------------------ |
| 网址 | https://github.com/deepinsight/insightface |
| 模型库 | model-y1 |
| | |
```
使用 onnx2ncnn转换后的ncnn model
ex.extract("fc1", out);导致 Segmentation fault
直接使用mxnet2ncnn转换的ncnn model 正常
官方回复速度惊人:
mxnet模型用mxnet2ncnn直接转换
onnx主要是用来转pytorch模型的
使用MNNConvert转换后的mnn model
!!!!数值相差极大 错误!!!
20200106修正代码,数值正确
```
```
使用mxnet验证 model-y1.onnx 正常
from mxnet.contrib import onnx as onnx_mxnet
data_names = ['data']
sym, arg, aux = onnx_mxnet.import_model("model-y1.onnx")
mod = mx.mod.Module(symbol=sym, data_names=data_names, context=ctx, label_names=None)
```
```
insightface_ncnn/arcface# ./main Tom_Hanks_0001.jpg Tom_Hanks_0008.jpg
Detection Time: 0.0128926s
Detection Time: 0.0138261s
Extraction Time: 0.0251512s
Extraction Time: 0.0141007s
Similarity: 0.769362
注释 preprocess,直接 det1 = ncnn_img
./main Tom_Hanks_0001.jpg Tom_Hanks_0008.jpg
Detection Time: 0.0112898s
Detection Time: 0.0115165s
Extraction Time: 0.0125203s
Extraction Time: 0.0118286s
Similarity: 0.734012
```
```
insightface 112x112 Tom_Hanks_0001.jpg Tom_Hanks_0008.jpg
[ 0.10312756 -0.05198071 0.08949378 -0.11032198 -0.15600969 0.12361111
0.09527067 0.02957665 -0.0795046 0.03052824]
[ 0.06654476 -0.0317951 0.0974394 -0.07491414 -0.1794118 0.06273007
-0.04018283 -0.02845657 -0.03490727 0.00553953]
0.5319757
0.7340121
```
```
https://github.com/alibaba/MNN/blob/master/tools/converter/README.md
需要 protobuf 3.x
cmake .. -DMNN_BUILD_CONVERTER=true
./MNNConvert -f ONNX --modelFile model-y1.onnx --MNNModel mode-y1.mnn --bizCode MNN
```
```
https://mxnet.incubator.apache.org/api/python/docs/tutorials/deploy/export/onnx.html
python modules: - MXNet >= 1.3.0 - onnx v1.2.1
pip3 install onnx==1.3.0 //https://github.com/apache/incubator-mxnet/issues/15536
import mxnet as mx
import numpy as np
from mxnet.contrib import onnx as onnx_mxnet
import logging
logging.basicConfig(level=logging.INFO)
sym='./model-symbol.json'
params='./model-0000.params'
input_shape=(1,3,112,112)
onnx_file='./model-y1.onnx'
converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], np.float32, onnx_file)
```
| yippeesoft/NotifyTools | AI-FACES/insightface-mxnet-ncnn-mnn.md | Markdown | apache-2.0 | 2,539 |
package com.angluswang.mobilesafe.engine;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import com.angluswang.mobilesafe.entity.AppInfo;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jeson on 2016/8/2.
* app 业务逻辑类
*/
public class AppInfos {
public static List<AppInfo> getAppInfos(Context context) {
List<AppInfo> packageAppInfos = new ArrayList<>();
//获取到包的管理者
PackageManager pm = context.getPackageManager();
//获取到安装包
//当发现 flag 为此 “@param flags Additional option flags.” 表示时,统一传入 0 即可
List<PackageInfo> installedPackages = pm.getInstalledPackages(0);
for (PackageInfo installedPackage : installedPackages) {
AppInfo appInfo = new AppInfo();
//获取到应用程序的图标
Drawable drawable = installedPackage.applicationInfo.loadIcon(pm);
appInfo.setIcon(drawable);
//获取到应用程序的名字
String apkName = installedPackage.applicationInfo.loadLabel(pm).toString();
appInfo.setApkName(apkName);
//获取到应用程序的包名
String packageName = installedPackage.packageName;
appInfo.setApkPackageName(packageName);
//获取到apk资源的路径
String sourceDir = installedPackage.applicationInfo.sourceDir;
File file = new File(sourceDir);
//apk的长度
long apkSize = file.length();
appInfo.setApkSize(apkSize);
// Log.i("appInfo:", "---------------------------");
// Log.i("appInfo:", "程序的名字:" + apkName);
// Log.i("appInfo:", "程序的包名:" + packageName);
// Log.i("appInfo:", "程序的大小:" + apkSize);
// 判断应用是系统应用 还是 用户应用
// 方式1: //data/app system/app
// if (sourceDir.startsWith("/system"))...
// 方式2:
//获取到安装应用程序的标记
int flags = installedPackage.applicationInfo.flags;
if ((flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
//表示系统app
appInfo.setUserApp(false);
} else {
//表示用户app
appInfo.setUserApp(true);
}
if ((flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
//表示在sd卡
appInfo.setRom(false);
} else {
//表示内存
appInfo.setRom(true);
}
packageAppInfos.add(appInfo);
}
return packageAppInfos;
}
}
| AnglusWang/MobileSafe | app/src/main/java/com/angluswang/mobilesafe/engine/AppInfos.java | Java | apache-2.0 | 2,942 |
# Schedonorus alpinus Hoppe ex Schult. SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Festuca/Festuca altissima/ Syn. Schedonorus alpinus/README.md | Markdown | apache-2.0 | 193 |
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtil;
import com.intellij.ide.scratch.ScratchFileService;
import com.intellij.ide.scratch.ScratchRootType;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.MultiFileTestCase;
import com.intellij.refactoring.RefactoringSettings;
import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.util.PathUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.java.JavaSourceRootType;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
public class SafeDeleteTest extends MultiFileTestCase {
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
@NotNull
@Override
protected String getTestRoot() {
return "/refactoring/safeDelete/";
}
public void testImplicitCtrCall() {
try {
doTest("Super");
fail();
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertTrue(message, message.startsWith("constructor <b><code>Super.Super()</code></b> has 1 usage that is not safe to delete"));
}
}
public void testImplicitCtrCall2() {
try {
doTest("Super");
fail();
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertTrue(message, message.startsWith("constructor <b><code>Super.Super()</code></b> has 1 usage that is not safe to delete"));
}
}
public void testMultipleInterfacesImplementation() {
doTest("IFoo");
}
public void testMultipleInterfacesImplementationThroughCommonInterface() {
doTest("IFoo");
}
public void testUsageInExtendsList() throws Exception {
doSingleFileTest();
}
public void testDeepDeleteParameterSimple() throws Exception {
doSingleFileTest();
}
public void testDeepDeleteParameterOtherTypeInBinaryExpression() throws Exception {
doSingleFileTest();
}
public void testDeepDeleteFieldAndAssignedParameter() throws Exception {
doSingleFileTest();
}
public void testImpossibleToDeepDeleteParameter() throws Exception {
doSingleFileTest();
}
public void testNoDeepDeleteParameterUsedInCallQualifier() throws Exception {
doSingleFileTest();
}
public void testNoDeepDeleteParameterUsedInNextArgumentExpression() throws Exception {
doSingleFileTest();
}
public void testToDeepDeleteParameterOverriders() throws Exception {
doSingleFileTest();
}
public void testDeleteParameterOfASiblingMethod() throws Exception {
doSingleFileTest();
}
public void testDeleteMethodCascade() throws Exception {
doSingleFileTest();
}
public void testDeleteMethodCascadeRecursive() throws Exception {
doSingleFileTest();
}
public void testDeleteMethodCascadeOverridden() throws Exception {
doSingleFileTest();
}
public void testDeleteParameterAndUpdateJavadocRef() throws Exception {
doSingleFileTest();
}
public void testDeleteConstructorParameterWithAnonymousClassUsage() throws Exception {
doSingleFileTest();
}
public void testParameterInHierarchy() {
doTest("C2");
}
public void testTopLevelDocComment() {
doTest("foo.C1");
}
public void testOverloadedMethods() {
doTest("foo.A");
}
public void testTopParameterInHierarchy() {
doTest("I");
}
public void testExtendsList() {
doTest("B");
}
public void testJavadocParamRef() {
doTest("Super");
}
public void testEnumConstructorParameter() {
doTest("UserFlags");
}
public void testSafeDeleteStaticImports() {
doTest("A");
}
public void testSafeDeleteImports() {
doTest("B");
}
public void testSafeDeleteImportsOnInnerClasses() {
doTest("p.B");
}
public void testRemoveOverridersInspiteOfUnsafeUsages() {
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doTest("A"));
}
public void testLocalVariable() {
doTest("Super");
}
public void testOverrideAnnotation() {
doTest("Super");
}
public void testSuperCall() {
try {
doTest("Super");
fail("Conflict was not detected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("method <b><code>Super.foo()</code></b> has 1 usage that is not safe to delete.", message);
}
}
public void testParameterFromFunctionalInterface() throws Exception {
try {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
doSingleFileTest();
fail("Conflict was not detected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("interface <b><code>SAM</code></b> has 1 usage that is not safe to delete.", message);
}
}
public void testFunctionalInterfaceMethod() throws Exception {
try {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
doSingleFileTest();
fail("Conflict was not detected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("interface <b><code>SAM</code></b> has 1 usage that is not safe to delete.", message);
}
}
public void testAmbiguityAfterParameterDelete() throws Exception {
try {
doSingleFileTest();
fail("Conflict was not detected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("Method foo() is already defined in the class <b><code>Test</code></b>", message);
}
}
public void testFunctionalInterfaceDefaultMethod() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
doSingleFileTest();
}
public void testMethodDeepHierarchy() {
doTest("Super");
}
public void testInterfaceAsTypeParameterBound() throws Exception {
doSingleFileTest();
}
public void testNestedTypeParameterBounds() throws Exception {
doSingleFileTest();
}
public void testTypeParameterWithoutOwner() throws Exception {
doSingleFileTest();
}
public void testLocalVariableSideEffect() {
try {
doTest("Super");
fail("Side effect was ignored");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("local variable <b><code>varName</code></b> has 1 usage that is not safe to delete.", message);
}
}
public void testParameterSideEffect() {
try {
doTest("Super");
fail("Side effect was ignored");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("parameter <b><code>i</code></b> has 1 usage that is not safe to delete.", message);
}
}
public void testUsageInGenerated() {
doTest("A");
}
public void testLastResourceVariable() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doSingleFileTest();
}
public void testLastResourceVariableConflictingVar() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doSingleFileTest();
}
public void testLastResourceVariableWithFinallyBlock() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doSingleFileTest();
}
public void testLastTypeParam() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doSingleFileTest();
}
public void testTypeParamFromDiamond() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doSingleFileTest();
}
public void testStripOverride() throws Exception {
doSingleFileTest();
}
public void testEmptyIf() throws Exception {
doSingleFileTest();
}
public void testTypeParameterWithinMethodHierarchy() throws Exception {
doSingleFileTest();
}
public void testTypeParameterNoMethodHierarchy() throws Exception {
doSingleFileTest();
}
public void testClassWithInnerStaticImport() {
doTest("ClassWithInnerStaticImport");
}
public void testInnerClassUsedInTheSameFile() throws Exception {
try {
doSingleFileTest();
fail("Side effect was ignored");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
String message = e.getMessage();
assertEquals("class <b><code>Test.Foo</code></b> has 1 usage that is not safe to delete.", message);
}
}
public void testParameterInMethodUsedInMethodReference() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doSingleFileTest());
}
public void testNoConflictOnDeleteParameterWithMethodRefArg() throws Exception {
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
doSingleFileTest();
}
public void testShowConflictsButRemoveAnnotationsIfAnnotationTypeIsDeleted() throws Exception {
BaseRefactoringProcessor.ConflictsInTestsException.withIgnoredConflicts(()->doSingleFileTest());
}
public void testUsagesInScratch() throws Exception {
BaseRefactoringProcessor.runWithDisabledPreview(() -> {
VirtualFile scratchFile = ScratchRootType.getInstance()
.createScratchFile(getProject(), PathUtil.makeFileName("jScratch", "java"), JavaLanguage.INSTANCE,
"class jScratch {{//name()\n}}", ScratchFileService.Option.create_if_missing);
RefactoringSettings settings = RefactoringSettings.getInstance();
boolean oldCommentsOption = settings.SAFE_DELETE_SEARCH_IN_COMMENTS;
try {
settings.SAFE_DELETE_SEARCH_IN_COMMENTS = true;
doSingleFileTest();
}
finally {
settings.SAFE_DELETE_SEARCH_IN_COMMENTS = oldCommentsOption;
WriteAction.run(() -> scratchFile.delete(this));
}
});
}
public void testDeepDeleteFieldAndInitializerMethod() throws Exception {
doSingleFileTest();
}
public void testDeleteMethodCascadeWithField() throws Exception {
doSingleFileTest();
}
public void testForInitExpr() throws Exception {
doSingleFileTest();
}
public void testForInitList() throws Exception {
doSingleFileTest();
}
public void testForUpdateExpr() throws Exception {
doSingleFileTest();
}
public void testForUpdateList() throws Exception {
doSingleFileTest();
}
public void testUpdateContractOnParameterRemoval() throws Exception {
doSingleFileTest();
}
private void doTest(@NonNls final String qClassName) {
doTest((rootDir, rootAfter) -> this.performAction(qClassName));
}
@Override
protected void prepareProject(VirtualFile rootDir) {
VirtualFile src = rootDir.findChild("src");
if (src == null) {
super.prepareProject(rootDir);
}
else {
PsiTestUtil.addContentRoot(myModule, rootDir);
PsiTestUtil.addSourceRoot(myModule, src);
}
VirtualFile gen = rootDir.findChild("gen");
if (gen != null) {
PsiTestUtil.addSourceRoot(myModule, gen, JavaSourceRootType.SOURCE, JpsJavaExtensionService.getInstance().createSourceRootProperties("", true));
}
}
private void doSingleFileTest() throws Exception {
configureByFile(getTestRoot() + getTestName(false) + ".java");
performAction();
checkResultByFile(getTestRoot() + getTestName(false) + "_after.java");
}
private void performAction(final String qClassName) {
final PsiClass aClass = myJavaFacade.findClass(qClassName, GlobalSearchScope.allScope(getProject()));
assertNotNull("Class " + qClassName + " not found", aClass);
configureByExistingFile(aClass.getContainingFile().getVirtualFile());
if (myEditor.getCaretModel().getOffset() == 0) {
myEditor.getCaretModel().moveToOffset(aClass.getTextOffset());
}
performAction();
}
private void performAction() {
final PsiElement psiElement = TargetElementUtil
.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
assertNotNull("No element found in text:\n" + getFile().getText(), psiElement);
SafeDeleteHandler.invoke(getProject(), new PsiElement[]{psiElement}, true);
}
} | mdanielwork/intellij-community | java/java-tests/testSrc/com/intellij/java/refactoring/SafeDeleteTest.java | Java | apache-2.0 | 13,406 |
/*
* Licensed to the Indoqa Software Design und Beratung GmbH (Indoqa) under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Indoqa licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.indoqa.solr.spatial.corridor.direction;
import java.io.IOException;
import com.indoqa.solr.spatial.corridor.debug.DebugValues;
import com.indoqa.solr.spatial.corridor.debug.DebugValuesImpl;
import org.apache.lucene.queries.function.ValueSource;
import org.apache.lucene.queries.function.docvalues.StrDocValues;
public abstract class DebugStrDocValues extends StrDocValues {
protected DebugValues debugValues = new DebugValuesImpl();
public DebugStrDocValues(ValueSource vs) {
super(vs);
}
@Override
public String strVal(int doc) throws IOException {
Number number = (Number) this.callFunctionValues(doc);
debugValues.add("result", number);
return this.debugValues.toJson();
}
protected abstract Object callFunctionValues(int doc) throws IOException;
protected DebugValues getDebugValues() {
return this.debugValues;
}
}
| Indoqa/solr-spatial-corridor | src/main/java/com/indoqa/solr/spatial/corridor/direction/DebugStrDocValues.java | Java | apache-2.0 | 1,734 |
// Copyright 2010, Mike Samuel
//
// 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.
/**
* Core abstractions such as {@link org.prebake.core.Glob globs},
* {@link org.prebake.core.Hash hashes} and
* {@link org.prebake.core.ArtifactListener artifact listener}.
*
* @author Mike Samuel <mikesamuel@gmail.com>
*/
@javax.annotation.ParametersAreNonnullByDefault
package org.prebake.core;
| bjorndm/prebake | code/src/org/prebake/core/package-info.java | Java | apache-2.0 | 895 |
# Navia mima L.B.Sm. SPECIES
#### Status
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Poales/Bromeliaceae/Navia/Navia mima/README.md | Markdown | apache-2.0 | 176 |
/**
* Gerado por template generation
* Diretiva de overwrite atual:
* TemplateName:
**/
package br.com.dlp.jazzqa.usuariojazz;
import java.util.Date;
import java.util.List;
import javax.jws.WebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import br.com.dlp.framework.business.AbstractBusinessImpl;
import br.com.dlp.framework.dao.IDAO;
import br.com.dlp.framework.dao.QueryOrder;
import br.com.dlp.jazzqa.status.StatusVO;
/**
* Incluir arquivo com comentários
*
* Contrado de Business para o componente UsuarioJazzVO
*
**/
@Component
@WebService
public class UsuarioJazzBusinessImpl extends AbstractBusinessImpl<UsuarioJazzVO> implements UsuarioJazzBusiness {
private static final long serialVersionUID = -4018418907098545031L;
@Autowired
private UsuarioJazzDAO usuarioJazzDAO;
/**
* Pesquisa entidades do tipo UsuarioJazzVO
* @author t_dpacifico
* @param status
* @param stati
* @param altura
* @param login
* @param dtInclusaoFrom
* @param dtInclusaoTo
* @param nome
* @returns Coleção de UsuarioJazzVO
*/
public List<UsuarioJazzVO> findUsuarioJazzVO(StatusVO status, List<StatusVO> stati, double altura, String login, Date dtInclusaoFrom, Date dtInclusaoTo, String nome){
return usuarioJazzDAO.findUsuarioJazzVO(status, stati, altura, login, dtInclusaoFrom, dtInclusaoTo, nome);
}
/**
* Pesquisa entidades do tipo UsuarioJazzVO
* @author t_dpacifico
* @param status
* @param stati
* @param altura
* @param login
* @param dtInclusaoFrom
* @param dtInclusaoTo
* @param nome
* @param QueryOrder Ordenação de pesquisa
* @returns Coleção de UsuarioJazzVO
*/
public List<UsuarioJazzVO> findUsuarioJazzVOOrdered(StatusVO status, List<StatusVO> stati, double altura, String login, Date dtInclusaoFrom, Date dtInclusaoTo, String nome, QueryOrder... queryOrders){
return usuarioJazzDAO.findUsuarioJazzVO(status, stati, altura, login, dtInclusaoFrom, dtInclusaoTo, nome, queryOrders);
}
/* (non-Javadoc)
* @see br.com.dlp.framework.business.AbstractBusinessImpl#getDao()
*/
@Override
protected IDAO<UsuarioJazzVO> getDao() {
return usuarioJazzDAO;
}
/* (non-Javadoc)
* @see br.com.dlp.framework.business.AbstractBusinessImpl#newVO()
*/
@Override
public UsuarioJazzVO newVO() {
return new UsuarioJazzVO();
}
} | darciopacifico/omr | tags/PreSCMSetup/JazzQA/bsn/src/main/java/br/com/dlp/jazzqa/usuariojazz/UsuarioJazzBusinessImpl.java | Java | apache-2.0 | 2,401 |
namespace loon.opengl
{
/// <summary>
/// 模拟OpenGL的API(monogame在大部分环境都把OpenGL本地适配为XNA的API,我为了方便移植又反向模拟回来……)
/// </summary>
public class GL
{
public const int GL_QUADS = -1;
public const int GL_POLYGON = 0x0006;
public const int GL_POINTS = 0x0000;
public const int GL_LINES = 0x0001;
public const int GL_LINE_LOOP = 0x0002;
public const int GL_LINE_STRIP = 0x0003;
public const int GL_TRIANGLES = 0x0004;
public const int GL_TRIANGLE_STRIP = 0x0005;
public const int GL_TRIANGLE_FAN = 0x0006;
public const int GL_RENDERER = 0x00;
public const int GL_ALPHA_TEST = 0xbc0;
public const int GL_ALWAYS = 0x207;
public const int GL_BLEND = 0xbe2;
public const int GL_BYTE = 0x1400;
public const int GL_CCW = 0x901;
public const int GL_CLAMP_TO_EDGE = 0x812f;
public const int GL_COLOR_ARRAY = 0x8076;
public const int GL_COLOR_BUFFER_BIT = 0x4000;
public const int GL_COMPRESSED_TEXTURE_FORMATS = 0x86a3;
public const int GL_CULL_FACE = 0xb44;
public const int GL_CW = 0x900;
public const int GL_DEPTH_BUFFER_BIT = 0x100;
public const int GL_DEPTH_TEST = 0xb71;
public const int GL_DITHER = 0xbd0;
public const int GL_EQUAL = 0x202;
public const int GL_FASTEST = 0x1101;
public const int GL_FLOAT = 0x1406;
public const int GL_FOG = 0xb60;
public const int GL_FOG_COLOR = 0xb66;
public const int GL_FOG_END = 0xb64;
public const int GL_FOG_MODE = 0xb65;
public const int GL_FOG_START = 0xb63;
public const int GL_GEQUAL = 0x206;
public const int GL_GREATER = 0x204;
public const int GL_INCR = 0x1e02;
public const int GL_KEEP = 0x1e00;
public const int GL_LEQUAL = 0x203;
public const int GL_LIGHTING = 0xb50;
public const int GL_LINEAR = 0x2601;
public const int GL_LUMINANCE = 0x1909;
public const int GL_LUMINANCE_ALPHA = 0x190a;
public const int GL_MAX_TEXTURE_SIZE = 0xd33;
public const int GL_MODELVIEW = 0x1700;
public const int GL_MODULATE = 0x2100;
public const int GL_NEAREST = 0x2600;
public const int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
public const int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
public const int GL_NO_ERROR = 0;
public const int GL_NORMAL_ARRAY = 0x8075;
public const int GL_NOTEQUAL = 0x205;
public const int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86a2;
public const int GL_ZERO = 0;
public const int GL_ONE = 1;
public const int GL_ONE_MINUS_SRC_ALPHA = 0x303;
public const int GL_DST_COLOR = 0x0306;
public const int GL_PALETTE8_RGBA4_OES = 0x8b98;
public const int GL_PALETTE8_RGBA8_OES = 0x8b96;
public const int GL_PERSPECTIVE_CORRECTION_HINT = 0xc50;
public const int GL_PROJECTION = 0x1701;
public const int GL_REPEAT = 0x2901;
public const int GL_REPLACE = 0x1E01;
public const int GL_FLAT = 0x1D00;
public const int GL_RGB = 0x1907;
public const int GL_RGBA = 0x1908;
public const int GL_SCISSOR_TEST = 0xc11;
public const int GL_SHORT = 0x1402;
public const int GL_SMOOTH = 0x1d01;
public const int GL_SRC_ALPHA = 770;
public const int GL_STENCIL_BUFFER_BIT = 0x400;
public const int GL_STENCIL_TEST = 0xb90;
public const int GL_TEXTURE = 0x1702;
public const int GL_TEXTURE_2D = 0xde1;
public const int GL_TEXTURE_COORD_ARRAY = 0x8078;
public const int GL_TEXTURE_ENV = 0x2300;
public const int GL_TEXTURE_ENV_MODE = 0x2200;
public const int GL_TEXTURE_MAG_FILTER = 0x2800;
public const int GL_TEXTURE_MIN_FILTER = 0x2801;
public const int GL_TEXTURE_WRAP_S = 0x2802;
public const int GL_TEXTURE_WRAP_T = 0x2803;
public const int GL_SRC_COLOR = 0x0300;
public const int GL_ONE_MINUS_SRC_COLOR = 0x0301;
public const int GL_DST_ALPHA = 0x0304;
public const int GL_ONE_MINUS_DST_ALPHA = 0x0305;
public const int GL_UNSIGNED_BYTE = 0x1401;
public const int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
public const int GL_VERTEX_ARRAY = 0x8074;
public const int GL_LINE_SMOOTH = 0x0B20;
}
}
| cping/LGame | C#/Loon2MonoGame/LoonMonoGame-Lib/loon/opengl/GL.cs | C# | apache-2.0 | 4,516 |
CREATE TABLE W_001_AUTH
(
_ID CHAR(16) NOT NULL,
PRIMARY KEY (_ID)
) | fanjiangang/PartyBuilding_WeChat | weispace/db/W_001_AUTH.sql | SQL | apache-2.0 | 90 |
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Update Data PDUs
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/thread.h>
#include "update.h"
#include "surface.h"
#include <freerdp/peer.h>
#include <freerdp/codec/bitmap.h>
/*
static const char* const UPDATE_TYPE_STRINGS[] =
{
"Orders",
"Bitmap",
"Palette",
"Synchronize"
};
*/
BOOL update_recv_orders(rdpUpdate* update, STREAM* s)
{
UINT16 numberOrders;
if (stream_get_left(s) < 6)
return FALSE;
stream_seek_UINT16(s); /* pad2OctetsA (2 bytes) */
stream_read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
stream_seek_UINT16(s); /* pad2OctetsB (2 bytes) */
while (numberOrders > 0)
{
if (!update_recv_order(update, s))
return FALSE;
numberOrders--;
}
return TRUE;
}
BOOL update_read_bitmap_data(STREAM* s, BITMAP_DATA* bitmap_data)
{
if (stream_get_left(s) < 18)
return FALSE;
stream_read_UINT16(s, bitmap_data->destLeft);
stream_read_UINT16(s, bitmap_data->destTop);
stream_read_UINT16(s, bitmap_data->destRight);
stream_read_UINT16(s, bitmap_data->destBottom);
stream_read_UINT16(s, bitmap_data->width);
stream_read_UINT16(s, bitmap_data->height);
stream_read_UINT16(s, bitmap_data->bitsPerPixel);
stream_read_UINT16(s, bitmap_data->flags);
stream_read_UINT16(s, bitmap_data->bitmapLength);
if (bitmap_data->flags & BITMAP_COMPRESSION)
{
if (!(bitmap_data->flags & NO_BITMAP_COMPRESSION_HDR))
{
stream_read_UINT16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
stream_read_UINT16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
stream_read_UINT16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */
stream_read_UINT16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
bitmap_data->bitmapLength = bitmap_data->cbCompMainBodySize;
}
bitmap_data->compressed = TRUE;
stream_get_mark(s, bitmap_data->bitmapDataStream);
stream_seek(s, bitmap_data->bitmapLength);
}
else
{
if (stream_get_left(s) < bitmap_data->bitmapLength)
return FALSE;
bitmap_data->compressed = FALSE;
stream_get_mark(s, bitmap_data->bitmapDataStream);
stream_seek(s, bitmap_data->bitmapLength);
}
return TRUE;
}
BOOL update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_update)
{
int i;
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, bitmap_update->number); /* numberRectangles (2 bytes) */
if (bitmap_update->number > bitmap_update->count)
{
UINT16 count;
count = bitmap_update->number * 2;
bitmap_update->rectangles = (BITMAP_DATA*) realloc(bitmap_update->rectangles,
sizeof(BITMAP_DATA) * count);
memset(&bitmap_update->rectangles[bitmap_update->count], 0,
sizeof(BITMAP_DATA) * (count - bitmap_update->count));
bitmap_update->count = count;
}
/* rectangles */
for (i = 0; i < (int) bitmap_update->number; i++)
{
if (!update_read_bitmap_data(s, &bitmap_update->rectangles[i]))
return FALSE;
}
return TRUE;
}
BOOL update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_update)
{
int i;
PALETTE_ENTRY* entry;
if (stream_get_left(s) < 6)
return FALSE;
stream_seek_UINT16(s); /* pad2Octets (2 bytes) */
stream_read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
if (palette_update->number > 256)
palette_update->number = 256;
if (stream_get_left(s) < palette_update->number * 3)
return FALSE;
/* paletteEntries */
for (i = 0; i < (int) palette_update->number; i++)
{
entry = &palette_update->entries[i];
stream_read_BYTE(s, entry->blue);
stream_read_BYTE(s, entry->green);
stream_read_BYTE(s, entry->red);
}
return TRUE;
}
void update_read_synchronize(rdpUpdate* update, STREAM* s)
{
stream_seek_UINT16(s); /* pad2Octets (2 bytes) */
/**
* The Synchronize Update is an artifact from the
* T.128 protocol and should be ignored.
*/
}
BOOL update_read_play_sound(STREAM* s, PLAY_SOUND_UPDATE* play_sound)
{
if (stream_get_left(s) < 8)
return FALSE;
stream_read_UINT32(s, play_sound->duration); /* duration (4 bytes) */
stream_read_UINT32(s, play_sound->frequency); /* frequency (4 bytes) */
return TRUE;
}
BOOL update_recv_play_sound(rdpUpdate* update, STREAM* s)
{
if (!update_read_play_sound(s, &update->play_sound))
return FALSE;
IFCALL(update->PlaySound, update->context, &update->play_sound);
return TRUE;
}
BOOL update_read_pointer_position(STREAM* s, POINTER_POSITION_UPDATE* pointer_position)
{
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */
stream_read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */
return TRUE;
}
BOOL update_read_pointer_system(STREAM* s, POINTER_SYSTEM_UPDATE* pointer_system)
{
if (stream_get_left(s) < 4)
return FALSE;
stream_read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */
return TRUE;
}
BOOL update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
{
if (stream_get_left(s) < 14)
return FALSE;
stream_read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */
stream_read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */
stream_read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */
stream_read_UINT16(s, pointer_color->width); /* width (2 bytes) */
stream_read_UINT16(s, pointer_color->height); /* height (2 bytes) */
stream_read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */
stream_read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */
/**
* There does not seem to be any documentation on why
* xPos / yPos can be larger than width / height
* so it is missing in documentation or a bug in implementation
* 2.2.9.1.1.4.4 Color Pointer Update (TS_COLORPOINTERATTRIBUTE)
*/
if (pointer_color->xPos >= pointer_color->width)
pointer_color->xPos = 0;
if (pointer_color->yPos >= pointer_color->height)
pointer_color->yPos = 0;
if (pointer_color->lengthXorMask > 0)
{
if (stream_get_left(s) < pointer_color->lengthXorMask)
return FALSE;
pointer_color->xorMaskData = (BYTE*) malloc(pointer_color->lengthXorMask);
stream_read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
}
if (pointer_color->lengthAndMask > 0)
{
if (stream_get_left(s) < pointer_color->lengthAndMask)
return FALSE;
pointer_color->andMaskData = (BYTE*) malloc(pointer_color->lengthAndMask);
stream_read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
}
if (stream_get_left(s) > 0)
stream_seek_BYTE(s); /* pad (1 byte) */
return TRUE;
}
BOOL update_read_pointer_new(STREAM* s, POINTER_NEW_UPDATE* pointer_new)
{
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
return update_read_pointer_color(s, &pointer_new->colorPtrAttr); /* colorPtrAttr */
}
BOOL update_read_pointer_cached(STREAM* s, POINTER_CACHED_UPDATE* pointer_cached)
{
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
return TRUE;
}
BOOL update_recv_pointer(rdpUpdate* update, STREAM* s)
{
UINT16 messageType;
rdpContext* context = update->context;
rdpPointerUpdate* pointer = update->pointer;
if (stream_get_left(s) < 2 + 2)
return FALSE;
stream_read_UINT16(s, messageType); /* messageType (2 bytes) */
stream_seek_UINT16(s); /* pad2Octets (2 bytes) */
switch (messageType)
{
case PTR_MSG_TYPE_POSITION:
if (!update_read_pointer_position(s, &pointer->pointer_position))
return FALSE;
IFCALL(pointer->PointerPosition, context, &pointer->pointer_position);
break;
case PTR_MSG_TYPE_SYSTEM:
if (!update_read_pointer_system(s, &pointer->pointer_system))
return FALSE;
IFCALL(pointer->PointerSystem, context, &pointer->pointer_system);
break;
case PTR_MSG_TYPE_COLOR:
if (!update_read_pointer_color(s, &pointer->pointer_color))
return FALSE;
IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
break;
case PTR_MSG_TYPE_POINTER:
if (!update_read_pointer_new(s, &pointer->pointer_new))
return FALSE;
IFCALL(pointer->PointerNew, context, &pointer->pointer_new);
break;
case PTR_MSG_TYPE_CACHED:
if (!update_read_pointer_cached(s, &pointer->pointer_cached))
return FALSE;
IFCALL(pointer->PointerCached, context, &pointer->pointer_cached);
break;
default:
break;
}
return TRUE;
}
BOOL update_recv(rdpUpdate* update, STREAM* s)
{
UINT16 updateType;
rdpContext* context = update->context;
if (stream_get_left(s) < 2)
return FALSE;
stream_read_UINT16(s, updateType); /* updateType (2 bytes) */
//printf("%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
IFCALL(update->BeginPaint, context);
switch (updateType)
{
case UPDATE_TYPE_ORDERS:
if (!update_recv_orders(update, s))
{
/* XXX: Do we have to call EndPaint? */
return FALSE;
}
break;
case UPDATE_TYPE_BITMAP:
if (!update_read_bitmap(update, s, &update->bitmap_update))
return FALSE;
IFCALL(update->BitmapUpdate, context, &update->bitmap_update);
break;
case UPDATE_TYPE_PALETTE:
if (!update_read_palette(update, s, &update->palette_update))
return FALSE;
IFCALL(update->Palette, context, &update->palette_update);
break;
case UPDATE_TYPE_SYNCHRONIZE:
update_read_synchronize(update, s);
IFCALL(update->Synchronize, context);
break;
}
IFCALL(update->EndPaint, context);
return TRUE;
}
void update_reset_state(rdpUpdate* update)
{
rdpPrimaryUpdate* primary = update->primary;
rdpAltSecUpdate* altsec = update->altsec;
memset(&primary->order_info, 0, sizeof(ORDER_INFO));
memset(&primary->dstblt, 0, sizeof(DSTBLT_ORDER));
memset(&primary->patblt, 0, sizeof(PATBLT_ORDER));
memset(&primary->scrblt, 0, sizeof(SCRBLT_ORDER));
memset(&primary->opaque_rect, 0, sizeof(OPAQUE_RECT_ORDER));
memset(&primary->draw_nine_grid, 0, sizeof(DRAW_NINE_GRID_ORDER));
memset(&primary->multi_dstblt, 0, sizeof(MULTI_DSTBLT_ORDER));
memset(&primary->multi_patblt, 0, sizeof(MULTI_PATBLT_ORDER));
memset(&primary->multi_scrblt, 0, sizeof(MULTI_SCRBLT_ORDER));
memset(&primary->multi_opaque_rect, 0, sizeof(MULTI_OPAQUE_RECT_ORDER));
memset(&primary->multi_draw_nine_grid, 0, sizeof(MULTI_DRAW_NINE_GRID_ORDER));
memset(&primary->line_to, 0, sizeof(LINE_TO_ORDER));
memset(&primary->polyline, 0, sizeof(POLYLINE_ORDER));
memset(&primary->memblt, 0, sizeof(MEMBLT_ORDER));
memset(&primary->mem3blt, 0, sizeof(MEM3BLT_ORDER));
memset(&primary->save_bitmap, 0, sizeof(SAVE_BITMAP_ORDER));
memset(&primary->glyph_index, 0, sizeof(GLYPH_INDEX_ORDER));
memset(&primary->fast_index, 0, sizeof(FAST_INDEX_ORDER));
memset(&primary->fast_glyph, 0, sizeof(FAST_GLYPH_ORDER));
memset(&primary->polygon_sc, 0, sizeof(POLYGON_SC_ORDER));
memset(&primary->polygon_cb, 0, sizeof(POLYGON_CB_ORDER));
memset(&primary->ellipse_sc, 0, sizeof(ELLIPSE_SC_ORDER));
memset(&primary->ellipse_cb, 0, sizeof(ELLIPSE_CB_ORDER));
primary->order_info.orderType = ORDER_TYPE_PATBLT;
altsec->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE;
IFCALL(altsec->SwitchSurface, update->context, &(altsec->switch_surface));
}
static void update_begin_paint(rdpContext* context)
{
}
static void update_end_paint(rdpContext* context)
{
}
static void update_write_refresh_rect(STREAM* s, BYTE count, RECTANGLE_16* areas)
{
int i;
stream_write_BYTE(s, count); /* numberOfAreas (1 byte) */
stream_seek(s, 3); /* pad3Octets (3 bytes) */
for (i = 0; i < count; i++)
{
stream_write_UINT16(s, areas[i].left); /* left (2 bytes) */
stream_write_UINT16(s, areas[i].top); /* top (2 bytes) */
stream_write_UINT16(s, areas[i].right); /* right (2 bytes) */
stream_write_UINT16(s, areas[i].bottom); /* bottom (2 bytes) */
}
}
static void update_send_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
if (rdp->settings->RefreshRect)
{
s = rdp_data_pdu_init(rdp);
update_write_refresh_rect(s, count, areas);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_REFRESH_RECT, rdp->mcs->user_id);
}
}
static void update_write_suppress_output(STREAM* s, BYTE allow, RECTANGLE_16* area)
{
stream_write_BYTE(s, allow); /* allowDisplayUpdates (1 byte) */
stream_seek(s, 3); /* pad3Octets (3 bytes) */
if (allow > 0)
{
stream_write_UINT16(s, area->left); /* left (2 bytes) */
stream_write_UINT16(s, area->top); /* top (2 bytes) */
stream_write_UINT16(s, area->right); /* right (2 bytes) */
stream_write_UINT16(s, area->bottom); /* bottom (2 bytes) */
}
}
static void update_send_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
if (rdp->settings->SuppressOutput)
{
s = rdp_data_pdu_init(rdp);
update_write_suppress_output(s, allow, area);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_SUPPRESS_OUTPUT, rdp->mcs->user_id);
}
}
static void update_send_surface_command(rdpContext* context, STREAM* s)
{
STREAM* update;
rdpRdp* rdp = context->rdp;
update = fastpath_update_pdu_init(rdp->fastpath);
stream_check_size(update, stream_get_length(s));
stream_write(update, stream_get_head(s), stream_get_length(s));
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update);
}
static void update_send_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_command)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
stream_check_size(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) surface_bits_command->bitmapDataLength);
update_write_surfcmd_surface_bits_header(s, surface_bits_command);
stream_write(s, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s);
}
static void update_send_surface_frame_marker(rdpContext* context, SURFACE_FRAME_MARKER* surface_frame_marker)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
update_write_surfcmd_frame_marker(s, surface_frame_marker->frameAction, surface_frame_marker->frameId);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s);
}
static void update_send_frame_acknowledge(rdpContext* context, UINT32 frameId)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
if (rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE])
{
s = rdp_data_pdu_init(rdp);
stream_write_UINT32(s, frameId);
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id);
}
}
static void update_send_synchronize(rdpContext* context)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
stream_write_zero(s, 2); /* pad2Octets (2 bytes) */
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SYNCHRONIZE, s);
}
static void update_send_desktop_resize(rdpContext* context)
{
if (context->peer)
context->peer->activated = FALSE;
rdp_server_reactivate(context->rdp);
}
static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
stream_write_BYTE(s, ORDER_STANDARD | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
stream_write_BYTE(s, ORDER_TYPE_SCRBLT); /* orderType (1 byte) */
stream_write_BYTE(s, 0x7F); /* fieldFlags (variable) */
stream_write_UINT16(s, scrblt->nLeftRect);
stream_write_UINT16(s, scrblt->nTopRect);
stream_write_UINT16(s, scrblt->nWidth);
stream_write_UINT16(s, scrblt->nHeight);
stream_write_BYTE(s, scrblt->bRop);
stream_write_UINT16(s, scrblt->nXSrc);
stream_write_UINT16(s, scrblt->nYSrc);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
}
static void update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
{
STREAM* s;
BYTE updateCode;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
if (pointer_system->type == SYSPTR_NULL)
updateCode = FASTPATH_UPDATETYPE_PTR_NULL;
else
updateCode = FASTPATH_UPDATETYPE_PTR_DEFAULT;
fastpath_send_update_pdu(rdp->fastpath, updateCode, s);
}
static void update_write_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
{
stream_check_size(s, 15 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask);
stream_write_UINT16(s, pointer_color->cacheIndex);
stream_write_UINT16(s, pointer_color->xPos);
stream_write_UINT16(s, pointer_color->yPos);
stream_write_UINT16(s, pointer_color->width);
stream_write_UINT16(s, pointer_color->height);
stream_write_UINT16(s, pointer_color->lengthAndMask);
stream_write_UINT16(s, pointer_color->lengthXorMask);
if (pointer_color->lengthXorMask > 0)
stream_write(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
if (pointer_color->lengthAndMask > 0)
stream_write(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
stream_write_BYTE(s, 0); /* pad (1 byte) */
}
static void update_send_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
update_write_pointer_color(s, pointer_color);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_COLOR, s);
}
static void update_send_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* pointer_new)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
stream_write_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
update_write_pointer_color(s, &pointer_new->colorPtrAttr);
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_POINTER, s);
}
static void update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDATE* pointer_cached)
{
STREAM* s;
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
stream_write_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_CACHED, s);
}
BOOL update_read_refresh_rect(rdpUpdate* update, STREAM* s)
{
int index;
BYTE numberOfAreas;
RECTANGLE_16* areas;
if (stream_get_left(s) < 4)
return FALSE;
stream_read_BYTE(s, numberOfAreas);
stream_seek(s, 3); /* pad3Octects */
if (stream_get_left(s) < numberOfAreas * 4 * 2)
return FALSE;
areas = (RECTANGLE_16*) malloc(sizeof(RECTANGLE_16) * numberOfAreas);
for (index = 0; index < numberOfAreas; index++)
{
stream_read_UINT16(s, areas[index].left);
stream_read_UINT16(s, areas[index].top);
stream_read_UINT16(s, areas[index].right);
stream_read_UINT16(s, areas[index].bottom);
}
IFCALL(update->RefreshRect, update->context, numberOfAreas, areas);
free(areas);
return TRUE;
}
BOOL update_read_suppress_output(rdpUpdate* update, STREAM* s)
{
BYTE allowDisplayUpdates;
if (stream_get_left(s) < 4)
return FALSE;
stream_read_BYTE(s, allowDisplayUpdates);
stream_seek(s, 3); /* pad3Octects */
if (allowDisplayUpdates > 0 && stream_get_left(s) < 8)
return FALSE;
IFCALL(update->SuppressOutput, update->context, allowDisplayUpdates,
allowDisplayUpdates > 0 ? (RECTANGLE_16*) stream_get_tail(s) : NULL);
return TRUE;
}
void update_register_server_callbacks(rdpUpdate* update)
{
update->BeginPaint = update_begin_paint;
update->EndPaint = update_end_paint;
update->Synchronize = update_send_synchronize;
update->DesktopResize = update_send_desktop_resize;
update->SurfaceBits = update_send_surface_bits;
update->SurfaceFrameMarker = update_send_surface_frame_marker;
update->SurfaceCommand = update_send_surface_command;
update->primary->ScrBlt = update_send_scrblt;
update->pointer->PointerSystem = update_send_pointer_system;
update->pointer->PointerColor = update_send_pointer_color;
update->pointer->PointerNew = update_send_pointer_new;
update->pointer->PointerCached = update_send_pointer_cached;
}
void update_register_client_callbacks(rdpUpdate* update)
{
update->RefreshRect = update_send_refresh_rect;
update->SuppressOutput = update_send_suppress_output;
update->SurfaceFrameAcknowledge = update_send_frame_acknowledge;
}
static void* update_thread(void* arg)
{
rdpUpdate* update;
update = (rdpUpdate*) arg;
while (WaitForSingleObject(Queue_Event(update->queue), INFINITE) == WAIT_OBJECT_0)
{
}
return NULL;
}
rdpUpdate* update_new(rdpRdp* rdp)
{
rdpUpdate* update;
update = (rdpUpdate*) malloc(sizeof(rdpUpdate));
if (update != NULL)
{
OFFSCREEN_DELETE_LIST* deleteList;
ZeroMemory(update, sizeof(rdpUpdate));
update->bitmap_update.count = 64;
update->bitmap_update.rectangles = (BITMAP_DATA*) malloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
ZeroMemory(update->bitmap_update.rectangles, sizeof(BITMAP_DATA) * update->bitmap_update.count);
update->pointer = (rdpPointerUpdate*) malloc(sizeof(rdpPointerUpdate));
ZeroMemory(update->pointer, sizeof(rdpPointerUpdate));
update->primary = (rdpPrimaryUpdate*) malloc(sizeof(rdpPrimaryUpdate));
ZeroMemory(update->primary, sizeof(rdpPrimaryUpdate));
update->secondary = (rdpSecondaryUpdate*) malloc(sizeof(rdpSecondaryUpdate));
ZeroMemory(update->secondary, sizeof(rdpSecondaryUpdate));
update->altsec = (rdpAltSecUpdate*) malloc(sizeof(rdpAltSecUpdate));
ZeroMemory(update->altsec, sizeof(rdpAltSecUpdate));
update->window = (rdpWindowUpdate*) malloc(sizeof(rdpWindowUpdate));
ZeroMemory(update->window, sizeof(rdpWindowUpdate));
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64;
deleteList->indices = malloc(deleteList->sIndices * 2);
deleteList->cIndices = 0;
update->SuppressOutput = update_send_suppress_output;
update->queue = Queue_New(TRUE, -1, -1);
update->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) update_thread, update, 0, NULL);
}
return update;
}
void update_free(rdpUpdate* update)
{
if (update != NULL)
{
OFFSCREEN_DELETE_LIST* deleteList;
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
free(deleteList->indices);
free(update->bitmap_update.rectangles);
free(update->pointer);
free(update->primary->polyline.points);
free(update->primary->polygon_sc.points);
free(update->primary);
free(update->secondary);
free(update->altsec);
free(update->window);
CloseHandle(update->thread);
Queue_Free(update->queue);
free(update);
}
}
| mindtium/FreeRDP | libfreerdp/core/update.c | C | apache-2.0 | 23,164 |
/*
* Copyright 2005-2018 Dozer Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.dozermapper.core.functional_tests.model;
public abstract class AbstractDto {
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| orange-buffalo/dozer | core/src/test/java/com/github/dozermapper/core/functional_tests/model/AbstractDto.java | Java | apache-2.0 | 873 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.carbondata.presto;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.inject.Inject;
import static java.util.Objects.requireNonNull;
import org.apache.carbondata.core.constants.CarbonCommonConstants;
import org.apache.carbondata.core.indexstore.PartitionSpec;
import org.apache.carbondata.core.scan.expression.Expression;
import org.apache.carbondata.core.stats.QueryStatistic;
import org.apache.carbondata.core.stats.QueryStatisticsConstants;
import org.apache.carbondata.core.stats.QueryStatisticsRecorder;
import org.apache.carbondata.core.util.CarbonTimeStatisticsFactory;
import org.apache.carbondata.core.util.ThreadLocalSessionInfo;
import org.apache.carbondata.presto.impl.CarbonLocalMultiBlockSplit;
import org.apache.carbondata.presto.impl.CarbonTableCacheModel;
import org.apache.carbondata.presto.impl.CarbonTableReader;
import com.facebook.presto.hive.CoercionPolicy;
import com.facebook.presto.hive.DirectoryLister;
import com.facebook.presto.hive.ForHiveClient;
import com.facebook.presto.hive.HdfsEnvironment;
import com.facebook.presto.hive.HiveClientConfig;
import com.facebook.presto.hive.HiveColumnHandle;
import com.facebook.presto.hive.HivePartition;
import com.facebook.presto.hive.HiveSplit;
import com.facebook.presto.hive.HiveSplitManager;
import com.facebook.presto.hive.HiveTableLayoutHandle;
import com.facebook.presto.hive.HiveTransactionHandle;
import com.facebook.presto.hive.NamenodeStats;
import com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore;
import com.facebook.presto.hive.metastore.Table;
import com.facebook.presto.spi.ColumnHandle;
import com.facebook.presto.spi.ConnectorSession;
import com.facebook.presto.spi.ConnectorSplit;
import com.facebook.presto.spi.ConnectorSplitSource;
import com.facebook.presto.spi.ConnectorTableLayoutHandle;
import com.facebook.presto.spi.FixedSplitSource;
import com.facebook.presto.spi.HostAddress;
import com.facebook.presto.spi.SchemaTableName;
import com.facebook.presto.spi.TableNotFoundException;
import com.facebook.presto.spi.connector.ConnectorTransactionHandle;
import com.facebook.presto.spi.predicate.TupleDomain;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import static com.google.common.collect.ImmutableList.toImmutableList;
/**
* Build Carbontable splits
* filtering irrelevant blocks
*/
public class CarbondataSplitManager extends HiveSplitManager {
private final CarbonTableReader carbonTableReader;
private final Function<HiveTransactionHandle, SemiTransactionalHiveMetastore> metastoreProvider;
private final HdfsEnvironment hdfsEnvironment;
@Inject public CarbondataSplitManager(HiveClientConfig hiveClientConfig,
Function<HiveTransactionHandle, SemiTransactionalHiveMetastore> metastoreProvider,
NamenodeStats namenodeStats, HdfsEnvironment hdfsEnvironment, DirectoryLister directoryLister,
@ForHiveClient ExecutorService executorService, CoercionPolicy coercionPolicy,
CarbonTableReader reader) {
super(hiveClientConfig, metastoreProvider, namenodeStats, hdfsEnvironment, directoryLister,
executorService, coercionPolicy);
this.carbonTableReader = requireNonNull(reader, "client is null");
this.metastoreProvider = requireNonNull(metastoreProvider, "metastore is null");
this.hdfsEnvironment = requireNonNull(hdfsEnvironment, "hdfsEnvironment is null");
}
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle,
ConnectorSession session, ConnectorTableLayoutHandle layoutHandle,
SplitSchedulingStrategy splitSchedulingStrategy) {
HiveTableLayoutHandle layout = (HiveTableLayoutHandle) layoutHandle;
SchemaTableName schemaTableName = layout.getSchemaTableName();
carbonTableReader.setPrestoQueryId(session.getQueryId());
// get table metadata
SemiTransactionalHiveMetastore metastore =
metastoreProvider.apply((HiveTransactionHandle) transactionHandle);
Table table =
metastore.getTable(schemaTableName.getSchemaName(), schemaTableName.getTableName())
.orElseThrow(() -> new TableNotFoundException(schemaTableName));
if (!table.getStorage().getStorageFormat().getInputFormat().contains("carbon")) {
return super.getSplits(transactionHandle, session, layoutHandle, splitSchedulingStrategy);
}
// for hive metastore, get table location from catalog table's tablePath
String location = table.getStorage().getSerdeParameters().get("tablePath");
if (StringUtils.isEmpty(location)) {
// file metastore case tablePath can be null, so get from location
location = table.getStorage().getLocation();
}
List<PartitionSpec> filteredPartitions = new ArrayList<>();
if (layout.getPartitionColumns().size() > 0 && layout.getPartitions().isPresent()) {
List<String> colNames =
layout.getPartitionColumns().stream().map(x -> ((HiveColumnHandle) x).getName())
.collect(Collectors.toList());
for (HivePartition partition : layout.getPartitions().get()) {
filteredPartitions.add(new PartitionSpec(colNames,
location + CarbonCommonConstants.FILE_SEPARATOR + partition.getPartitionId()));
}
}
String queryId = System.nanoTime() + "";
QueryStatistic statistic = new QueryStatistic();
QueryStatisticsRecorder statisticRecorder = CarbonTimeStatisticsFactory.createDriverRecorder();
statistic.addStatistics(QueryStatisticsConstants.BLOCK_ALLOCATION, System.currentTimeMillis());
statisticRecorder.recordStatisticsForDriver(statistic, queryId);
statistic = new QueryStatistic();
carbonTableReader.setQueryId(queryId);
TupleDomain<HiveColumnHandle> predicate =
(TupleDomain<HiveColumnHandle>) layout.getCompactEffectivePredicate();
Configuration configuration = this.hdfsEnvironment.getConfiguration(
new HdfsEnvironment.HdfsContext(session, schemaTableName.getSchemaName(),
schemaTableName.getTableName()), new Path(location));
configuration = carbonTableReader.updateS3Properties(configuration);
for (Map.Entry<String, String> entry : table.getStorage().getSerdeParameters().entrySet()) {
configuration.set(entry.getKey(), entry.getValue());
}
// set the hadoop configuration to thread local, so that FileFactory can use it.
ThreadLocalSessionInfo.setConfigurationToCurrentThread(configuration);
CarbonTableCacheModel cache =
carbonTableReader.getCarbonCache(schemaTableName, location, configuration);
Expression filters = PrestoFilterUtil.parseFilterExpression(predicate);
try {
List<CarbonLocalMultiBlockSplit> splits =
carbonTableReader.getInputSplits(cache, filters, filteredPartitions, configuration);
ImmutableList.Builder<ConnectorSplit> cSplits = ImmutableList.builder();
long index = 0;
for (CarbonLocalMultiBlockSplit split : splits) {
index++;
Properties properties = new Properties();
for (Map.Entry<String, String> entry : table.getStorage().getSerdeParameters().entrySet()) {
properties.setProperty(entry.getKey(), entry.getValue());
}
properties.setProperty("tablePath", cache.getCarbonTable().getTablePath());
properties.setProperty("carbonSplit", split.getJsonString());
properties.setProperty("queryId", queryId);
properties.setProperty("index", String.valueOf(index));
cSplits.add(new HiveSplit(schemaTableName.getSchemaName(), schemaTableName.getTableName(),
schemaTableName.getTableName(), "", 0, 0, 0, properties, new ArrayList(),
getHostAddresses(split.getLocations()), OptionalInt.empty(), false, predicate,
new HashMap<>(), Optional.empty(), false));
}
statisticRecorder.logStatisticsAsTableDriver();
statistic
.addStatistics(QueryStatisticsConstants.BLOCK_IDENTIFICATION, System.currentTimeMillis());
statisticRecorder.recordStatisticsForDriver(statistic, queryId);
statisticRecorder.logStatisticsAsTableDriver();
return new FixedSplitSource(cSplits.build());
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
}
private static List<HostAddress> getHostAddresses(String[] hosts) {
return Arrays.stream(hosts).map(HostAddress::fromString).collect(toImmutableList());
}
}
| zzcclp/carbondata | integration/presto/src/main/prestodb/org/apache/carbondata/presto/CarbondataSplitManager.java | Java | apache-2.0 | 9,571 |
# AUTOGENERATED FILE
FROM balenalib/var-som-mx6-alpine:edge-run
# remove several traces of python
RUN apk del python*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# install python dependencies
RUN apk add --no-cache ca-certificates libffi \
&& apk add --no-cache libssl1.0 || apk add --no-cache libssl1.1
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
# point Python at a system-provided certificate database. Otherwise, we might hit CERTIFICATE_VERIFY_FAILED.
# https://www.python.org/dev/peps/pep-0476/#trust-database
ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
ENV PYTHON_VERSION 3.6.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& buildDeps=' \
curl \
gnupg \
' \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-alpine-armv7hf-openssl1.1.tar.gz" \
&& echo "9ea800721595b573ee89cb20f4c28fa0273cf726a509bc7fcd21772bd4adefda Python-$PYTHON_VERSION.linux-alpine-armv7hf-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-alpine-armv7hf-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-alpine-armv7hf-openssl1.1.tar.gz" \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Alpine Linux edge \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.6.12, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/python/var-som-mx6/alpine/edge/3.6.12/run/Dockerfile | Dockerfile | apache-2.0 | 4,133 |
package org.manalith.sojipum.db;
import java.sql.SQLException;
import org.manalith.sojipum.R;
import org.manalith.sojipum.model.Item;
import org.manalith.sojipum.model.Mode;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.RuntimeExceptionDao;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_NAME = "SOJIPUM_COMMON";
public static final int DATABASE_VERSION = 1;
private RuntimeExceptionDao<Item, Integer> itemDao = null;
private RuntimeExceptionDao<Mode, Integer> modeDao = null;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION, R.raw.ormlite_config);
}
@Override
public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
try {
Log.i(DatabaseHelper.class.getName(), "onCreate");
TableUtils.createTable(connectionSource, Mode.class);
TableUtils.createTable(connectionSource, Item.class);
} catch (SQLException e) {
Log.e(DatabaseHelper.class.getName(), "Can't create database", e);
throw new RuntimeException(e);
}
}
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource,
int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
public RuntimeExceptionDao<Item, Integer> getItemDao() {
if (itemDao == null) {
itemDao = getRuntimeExceptionDao(Item.class);
}
return itemDao;
}
public RuntimeExceptionDao<Mode, Integer> getModeDao() {
if (modeDao == null) {
modeDao = getRuntimeExceptionDao(Mode.class);
}
return modeDao;
}
}
| mmx900/sojipum | Sojipum/src/org/manalith/sojipum/db/DatabaseHelper.java | Java | apache-2.0 | 1,799 |
package Paws::Pinpoint::UpdateApnsChannel;
use Moose;
has APNSChannelRequest => (is => 'ro', isa => 'Paws::Pinpoint::APNSChannelRequest', required => 1);
has ApplicationId => (is => 'ro', isa => 'Str', traits => ['ParamInURI'], uri_name => 'application-id', required => 1);
use MooseX::ClassAttribute;
class_has _stream_param => (is => 'ro', default => 'APNSChannelRequest');
class_has _api_call => (isa => 'Str', is => 'ro', default => 'UpdateApnsChannel');
class_has _api_uri => (isa => 'Str', is => 'ro', default => '/v1/apps/{application-id}/channels/apns');
class_has _api_method => (isa => 'Str', is => 'ro', default => 'PUT');
class_has _returns => (isa => 'Str', is => 'ro', default => 'Paws::Pinpoint::UpdateApnsChannelResponse');
class_has _result_key => (isa => 'Str', is => 'ro');
1;
### main pod documentation begin ###
=head1 NAME
Paws::Pinpoint::UpdateApnsChannel - Arguments for method UpdateApnsChannel on Paws::Pinpoint
=head1 DESCRIPTION
This class represents the parameters used for calling the method UpdateApnsChannel on the
Amazon Pinpoint service. Use the attributes of this class
as arguments to method UpdateApnsChannel.
You shouldn't make instances of this class. Each attribute should be used as a named argument in the call to UpdateApnsChannel.
As an example:
$service_obj->UpdateApnsChannel(Att1 => $value1, Att2 => $value2, ...);
Values for attributes that are native types (Int, String, Float, etc) can passed as-is (scalar values). Values for complex Types (objects) can be passed as a HashRef. The keys and values of the hashref will be used to instance the underlying object.
=head1 ATTRIBUTES
=head2 B<REQUIRED> APNSChannelRequest => L<Paws::Pinpoint::APNSChannelRequest>
=head2 B<REQUIRED> ApplicationId => Str
=head1 SEE ALSO
This class forms part of L<Paws>, documenting arguments for method UpdateApnsChannel in L<Paws::Pinpoint>
=head1 BUGS and CONTRIBUTIONS
The source code is located here: https://github.com/pplu/aws-sdk-perl
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues
=cut
| ioanrogers/aws-sdk-perl | auto-lib/Paws/Pinpoint/UpdateApnsChannel.pm | Perl | apache-2.0 | 2,099 |
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (9-ea) on Sun Oct 30 18:56:29 UTC 2016 -->
<title>ARBTextureEnvDot3 (LWJGL 3.1.0 - OpenGL)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2016-10-30">
<link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<script type="text/javascript" src="../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../jquery/jquery-1.10.2.js"></script>
<script type="text/javascript" src="../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ARBTextureEnvDot3 (LWJGL 3.1.0 - OpenGL)";
}
}
catch(err) {
}
//-->
var pathtoroot = "../../../";loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../org/lwjgl/opengl/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/lwjgl/opengl/ARBTextureEnvCombine.html" title="class in org.lwjgl.opengl"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../org/lwjgl/opengl/ARBTextureFilterMinmax.html" title="class in org.lwjgl.opengl"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/lwjgl/opengl/ARBTextureEnvDot3.html" target="_top">Frames</a></li>
<li><a href="ARBTextureEnvDot3.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<ul class="navListSearch">
<li><span>SEARCH: </span>
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInClass">Package</span> <a href="../../../org/lwjgl/opengl/package-summary.html" target="classFrame">org.lwjgl.opengl</a></div>
<h2 title="Class ARBTextureEnvDot3" class="title">Class ARBTextureEnvDot3</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.lwjgl.opengl.ARBTextureEnvDot3</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="typeNameLabel">ARBTextureEnvDot3</span>
extends java.lang.Object</pre>
<div class="block">Native bindings to the <a href="http://www.opengl.org/registry/specs/ARB/texture_env_dot3.txt">ARB_texture_env_dot3</a> extension.
<p>Adds new dot product operation to the texture combiner operations.</p>
<p>Requires <a href="../../../org/lwjgl/opengl/ARBMultitexture.html" title="class in org.lwjgl.opengl"><code>ARB_multitexture</code></a> and <a href="../../../org/lwjgl/opengl/ARBTextureEnvCombine.html" title="class in org.lwjgl.opengl"><code>ARB_texture_env_combine</code></a>. Promoted to core in <a href="../../../org/lwjgl/opengl/GL13.html" title="class in org.lwjgl.opengl"><code>OpenGL 1.3</code></a>.</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/lwjgl/opengl/ARBTextureEnvDot3.html#GL_DOT3_RGB_ARB">GL_DOT3_RGB_ARB</a>
<br><a href="../../../org/lwjgl/opengl/ARBTextureEnvDot3.html#GL_DOT3_RGBA_ARB">GL_DOT3_RGBA_ARB</a></span></code>
<div class="block">Accepted by the <code>params</code> parameter of TexEnvf, TexEnvi, TexEnvfv, and TexEnviv when the <code>pname</code> parameter value is COMBINE_RGB_ARB.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="GL_DOT3_RGB_ARB">
<!-- -->
</a>
<a id="GL_DOT3_RGBA_ARB">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4><a href="../../../constant-values.html#org.lwjgl.opengl.ARBTextureEnvDot3.GL_DOT3_RGB_ARB">GL_DOT3_RGB_ARB</a>, <a href="../../../constant-values.html#org.lwjgl.opengl.ARBTextureEnvDot3.GL_DOT3_RGBA_ARB">GL_DOT3_RGBA_ARB</a></h4>
<div class="block">Accepted by the <code>params</code> parameter of TexEnvf, TexEnvi, TexEnvfv, and TexEnviv when the <code>pname</code> parameter value is COMBINE_RGB_ARB.</div>
</li></ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../org/lwjgl/opengl/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/lwjgl/opengl/ARBTextureEnvCombine.html" title="class in org.lwjgl.opengl"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../org/lwjgl/opengl/ARBTextureFilterMinmax.html" title="class in org.lwjgl.opengl"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/lwjgl/opengl/ARBTextureEnvDot3.html" target="_top">Frames</a></li>
<li><a href="ARBTextureEnvDot3.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li>Constr | </li>
<li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li>Constr | </li>
<li>Method</li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small><i>Copyright LWJGL. All Rights Reserved. <a href="https://www.lwjgl.org/license">License terms</a>.</i></small></p>
</footer>
</body>
</html>
| VirtualGamer/SnowEngine | Dependencies/opengl/docs/javadoc/org/lwjgl/opengl/ARBTextureEnvDot3.html | HTML | apache-2.0 | 9,964 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ticket - CASS Javascript Library</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="icon" href="../assets/favicon.ico">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="http://docs.cassproject.org/img/customLogo-blue.png" title="CASS Javascript Library"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 0.5.4</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/3DModel.html">3DModel</a></li>
<li><a href="../classes/AboutPage.html">AboutPage</a></li>
<li><a href="../classes/AcceptAction.html">AcceptAction</a></li>
<li><a href="../classes/Accommodation.html">Accommodation</a></li>
<li><a href="../classes/AccountingService.html">AccountingService</a></li>
<li><a href="../classes/AccreditAction.html">AccreditAction</a></li>
<li><a href="../classes/AchieveAction.html">AchieveAction</a></li>
<li><a href="../classes/Action.html">Action</a></li>
<li><a href="../classes/ActionAccessSpecification.html">ActionAccessSpecification</a></li>
<li><a href="../classes/ActionStatusType.html">ActionStatusType</a></li>
<li><a href="../classes/ActivateAction.html">ActivateAction</a></li>
<li><a href="../classes/AddAction.html">AddAction</a></li>
<li><a href="../classes/AdministrativeArea.html">AdministrativeArea</a></li>
<li><a href="../classes/AdultEntertainment.html">AdultEntertainment</a></li>
<li><a href="../classes/AdvancedStandingAction.html">AdvancedStandingAction</a></li>
<li><a href="../classes/AdvertiserContentArticle.html">AdvertiserContentArticle</a></li>
<li><a href="../classes/Agent.html">Agent</a></li>
<li><a href="../classes/AggregateDataProfile.html">AggregateDataProfile</a></li>
<li><a href="../classes/AggregateOffer.html">AggregateOffer</a></li>
<li><a href="../classes/AggregateRating.html">AggregateRating</a></li>
<li><a href="../classes/AgreeAction.html">AgreeAction</a></li>
<li><a href="../classes/Airline.html">Airline</a></li>
<li><a href="../classes/Airport.html">Airport</a></li>
<li><a href="../classes/AlignmentMap.html">AlignmentMap</a></li>
<li><a href="../classes/AlignmentObject.html">AlignmentObject</a></li>
<li><a href="../classes/AllocateAction.html">AllocateAction</a></li>
<li><a href="../classes/AmpStory.html">AmpStory</a></li>
<li><a href="../classes/AMRadioChannel.html">AMRadioChannel</a></li>
<li><a href="../classes/AmusementPark.html">AmusementPark</a></li>
<li><a href="../classes/AnalysisNewsArticle.html">AnalysisNewsArticle</a></li>
<li><a href="../classes/AnatomicalStructure.html">AnatomicalStructure</a></li>
<li><a href="../classes/AnatomicalSystem.html">AnatomicalSystem</a></li>
<li><a href="../classes/AnimalShelter.html">AnimalShelter</a></li>
<li><a href="../classes/Answer.html">Answer</a></li>
<li><a href="../classes/Apartment.html">Apartment</a></li>
<li><a href="../classes/ApartmentComplex.html">ApartmentComplex</a></li>
<li><a href="../classes/APIReference.html">APIReference</a></li>
<li><a href="../classes/AppendAction.html">AppendAction</a></li>
<li><a href="../classes/ApplyAction.html">ApplyAction</a></li>
<li><a href="../classes/ApprenticeshipCertificate.html">ApprenticeshipCertificate</a></li>
<li><a href="../classes/ApproveAction.html">ApproveAction</a></li>
<li><a href="../classes/ApprovedIndication.html">ApprovedIndication</a></li>
<li><a href="../classes/Aquarium.html">Aquarium</a></li>
<li><a href="../classes/ArchiveComponent.html">ArchiveComponent</a></li>
<li><a href="../classes/ArchiveOrganization.html">ArchiveOrganization</a></li>
<li><a href="../classes/ArriveAction.html">ArriveAction</a></li>
<li><a href="../classes/Artery.html">Artery</a></li>
<li><a href="../classes/ArtGallery.html">ArtGallery</a></li>
<li><a href="../classes/Article.html">Article</a></li>
<li><a href="../classes/AskAction.html">AskAction</a></li>
<li><a href="../classes/AskPublicNewsArticle.html">AskPublicNewsArticle</a></li>
<li><a href="../classes/ASNImport.html">ASNImport</a></li>
<li><a href="../classes/Assertion.html">Assertion</a></li>
<li><a href="../classes/AssertionEnvelope.html">AssertionEnvelope</a></li>
<li><a href="../classes/AssessAction.html">AssessAction</a></li>
<li><a href="../classes/Assessment.html">Assessment</a></li>
<li><a href="../classes/AssessmentComponent.html">AssessmentComponent</a></li>
<li><a href="../classes/AssessmentProfile.html">AssessmentProfile</a></li>
<li><a href="../classes/AssignAction.html">AssignAction</a></li>
<li><a href="../classes/AssociateDegree.html">AssociateDegree</a></li>
<li><a href="../classes/Atlas.html">Atlas</a></li>
<li><a href="../classes/Attitude.html">Attitude</a></li>
<li><a href="../classes/Attorney.html">Attorney</a></li>
<li><a href="../classes/Audience.html">Audience</a></li>
<li><a href="../classes/Audiobook.html">Audiobook</a></li>
<li><a href="../classes/AudioObject.html">AudioObject</a></li>
<li><a href="../classes/AuthorizeAction.html">AuthorizeAction</a></li>
<li><a href="../classes/AutoBodyShop.html">AutoBodyShop</a></li>
<li><a href="../classes/AutoDealer.html">AutoDealer</a></li>
<li><a href="../classes/AutomatedTeller.html">AutomatedTeller</a></li>
<li><a href="../classes/AutomotiveBusiness.html">AutomotiveBusiness</a></li>
<li><a href="../classes/AutoPartsStore.html">AutoPartsStore</a></li>
<li><a href="../classes/AutoRental.html">AutoRental</a></li>
<li><a href="../classes/AutoRepair.html">AutoRepair</a></li>
<li><a href="../classes/AutoWash.html">AutoWash</a></li>
<li><a href="../classes/BachelorDegree.html">BachelorDegree</a></li>
<li><a href="../classes/BackgroundNewsArticle.html">BackgroundNewsArticle</a></li>
<li><a href="../classes/Badge.html">Badge</a></li>
<li><a href="../classes/Bakery.html">Bakery</a></li>
<li><a href="../classes/BankAccount.html">BankAccount</a></li>
<li><a href="../classes/BankOrCreditUnion.html">BankOrCreditUnion</a></li>
<li><a href="../classes/Barcode.html">Barcode</a></li>
<li><a href="../classes/BarOrPub.html">BarOrPub</a></li>
<li><a href="../classes/BasicComponent.html">BasicComponent</a></li>
<li><a href="../classes/Beach.html">Beach</a></li>
<li><a href="../classes/BeautySalon.html">BeautySalon</a></li>
<li><a href="../classes/BedAndBreakfast.html">BedAndBreakfast</a></li>
<li><a href="../classes/BedDetails.html">BedDetails</a></li>
<li><a href="../classes/BedType.html">BedType</a></li>
<li><a href="../classes/BefriendAction.html">BefriendAction</a></li>
<li><a href="../classes/Belief.html">Belief</a></li>
<li><a href="../classes/BikeStore.html">BikeStore</a></li>
<li><a href="../classes/Blog.html">Blog</a></li>
<li><a href="../classes/BlogPosting.html">BlogPosting</a></li>
<li><a href="../classes/BloodTest.html">BloodTest</a></li>
<li><a href="../classes/BoardingPolicyType.html">BoardingPolicyType</a></li>
<li><a href="../classes/BoatReservation.html">BoatReservation</a></li>
<li><a href="../classes/BoatTerminal.html">BoatTerminal</a></li>
<li><a href="../classes/BoatTrip.html">BoatTrip</a></li>
<li><a href="../classes/BodyMeasurementTypeEnumeration.html">BodyMeasurementTypeEnumeration</a></li>
<li><a href="../classes/BodyOfWater.html">BodyOfWater</a></li>
<li><a href="../classes/Bone.html">Bone</a></li>
<li><a href="../classes/Book.html">Book</a></li>
<li><a href="../classes/BookFormatType.html">BookFormatType</a></li>
<li><a href="../classes/BookmarkAction.html">BookmarkAction</a></li>
<li><a href="../classes/BookSeries.html">BookSeries</a></li>
<li><a href="../classes/BookStore.html">BookStore</a></li>
<li><a href="../classes/BorrowAction.html">BorrowAction</a></li>
<li><a href="../classes/BowlingAlley.html">BowlingAlley</a></li>
<li><a href="../classes/BrainStructure.html">BrainStructure</a></li>
<li><a href="../classes/Brand.html">Brand</a></li>
<li><a href="../classes/BreadcrumbList.html">BreadcrumbList</a></li>
<li><a href="../classes/Brewery.html">Brewery</a></li>
<li><a href="../classes/Bridge.html">Bridge</a></li>
<li><a href="../classes/BroadcastChannel.html">BroadcastChannel</a></li>
<li><a href="../classes/BroadcastEvent.html">BroadcastEvent</a></li>
<li><a href="../classes/BroadcastFrequencySpecification.html">BroadcastFrequencySpecification</a></li>
<li><a href="../classes/BroadcastService.html">BroadcastService</a></li>
<li><a href="../classes/BrokerageAccount.html">BrokerageAccount</a></li>
<li><a href="../classes/BuddhistTemple.html">BuddhistTemple</a></li>
<li><a href="../classes/BusinessAudience.html">BusinessAudience</a></li>
<li><a href="../classes/BusinessEntityType.html">BusinessEntityType</a></li>
<li><a href="../classes/BusinessEvent.html">BusinessEvent</a></li>
<li><a href="../classes/BusinessFunction.html">BusinessFunction</a></li>
<li><a href="../classes/BusOrCoach.html">BusOrCoach</a></li>
<li><a href="../classes/BusReservation.html">BusReservation</a></li>
<li><a href="../classes/BusStation.html">BusStation</a></li>
<li><a href="../classes/BusStop.html">BusStop</a></li>
<li><a href="../classes/BusTrip.html">BusTrip</a></li>
<li><a href="../classes/BuyAction.html">BuyAction</a></li>
<li><a href="../classes/CableOrSatelliteService.html">CableOrSatelliteService</a></li>
<li><a href="../classes/CafeOrCoffeeShop.html">CafeOrCoffeeShop</a></li>
<li><a href="../classes/Campground.html">Campground</a></li>
<li><a href="../classes/CampingPitch.html">CampingPitch</a></li>
<li><a href="../classes/Canal.html">Canal</a></li>
<li><a href="../classes/CancelAction.html">CancelAction</a></li>
<li><a href="../classes/Car.html">Car</a></li>
<li><a href="../classes/CarUsageType.html">CarUsageType</a></li>
<li><a href="../classes/Casino.html">Casino</a></li>
<li><a href="../classes/Cass.html">Cass</a></li>
<li><a href="../classes/CategoryCode.html">CategoryCode</a></li>
<li><a href="../classes/CategoryCodeSet.html">CategoryCodeSet</a></li>
<li><a href="../classes/CatholicChurch.html">CatholicChurch</a></li>
<li><a href="../classes/CDCPMDRecord.html">CDCPMDRecord</a></li>
<li><a href="../classes/Cemetery.html">Cemetery</a></li>
<li><a href="../classes/Certificate.html">Certificate</a></li>
<li><a href="../classes/CertificateOfCompletion.html">CertificateOfCompletion</a></li>
<li><a href="../classes/Certification.html">Certification</a></li>
<li><a href="../classes/CfdAssessment.html">CfdAssessment</a></li>
<li><a href="../classes/CfdReference.html">CfdReference</a></li>
<li><a href="../classes/Chapter.html">Chapter</a></li>
<li><a href="../classes/CheckAction.html">CheckAction</a></li>
<li><a href="../classes/CheckInAction.html">CheckInAction</a></li>
<li><a href="../classes/CheckOutAction.html">CheckOutAction</a></li>
<li><a href="../classes/CheckoutPage.html">CheckoutPage</a></li>
<li><a href="../classes/ChildCare.html">ChildCare</a></li>
<li><a href="../classes/ChildrensEvent.html">ChildrensEvent</a></li>
<li><a href="../classes/ChooseAction.html">ChooseAction</a></li>
<li><a href="../classes/Church.html">Church</a></li>
<li><a href="../classes/City.html">City</a></li>
<li><a href="../classes/CityHall.html">CityHall</a></li>
<li><a href="../classes/CivicStructure.html">CivicStructure</a></li>
<li><a href="../classes/Claim.html">Claim</a></li>
<li><a href="../classes/ClaimReview.html">ClaimReview</a></li>
<li><a href="../classes/Class.html">Class</a></li>
<li><a href="../classes/Clip.html">Clip</a></li>
<li><a href="../classes/ClothingStore.html">ClothingStore</a></li>
<li><a href="../classes/CocurricularComponent.html">CocurricularComponent</a></li>
<li><a href="../classes/Code.html">Code</a></li>
<li><a href="../classes/Collection.html">Collection</a></li>
<li><a href="../classes/CollectionPage.html">CollectionPage</a></li>
<li><a href="../classes/CollegeOrUniversity.html">CollegeOrUniversity</a></li>
<li><a href="../classes/ComedyClub.html">ComedyClub</a></li>
<li><a href="../classes/ComedyEvent.html">ComedyEvent</a></li>
<li><a href="../classes/ComicCoverArt.html">ComicCoverArt</a></li>
<li><a href="../classes/ComicIssue.html">ComicIssue</a></li>
<li><a href="../classes/ComicSeries.html">ComicSeries</a></li>
<li><a href="../classes/ComicStory.html">ComicStory</a></li>
<li><a href="../classes/Comment.html">Comment</a></li>
<li><a href="../classes/CommentAction.html">CommentAction</a></li>
<li><a href="../classes/CommunicateAction.html">CommunicateAction</a></li>
<li><a href="../classes/Competency.html">Competency</a></li>
<li><a href="../classes/CompetencyComponent.html">CompetencyComponent</a></li>
<li><a href="../classes/CompetencyFramework.html">CompetencyFramework</a></li>
<li><a href="../classes/CompleteDataFeed.html">CompleteDataFeed</a></li>
<li><a href="../classes/ComponentCondition.html">ComponentCondition</a></li>
<li><a href="../classes/CompoundPriceSpecification.html">CompoundPriceSpecification</a></li>
<li><a href="../classes/ComputerLanguage.html">ComputerLanguage</a></li>
<li><a href="../classes/ComputerStore.html">ComputerStore</a></li>
<li><a href="../classes/Concept.html">Concept</a></li>
<li><a href="../classes/ConceptScheme.html">ConceptScheme</a></li>
<li><a href="../classes/ConditionManifest.html">ConditionManifest</a></li>
<li><a href="../classes/ConditionProfile.html">ConditionProfile</a></li>
<li><a href="../classes/ConfirmAction.html">ConfirmAction</a></li>
<li><a href="../classes/Consortium.html">Consortium</a></li>
<li><a href="../classes/ConsumeAction.html">ConsumeAction</a></li>
<li><a href="../classes/ContactPage.html">ContactPage</a></li>
<li><a href="../classes/ContactPoint.html">ContactPoint</a></li>
<li><a href="../classes/ContactPointOption.html">ContactPointOption</a></li>
<li><a href="../classes/Continent.html">Continent</a></li>
<li><a href="../classes/ControlAction.html">ControlAction</a></li>
<li><a href="../classes/ConvenienceStore.html">ConvenienceStore</a></li>
<li><a href="../classes/Conversation.html">Conversation</a></li>
<li><a href="../classes/CookAction.html">CookAction</a></li>
<li><a href="../classes/Corporation.html">Corporation</a></li>
<li><a href="../classes/CorrectionComment.html">CorrectionComment</a></li>
<li><a href="../classes/CostManifest.html">CostManifest</a></li>
<li><a href="../classes/CostProfile.html">CostProfile</a></li>
<li><a href="../classes/Country.html">Country</a></li>
<li><a href="../classes/Course.html">Course</a></li>
<li><a href="../classes/CourseComponent.html">CourseComponent</a></li>
<li><a href="../classes/CourseInstance.html">CourseInstance</a></li>
<li><a href="../classes/Courthouse.html">Courthouse</a></li>
<li><a href="../classes/CoverArt.html">CoverArt</a></li>
<li><a href="../classes/CovidTestingFacility.html">CovidTestingFacility</a></li>
<li><a href="../classes/CreateAction.html">CreateAction</a></li>
<li><a href="../classes/CreativeWork.html">CreativeWork</a></li>
<li><a href="../classes/CreativeWorkSeason.html">CreativeWorkSeason</a></li>
<li><a href="../classes/CreativeWorkSeries.html">CreativeWorkSeries</a></li>
<li><a href="../classes/Credential.html">Credential</a></li>
<li><a href="../classes/CredentialAlignmentObject.html">CredentialAlignmentObject</a></li>
<li><a href="../classes/CredentialAssertion.html">CredentialAssertion</a></li>
<li><a href="../classes/CredentialComponent.html">CredentialComponent</a></li>
<li><a href="../classes/CredentialFramework.html">CredentialFramework</a></li>
<li><a href="../classes/CredentialingAction.html">CredentialingAction</a></li>
<li><a href="../classes/CredentialOrganization.html">CredentialOrganization</a></li>
<li><a href="../classes/CredentialPerson.html">CredentialPerson</a></li>
<li><a href="../classes/CreditCard.html">CreditCard</a></li>
<li><a href="../classes/Crematorium.html">Crematorium</a></li>
<li><a href="../classes/CriticReview.html">CriticReview</a></li>
<li><a href="../classes/CssSelectorType.html">CssSelectorType</a></li>
<li><a href="../classes/CSVExport.html">CSVExport</a></li>
<li><a href="../classes/CSVImport.html">CSVImport</a></li>
<li><a href="../classes/CurrencyConversionService.html">CurrencyConversionService</a></li>
<li><a href="../classes/DanceEvent.html">DanceEvent</a></li>
<li><a href="../classes/DanceGroup.html">DanceGroup</a></li>
<li><a href="../classes/DataCatalog.html">DataCatalog</a></li>
<li><a href="../classes/DataDownload.html">DataDownload</a></li>
<li><a href="../classes/DataFeed.html">DataFeed</a></li>
<li><a href="../classes/DataFeedItem.html">DataFeedItem</a></li>
<li><a href="../classes/Dataset.html">Dataset</a></li>
<li><a href="../classes/DatedMoneySpecification.html">DatedMoneySpecification</a></li>
<li><a href="../classes/DayOfWeek.html">DayOfWeek</a></li>
<li><a href="../classes/DaySpa.html">DaySpa</a></li>
<li><a href="../classes/DDxElement.html">DDxElement</a></li>
<li><a href="../classes/DeactivateAction.html">DeactivateAction</a></li>
<li><a href="../classes/DefenceEstablishment.html">DefenceEstablishment</a></li>
<li><a href="../classes/DefinedRegion.html">DefinedRegion</a></li>
<li><a href="../classes/DefinedTerm.html">DefinedTerm</a></li>
<li><a href="../classes/DefinedTermSet.html">DefinedTermSet</a></li>
<li><a href="../classes/Degree.html">Degree</a></li>
<li><a href="../classes/DeleteAction.html">DeleteAction</a></li>
<li><a href="../classes/DeliveryChargeSpecification.html">DeliveryChargeSpecification</a></li>
<li><a href="../classes/DeliveryEvent.html">DeliveryEvent</a></li>
<li><a href="../classes/DeliveryMethod.html">DeliveryMethod</a></li>
<li><a href="../classes/DeliveryTimeSettings.html">DeliveryTimeSettings</a></li>
<li><a href="../classes/Demand.html">Demand</a></li>
<li><a href="../classes/Dentist.html">Dentist</a></li>
<li><a href="../classes/DepartAction.html">DepartAction</a></li>
<li><a href="../classes/DepartmentStore.html">DepartmentStore</a></li>
<li><a href="../classes/DepositAccount.html">DepositAccount</a></li>
<li><a href="../classes/DiagnosticLab.html">DiagnosticLab</a></li>
<li><a href="../classes/DiagnosticProcedure.html">DiagnosticProcedure</a></li>
<li><a href="../classes/Diet.html">Diet</a></li>
<li><a href="../classes/DietarySupplement.html">DietarySupplement</a></li>
<li><a href="../classes/DigitalBadge.html">DigitalBadge</a></li>
<li><a href="../classes/DigitalDocument.html">DigitalDocument</a></li>
<li><a href="../classes/DigitalDocumentPermission.html">DigitalDocumentPermission</a></li>
<li><a href="../classes/DigitalDocumentPermissionType.html">DigitalDocumentPermissionType</a></li>
<li><a href="../classes/Diploma.html">Diploma</a></li>
<li><a href="../classes/Directory.html">Directory</a></li>
<li><a href="../classes/DisagreeAction.html">DisagreeAction</a></li>
<li><a href="../classes/DiscoverAction.html">DiscoverAction</a></li>
<li><a href="../classes/DiscussionForumPosting.html">DiscussionForumPosting</a></li>
<li><a href="../classes/DislikeAction.html">DislikeAction</a></li>
<li><a href="../classes/Distance.html">Distance</a></li>
<li><a href="../classes/Distillery.html">Distillery</a></li>
<li><a href="../classes/DoctoralDegree.html">DoctoralDegree</a></li>
<li><a href="../classes/DonateAction.html">DonateAction</a></li>
<li><a href="../classes/DoseSchedule.html">DoseSchedule</a></li>
<li><a href="../classes/DownloadAction.html">DownloadAction</a></li>
<li><a href="../classes/DrawAction.html">DrawAction</a></li>
<li><a href="../classes/Drawing.html">Drawing</a></li>
<li><a href="../classes/DrinkAction.html">DrinkAction</a></li>
<li><a href="../classes/DriveWheelConfigurationValue.html">DriveWheelConfigurationValue</a></li>
<li><a href="../classes/Drug.html">Drug</a></li>
<li><a href="../classes/DrugClass.html">DrugClass</a></li>
<li><a href="../classes/DrugCost.html">DrugCost</a></li>
<li><a href="../classes/DrugCostCategory.html">DrugCostCategory</a></li>
<li><a href="../classes/DrugLegalStatus.html">DrugLegalStatus</a></li>
<li><a href="../classes/DrugPregnancyCategory.html">DrugPregnancyCategory</a></li>
<li><a href="../classes/DrugPrescriptionStatus.html">DrugPrescriptionStatus</a></li>
<li><a href="../classes/DrugStrength.html">DrugStrength</a></li>
<li><a href="../classes/DryCleaningOrLaundry.html">DryCleaningOrLaundry</a></li>
<li><a href="../classes/Duration.html">Duration</a></li>
<li><a href="../classes/DurationProfile.html">DurationProfile</a></li>
<li><a href="../classes/EarningsProfile.html">EarningsProfile</a></li>
<li><a href="../classes/EatAction.html">EatAction</a></li>
<li><a href="../classes/Ebac.html">Ebac</a></li>
<li><a href="../classes/EbacContact.html">EbacContact</a></li>
<li><a href="../classes/EbacContactGrant.html">EbacContactGrant</a></li>
<li><a href="../classes/EbacCredential.html">EbacCredential</a></li>
<li><a href="../classes/EbacCredentialCommit.html">EbacCredentialCommit</a></li>
<li><a href="../classes/EbacCredentialRequest.html">EbacCredentialRequest</a></li>
<li><a href="../classes/EbacCredentials.html">EbacCredentials</a></li>
<li><a href="../classes/EbacEncryptedSecret.html">EbacEncryptedSecret</a></li>
<li><a href="../classes/EbacEncryptedValue.html">EbacEncryptedValue</a></li>
<li><a href="../classes/EbacSignature.html">EbacSignature</a></li>
<li><a href="../classes/EcAes.html">EcAes</a></li>
<li><a href="../classes/EcAesCtr.html">EcAesCtr</a></li>
<li><a href="../classes/EcAesCtrAsync.html">EcAesCtrAsync</a></li>
<li><a href="../classes/EcAesCtrAsyncWorker.html">EcAesCtrAsyncWorker</a></li>
<li><a href="../classes/EcAlignment.html">EcAlignment</a></li>
<li><a href="../classes/EcArray.html">EcArray</a></li>
<li><a href="../classes/EcAsyncHelper.html">EcAsyncHelper</a></li>
<li><a href="../classes/EcCompetency.html">EcCompetency</a></li>
<li><a href="../classes/EcContact.html">EcContact</a></li>
<li><a href="../classes/EcCrypto.html">EcCrypto</a></li>
<li><a href="../classes/EcDirectedGraph.html">EcDirectedGraph</a></li>
<li><a href="../classes/EcDirectory.html">EcDirectory</a></li>
<li><a href="../classes/EcEncryptedValue.html">EcEncryptedValue</a></li>
<li><a href="../classes/EcFile.html">EcFile</a></li>
<li><a href="../classes/EcFramework.html">EcFramework</a></li>
<li><a href="../classes/EcFrameworkGraph.html">EcFrameworkGraph</a></li>
<li><a href="../classes/EcIdentity.html">EcIdentity</a></li>
<li><a href="../classes/EcIdentityManager.html">EcIdentityManager</a></li>
<li><a href="../classes/EcLevel.html">EcLevel</a></li>
<li><a href="../classes/EcLinkedData
/ module.exports = class EcLinkedData {
constructor(context, type) {
this.setContextAndType(context, type);
}
static atProperties = ["id", "type", "schema", "context", "graph"];
/**
JSON-LD @type field..html">EcLinkedData
/ module.exports = class EcLinkedData {
constructor(context, type) {
this.setContextAndType(context, type);
}
static atProperties = ["id", "type", "schema", "context", "graph"];
/**
JSON-LD @type field.</a></li>
<li><a href="../classes/EcObject.html">EcObject</a></li>
<li><a href="../classes/EcPk.html">EcPk</a></li>
<li><a href="../classes/EcPpk.html">EcPpk</a></li>
<li><a href="../classes/EcRemote.html">EcRemote</a></li>
<li><a href="../classes/EcRemoteIdentityManager.html">EcRemoteIdentityManager</a></li>
<li><a href="../classes/EcRemoteLinkedData.html">EcRemoteLinkedData</a></li>
<li><a href="../classes/EcRepository.html">EcRepository</a></li>
<li><a href="../classes/EcRollupRule.html">EcRollupRule</a></li>
<li><a href="../classes/EcRsaOaep.html">EcRsaOaep</a></li>
<li><a href="../classes/EcRsaOaepAsync.html">EcRsaOaepAsync</a></li>
<li><a href="../classes/EducationalAudience.html">EducationalAudience</a></li>
<li><a href="../classes/EducationalOccupationalCredential.html">EducationalOccupationalCredential</a></li>
<li><a href="../classes/EducationalOccupationalProgram.html">EducationalOccupationalProgram</a></li>
<li><a href="../classes/EducationalOrganization.html">EducationalOrganization</a></li>
<li><a href="../classes/EducationEvent.html">EducationEvent</a></li>
<li><a href="../classes/Electrician.html">Electrician</a></li>
<li><a href="../classes/ElectronicsStore.html">ElectronicsStore</a></li>
<li><a href="../classes/ElementarySchool.html">ElementarySchool</a></li>
<li><a href="../classes/EmailMessage.html">EmailMessage</a></li>
<li><a href="../classes/Embassy.html">Embassy</a></li>
<li><a href="../classes/EmergencyService.html">EmergencyService</a></li>
<li><a href="../classes/EmployeeRole.html">EmployeeRole</a></li>
<li><a href="../classes/EmployerAggregateRating.html">EmployerAggregateRating</a></li>
<li><a href="../classes/EmployerReview.html">EmployerReview</a></li>
<li><a href="../classes/EmploymentAgency.html">EmploymentAgency</a></li>
<li><a href="../classes/EmploymentOutcomeProfile.html">EmploymentOutcomeProfile</a></li>
<li><a href="../classes/EndorseAction.html">EndorseAction</a></li>
<li><a href="../classes/EndorsementRating.html">EndorsementRating</a></li>
<li><a href="../classes/Energy.html">Energy</a></li>
<li><a href="../classes/EnergyConsumptionDetails.html">EnergyConsumptionDetails</a></li>
<li><a href="../classes/EnergyEfficiencyEnumeration.html">EnergyEfficiencyEnumeration</a></li>
<li><a href="../classes/EnergyStarEnergyEfficiencyEnumeration.html">EnergyStarEnergyEfficiencyEnumeration</a></li>
<li><a href="../classes/EngineSpecification.html">EngineSpecification</a></li>
<li><a href="../classes/EntertainmentBusiness.html">EntertainmentBusiness</a></li>
<li><a href="../classes/EntryPoint.html">EntryPoint</a></li>
<li><a href="../classes/Enumeration.html">Enumeration</a></li>
<li><a href="../classes/Episode.html">Episode</a></li>
<li><a href="../classes/EUEnergyEfficiencyEnumeration.html">EUEnergyEfficiencyEnumeration</a></li>
<li><a href="../classes/Event.html">Event</a></li>
<li><a href="../classes/EventAttendanceModeEnumeration.html">EventAttendanceModeEnumeration</a></li>
<li><a href="../classes/EventReservation.html">EventReservation</a></li>
<li><a href="../classes/EventSeries.html">EventSeries</a></li>
<li><a href="../classes/EventStatusType.html">EventStatusType</a></li>
<li><a href="../classes/EventVenue.html">EventVenue</a></li>
<li><a href="../classes/ExchangeRateSpecification.html">ExchangeRateSpecification</a></li>
<li><a href="../classes/ExerciseAction.html">ExerciseAction</a></li>
<li><a href="../classes/ExerciseGym.html">ExerciseGym</a></li>
<li><a href="../classes/ExercisePlan.html">ExercisePlan</a></li>
<li><a href="../classes/ExhibitionEvent.html">ExhibitionEvent</a></li>
<li><a href="../classes/Exporter.html">Exporter</a></li>
<li><a href="../classes/ExtracurricularComponent.html">ExtracurricularComponent</a></li>
<li><a href="../classes/FAQPage.html">FAQPage</a></li>
<li><a href="../classes/FastFoodRestaurant.html">FastFoodRestaurant</a></li>
<li><a href="../classes/Festival.html">Festival</a></li>
<li><a href="../classes/FilmAction.html">FilmAction</a></li>
<li><a href="../classes/FinancialAssistanceProfile.html">FinancialAssistanceProfile</a></li>
<li><a href="../classes/FinancialProduct.html">FinancialProduct</a></li>
<li><a href="../classes/FinancialService.html">FinancialService</a></li>
<li><a href="../classes/FindAction.html">FindAction</a></li>
<li><a href="../classes/FireStation.html">FireStation</a></li>
<li><a href="../classes/Flight.html">Flight</a></li>
<li><a href="../classes/FlightReservation.html">FlightReservation</a></li>
<li><a href="../classes/FloorPlan.html">FloorPlan</a></li>
<li><a href="../classes/Florist.html">Florist</a></li>
<li><a href="../classes/FMRadioChannel.html">FMRadioChannel</a></li>
<li><a href="../classes/FollowAction.html">FollowAction</a></li>
<li><a href="../classes/FoodEstablishment.html">FoodEstablishment</a></li>
<li><a href="../classes/FoodEstablishmentReservation.html">FoodEstablishmentReservation</a></li>
<li><a href="../classes/FoodEvent.html">FoodEvent</a></li>
<li><a href="../classes/FoodService.html">FoodService</a></li>
<li><a href="../classes/Framework.html">Framework</a></li>
<li><a href="../classes/FrameworkImport.html">FrameworkImport</a></li>
<li><a href="../classes/FundingAgency.html">FundingAgency</a></li>
<li><a href="../classes/FundingScheme.html">FundingScheme</a></li>
<li><a href="../classes/FurnitureStore.html">FurnitureStore</a></li>
<li><a href="../classes/Game.html">Game</a></li>
<li><a href="../classes/GamePlayMode.html">GamePlayMode</a></li>
<li><a href="../classes/GameServer.html">GameServer</a></li>
<li><a href="../classes/GameServerStatus.html">GameServerStatus</a></li>
<li><a href="../classes/GardenStore.html">GardenStore</a></li>
<li><a href="../classes/GasStation.html">GasStation</a></li>
<li><a href="../classes/GatedResidenceCommunity.html">GatedResidenceCommunity</a></li>
<li><a href="../classes/GenderType.html">GenderType</a></li>
<li><a href="../classes/General.html">General</a></li>
<li><a href="../classes/GeneralContractor.html">GeneralContractor</a></li>
<li><a href="../classes/GeneralEducationDevelopment.html">GeneralEducationDevelopment</a></li>
<li><a href="../classes/GeneralFile.html">GeneralFile</a></li>
<li><a href="../classes/GeoCircle.html">GeoCircle</a></li>
<li><a href="../classes/GeoCoordinates.html">GeoCoordinates</a></li>
<li><a href="../classes/GeoShape.html">GeoShape</a></li>
<li><a href="../classes/GeospatialGeometry.html">GeospatialGeometry</a></li>
<li><a href="../classes/GiveAction.html">GiveAction</a></li>
<li><a href="../classes/GolfCourse.html">GolfCourse</a></li>
<li><a href="../classes/GovernmentBenefitsType.html">GovernmentBenefitsType</a></li>
<li><a href="../classes/GovernmentBuilding.html">GovernmentBuilding</a></li>
<li><a href="../classes/GovernmentOffice.html">GovernmentOffice</a></li>
<li><a href="../classes/GovernmentOrganization.html">GovernmentOrganization</a></li>
<li><a href="../classes/GovernmentPermit.html">GovernmentPermit</a></li>
<li><a href="../classes/GovernmentService.html">GovernmentService</a></li>
<li><a href="../classes/Grant.html">Grant</a></li>
<li><a href="../classes/Graph.html">Graph</a></li>
<li><a href="../classes/GroceryStore.html">GroceryStore</a></li>
<li><a href="../classes/Guide.html">Guide</a></li>
<li><a href="../classes/Hackathon.html">Hackathon</a></li>
<li><a href="../classes/HairSalon.html">HairSalon</a></li>
<li><a href="../classes/HardwareStore.html">HardwareStore</a></li>
<li><a href="../classes/HealthAndBeautyBusiness.html">HealthAndBeautyBusiness</a></li>
<li><a href="../classes/HealthAspectEnumeration.html">HealthAspectEnumeration</a></li>
<li><a href="../classes/HealthClub.html">HealthClub</a></li>
<li><a href="../classes/HealthInsurancePlan.html">HealthInsurancePlan</a></li>
<li><a href="../classes/HealthPlanCostSharingSpecification.html">HealthPlanCostSharingSpecification</a></li>
<li><a href="../classes/HealthPlanFormulary.html">HealthPlanFormulary</a></li>
<li><a href="../classes/HealthPlanNetwork.html">HealthPlanNetwork</a></li>
<li><a href="../classes/HealthTopicContent.html">HealthTopicContent</a></li>
<li><a href="../classes/HighSchool.html">HighSchool</a></li>
<li><a href="../classes/HinduTemple.html">HinduTemple</a></li>
<li><a href="../classes/HobbyShop.html">HobbyShop</a></li>
<li><a href="../classes/HoldersProfile.html">HoldersProfile</a></li>
<li><a href="../classes/HomeAndConstructionBusiness.html">HomeAndConstructionBusiness</a></li>
<li><a href="../classes/HomeGoodsStore.html">HomeGoodsStore</a></li>
<li><a href="../classes/Hospital.html">Hospital</a></li>
<li><a href="../classes/Hostel.html">Hostel</a></li>
<li><a href="../classes/Hotel.html">Hotel</a></li>
<li><a href="../classes/HotelRoom.html">HotelRoom</a></li>
<li><a href="../classes/House.html">House</a></li>
<li><a href="../classes/HousePainter.html">HousePainter</a></li>
<li><a href="../classes/HowTo.html">HowTo</a></li>
<li><a href="../classes/HowToDirection.html">HowToDirection</a></li>
<li><a href="../classes/HowToItem.html">HowToItem</a></li>
<li><a href="../classes/HowToSection.html">HowToSection</a></li>
<li><a href="../classes/HowToStep.html">HowToStep</a></li>
<li><a href="../classes/HowToSupply.html">HowToSupply</a></li>
<li><a href="../classes/HowToTip.html">HowToTip</a></li>
<li><a href="../classes/HowToTool.html">HowToTool</a></li>
<li><a href="../classes/HVACBusiness.html">HVACBusiness</a></li>
<li><a href="../classes/Hypergraph.html">Hypergraph</a></li>
<li><a href="../classes/HyperToc.html">HyperToc</a></li>
<li><a href="../classes/HyperTocEntry.html">HyperTocEntry</a></li>
<li><a href="../classes/IceCreamShop.html">IceCreamShop</a></li>
<li><a href="../classes/IdentifierValue.html">IdentifierValue</a></li>
<li><a href="../classes/IgnoreAction.html">IgnoreAction</a></li>
<li><a href="../classes/ImageGallery.html">ImageGallery</a></li>
<li><a href="../classes/ImageObject.html">ImageObject</a></li>
<li><a href="../classes/ImagingTest.html">ImagingTest</a></li>
<li><a href="../classes/Importer.html">Importer</a></li>
<li><a href="../classes/IndividualProduct.html">IndividualProduct</a></li>
<li><a href="../classes/IndustryClassification.html">IndustryClassification</a></li>
<li><a href="../classes/InfectiousAgentClass.html">InfectiousAgentClass</a></li>
<li><a href="../classes/InfectiousDisease.html">InfectiousDisease</a></li>
<li><a href="../classes/InformAction.html">InformAction</a></li>
<li><a href="../classes/InsertAction.html">InsertAction</a></li>
<li><a href="../classes/InstallAction.html">InstallAction</a></li>
<li><a href="../classes/InstructionalProgramClassification.html">InstructionalProgramClassification</a></li>
<li><a href="../classes/InsuranceAgency.html">InsuranceAgency</a></li>
<li><a href="../classes/Intangible.html">Intangible</a></li>
<li><a href="../classes/InteractAction.html">InteractAction</a></li>
<li><a href="../classes/InteractionCounter.html">InteractionCounter</a></li>
<li><a href="../classes/InternetCafe.html">InternetCafe</a></li>
<li><a href="../classes/InvestmentFund.html">InvestmentFund</a></li>
<li><a href="../classes/InvestmentOrDeposit.html">InvestmentOrDeposit</a></li>
<li><a href="../classes/InviteAction.html">InviteAction</a></li>
<li><a href="../classes/Invoice.html">Invoice</a></li>
<li><a href="../classes/ItemAvailability.html">ItemAvailability</a></li>
<li><a href="../classes/ItemList.html">ItemList</a></li>
<li><a href="../classes/ItemListOrderType.html">ItemListOrderType</a></li>
<li><a href="../classes/ItemPage.html">ItemPage</a></li>
<li><a href="../classes/JewelryStore.html">JewelryStore</a></li>
<li><a href="../classes/Job.html">Job</a></li>
<li><a href="../classes/JobComponent.html">JobComponent</a></li>
<li><a href="../classes/JobPosting.html">JobPosting</a></li>
<li><a href="../classes/JoinAction.html">JoinAction</a></li>
<li><a href="../classes/Joint.html">Joint</a></li>
<li><a href="../classes/JourneymanCertificate.html">JourneymanCertificate</a></li>
<li><a href="../classes/JurisdictionProfile.html">JurisdictionProfile</a></li>
<li><a href="../classes/Knowledge.html">Knowledge</a></li>
<li><a href="../classes/LakeBodyOfWater.html">LakeBodyOfWater</a></li>
<li><a href="../classes/Landform.html">Landform</a></li>
<li><a href="../classes/LandmarksOrHistoricalBuildings.html">LandmarksOrHistoricalBuildings</a></li>
<li><a href="../classes/Language.html">Language</a></li>
<li><a href="../classes/LearningOpportunity.html">LearningOpportunity</a></li>
<li><a href="../classes/LearningOpportunityProfile.html">LearningOpportunityProfile</a></li>
<li><a href="../classes/LearningResource.html">LearningResource</a></li>
<li><a href="../classes/LeaveAction.html">LeaveAction</a></li>
<li><a href="../classes/LegalForceStatus.html">LegalForceStatus</a></li>
<li><a href="../classes/LegalService.html">LegalService</a></li>
<li><a href="../classes/LegalValueLevel.html">LegalValueLevel</a></li>
<li><a href="../classes/Legislation.html">Legislation</a></li>
<li><a href="../classes/LegislationObject.html">LegislationObject</a></li>
<li><a href="../classes/LegislativeBuilding.html">LegislativeBuilding</a></li>
<li><a href="../classes/LendAction.html">LendAction</a></li>
<li><a href="../classes/Level.html">Level</a></li>
<li><a href="../classes/Library.html">Library</a></li>
<li><a href="../classes/LibrarySystem.html">LibrarySystem</a></li>
<li><a href="../classes/License.html">License</a></li>
<li><a href="../classes/LifestyleModification.html">LifestyleModification</a></li>
<li><a href="../classes/Ligament.html">Ligament</a></li>
<li><a href="../classes/LikeAction.html">LikeAction</a></li>
<li><a href="../classes/LinkRole.html">LinkRole</a></li>
<li><a href="../classes/LiquorStore.html">LiquorStore</a></li>
<li><a href="../classes/ListenAction.html">ListenAction</a></li>
<li><a href="../classes/ListItem.html">ListItem</a></li>
<li><a href="../classes/LiteraryEvent.html">LiteraryEvent</a></li>
<li><a href="../classes/LiveBlogPosting.html">LiveBlogPosting</a></li>
<li><a href="../classes/LoanOrCredit.html">LoanOrCredit</a></li>
<li><a href="../classes/LocalBusiness.html">LocalBusiness</a></li>
<li><a href="../classes/LocationFeatureSpecification.html">LocationFeatureSpecification</a></li>
<li><a href="../classes/Locksmith.html">Locksmith</a></li>
<li><a href="../classes/LodgingBusiness.html">LodgingBusiness</a></li>
<li><a href="../classes/LodgingReservation.html">LodgingReservation</a></li>
<li><a href="../classes/LoseAction.html">LoseAction</a></li>
<li><a href="../classes/LymphaticVessel.html">LymphaticVessel</a></li>
<li><a href="../classes/Manuscript.html">Manuscript</a></li>
<li><a href="../classes/Map.html">Map</a></li>
<li><a href="../classes/MapCategoryType.html">MapCategoryType</a></li>
<li><a href="../classes/MarryAction.html">MarryAction</a></li>
<li><a href="../classes/Mass.html">Mass</a></li>
<li><a href="../classes/MasterCertificate.html">MasterCertificate</a></li>
<li><a href="../classes/MasterDegree.html">MasterDegree</a></li>
<li><a href="../classes/MathSolver.html">MathSolver</a></li>
<li><a href="../classes/MaximumDoseSchedule.html">MaximumDoseSchedule</a></li>
<li><a href="../classes/MeasurementTypeEnumeration.html">MeasurementTypeEnumeration</a></li>
<li><a href="../classes/MedbiqImport.html">MedbiqImport</a></li>
<li><a href="../classes/MediaGallery.html">MediaGallery</a></li>
<li><a href="../classes/MediaManipulationRatingEnumeration.html">MediaManipulationRatingEnumeration</a></li>
<li><a href="../classes/MediaObject.html">MediaObject</a></li>
<li><a href="../classes/MediaReview.html">MediaReview</a></li>
<li><a href="../classes/MediaSubscription.html">MediaSubscription</a></li>
<li><a href="../classes/MedicalAudience.html">MedicalAudience</a></li>
<li><a href="../classes/MedicalAudienceType.html">MedicalAudienceType</a></li>
<li><a href="../classes/MedicalBusiness.html">MedicalBusiness</a></li>
<li><a href="../classes/MedicalCause.html">MedicalCause</a></li>
<li><a href="../classes/MedicalClinic.html">MedicalClinic</a></li>
<li><a href="../classes/MedicalCode.html">MedicalCode</a></li>
<li><a href="../classes/MedicalCondition.html">MedicalCondition</a></li>
<li><a href="../classes/MedicalConditionStage.html">MedicalConditionStage</a></li>
<li><a href="../classes/MedicalContraindication.html">MedicalContraindication</a></li>
<li><a href="../classes/MedicalDevice.html">MedicalDevice</a></li>
<li><a href="../classes/MedicalDevicePurpose.html">MedicalDevicePurpose</a></li>
<li><a href="../classes/MedicalEntity.html">MedicalEntity</a></li>
<li><a href="../classes/MedicalEnumeration.html">MedicalEnumeration</a></li>
<li><a href="../classes/MedicalEvidenceLevel.html">MedicalEvidenceLevel</a></li>
<li><a href="../classes/MedicalGuideline.html">MedicalGuideline</a></li>
<li><a href="../classes/MedicalGuidelineContraindication.html">MedicalGuidelineContraindication</a></li>
<li><a href="../classes/MedicalGuidelineRecommendation.html">MedicalGuidelineRecommendation</a></li>
<li><a href="../classes/MedicalImagingTechnique.html">MedicalImagingTechnique</a></li>
<li><a href="../classes/MedicalIndication.html">MedicalIndication</a></li>
<li><a href="../classes/MedicalIntangible.html">MedicalIntangible</a></li>
<li><a href="../classes/MedicalObservationalStudy.html">MedicalObservationalStudy</a></li>
<li><a href="../classes/MedicalObservationalStudyDesign.html">MedicalObservationalStudyDesign</a></li>
<li><a href="../classes/MedicalOrganization.html">MedicalOrganization</a></li>
<li><a href="../classes/MedicalProcedure.html">MedicalProcedure</a></li>
<li><a href="../classes/MedicalProcedureType.html">MedicalProcedureType</a></li>
<li><a href="../classes/MedicalRiskCalculator.html">MedicalRiskCalculator</a></li>
<li><a href="../classes/MedicalRiskEstimator.html">MedicalRiskEstimator</a></li>
<li><a href="../classes/MedicalRiskFactor.html">MedicalRiskFactor</a></li>
<li><a href="../classes/MedicalRiskScore.html">MedicalRiskScore</a></li>
<li><a href="../classes/MedicalScholarlyArticle.html">MedicalScholarlyArticle</a></li>
<li><a href="../classes/MedicalSign.html">MedicalSign</a></li>
<li><a href="../classes/MedicalSignOrSymptom.html">MedicalSignOrSymptom</a></li>
<li><a href="../classes/MedicalSpecialty.html">MedicalSpecialty</a></li>
<li><a href="../classes/MedicalStudy.html">MedicalStudy</a></li>
<li><a href="../classes/MedicalStudyStatus.html">MedicalStudyStatus</a></li>
<li><a href="../classes/MedicalSymptom.html">MedicalSymptom</a></li>
<li><a href="../classes/MedicalTest.html">MedicalTest</a></li>
<li><a href="../classes/MedicalTestPanel.html">MedicalTestPanel</a></li>
<li><a href="../classes/MedicalTherapy.html">MedicalTherapy</a></li>
<li><a href="../classes/MedicalTrial.html">MedicalTrial</a></li>
<li><a href="../classes/MedicalTrialDesign.html">MedicalTrialDesign</a></li>
<li><a href="../classes/MedicalWebPage.html">MedicalWebPage</a></li>
<li><a href="../classes/MedicineSystem.html">MedicineSystem</a></li>
<li><a href="../classes/MeetingRoom.html">MeetingRoom</a></li>
<li><a href="../classes/MensClothingStore.html">MensClothingStore</a></li>
<li><a href="../classes/Menu.html">Menu</a></li>
<li><a href="../classes/MenuItem.html">MenuItem</a></li>
<li><a href="../classes/MenuSection.html">MenuSection</a></li>
<li><a href="../classes/MerchantReturnEnumeration.html">MerchantReturnEnumeration</a></li>
<li><a href="../classes/MerchantReturnPolicy.html">MerchantReturnPolicy</a></li>
<li><a href="../classes/Message.html">Message</a></li>
<li><a href="../classes/MicroCredential.html">MicroCredential</a></li>
<li><a href="../classes/MiddleSchool.html">MiddleSchool</a></li>
<li><a href="../classes/MobileApplication.html">MobileApplication</a></li>
<li><a href="../classes/MobilePhoneStore.html">MobilePhoneStore</a></li>
<li><a href="../classes/MonetaryAmount.html">MonetaryAmount</a></li>
<li><a href="../classes/MonetaryAmountDistribution.html">MonetaryAmountDistribution</a></li>
<li><a href="../classes/MonetaryGrant.html">MonetaryGrant</a></li>
<li><a href="../classes/MoneyTransfer.html">MoneyTransfer</a></li>
<li><a href="../classes/MortgageLoan.html">MortgageLoan</a></li>
<li><a href="../classes/Mosque.html">Mosque</a></li>
<li><a href="../classes/Motel.html">Motel</a></li>
<li><a href="../classes/Motorcycle.html">Motorcycle</a></li>
<li><a href="../classes/MotorcycleDealer.html">MotorcycleDealer</a></li>
<li><a href="../classes/MotorcycleRepair.html">MotorcycleRepair</a></li>
<li><a href="../classes/MotorizedBicycle.html">MotorizedBicycle</a></li>
<li><a href="../classes/Mountain.html">Mountain</a></li>
<li><a href="../classes/MoveAction.html">MoveAction</a></li>
<li><a href="../classes/Movie.html">Movie</a></li>
<li><a href="../classes/MovieClip.html">MovieClip</a></li>
<li><a href="../classes/MovieRentalStore.html">MovieRentalStore</a></li>
<li><a href="../classes/MovieSeries.html">MovieSeries</a></li>
<li><a href="../classes/MovieTheater.html">MovieTheater</a></li>
<li><a href="../classes/MovingCompany.html">MovingCompany</a></li>
<li><a href="../classes/Muscle.html">Muscle</a></li>
<li><a href="../classes/Museum.html">Museum</a></li>
<li><a href="../classes/MusicAlbum.html">MusicAlbum</a></li>
<li><a href="../classes/MusicAlbumProductionType.html">MusicAlbumProductionType</a></li>
<li><a href="../classes/MusicAlbumReleaseType.html">MusicAlbumReleaseType</a></li>
<li><a href="../classes/MusicComposition.html">MusicComposition</a></li>
<li><a href="../classes/MusicEvent.html">MusicEvent</a></li>
<li><a href="../classes/MusicGroup.html">MusicGroup</a></li>
<li><a href="../classes/MusicPlaylist.html">MusicPlaylist</a></li>
<li><a href="../classes/MusicRecording.html">MusicRecording</a></li>
<li><a href="../classes/MusicRelease.html">MusicRelease</a></li>
<li><a href="../classes/MusicReleaseFormatType.html">MusicReleaseFormatType</a></li>
<li><a href="../classes/MusicStore.html">MusicStore</a></li>
<li><a href="../classes/MusicVenue.html">MusicVenue</a></li>
<li><a href="../classes/MusicVideoObject.html">MusicVideoObject</a></li>
<li><a href="../classes/NailSalon.html">NailSalon</a></li>
<li><a href="../classes/Nerve.html">Nerve</a></li>
<li><a href="../classes/NewsArticle.html">NewsArticle</a></li>
<li><a href="../classes/NewsMediaOrganization.html">NewsMediaOrganization</a></li>
<li><a href="../classes/Newspaper.html">Newspaper</a></li>
<li><a href="../classes/NGO.html">NGO</a></li>
<li><a href="../classes/NightClub.html">NightClub</a></li>
<li><a href="../classes/NLNonprofitType.html">NLNonprofitType</a></li>
<li><a href="../classes/NonprofitType.html">NonprofitType</a></li>
<li><a href="../classes/Notary.html">Notary</a></li>
<li><a href="../classes/NoteDigitalDocument.html">NoteDigitalDocument</a></li>
<li><a href="../classes/NutritionInformation.html">NutritionInformation</a></li>
<li><a href="../classes/Observation.html">Observation</a></li>
<li><a href="../classes/Occupation.html">Occupation</a></li>
<li><a href="../classes/OccupationalExperienceRequirements.html">OccupationalExperienceRequirements</a></li>
<li><a href="../classes/OccupationalTherapy.html">OccupationalTherapy</a></li>
<li><a href="../classes/OccupationClassification.html">OccupationClassification</a></li>
<li><a href="../classes/OceanBodyOfWater.html">OceanBodyOfWater</a></li>
<li><a href="../classes/Offer.html">Offer</a></li>
<li><a href="../classes/OfferAction.html">OfferAction</a></li>
<li><a href="../classes/OfferCatalog.html">OfferCatalog</a></li>
<li><a href="../classes/OfferForLease.html">OfferForLease</a></li>
<li><a href="../classes/OfferForPurchase.html">OfferForPurchase</a></li>
<li><a href="../classes/OfferItemCondition.html">OfferItemCondition</a></li>
<li><a href="../classes/OfferShippingDetails.html">OfferShippingDetails</a></li>
<li><a href="../classes/OfficeEquipmentStore.html">OfficeEquipmentStore</a></li>
<li><a href="../classes/OnDemandEvent.html">OnDemandEvent</a></li>
<li><a href="../classes/OpenBadge.html">OpenBadge</a></li>
<li><a href="../classes/OpeningHoursSpecification.html">OpeningHoursSpecification</a></li>
<li><a href="../classes/OpinionNewsArticle.html">OpinionNewsArticle</a></li>
<li><a href="../classes/Optician.html">Optician</a></li>
<li><a href="../classes/Order.html">Order</a></li>
<li><a href="../classes/OrderAction.html">OrderAction</a></li>
<li><a href="../classes/OrderedCollection.html">OrderedCollection</a></li>
<li><a href="../classes/OrderItem.html">OrderItem</a></li>
<li><a href="../classes/OrderStatus.html">OrderStatus</a></li>
<li><a href="../classes/Organization.html">Organization</a></li>
<li><a href="../classes/OrganizationRole.html">OrganizationRole</a></li>
<li><a href="../classes/OrganizeAction.html">OrganizeAction</a></li>
<li><a href="../classes/OutletStore.html">OutletStore</a></li>
<li><a href="../classes/OwnershipInfo.html">OwnershipInfo</a></li>
<li><a href="../classes/PaintAction.html">PaintAction</a></li>
<li><a href="../classes/Painting.html">Painting</a></li>
<li><a href="../classes/PalliativeProcedure.html">PalliativeProcedure</a></li>
<li><a href="../classes/ParcelDelivery.html">ParcelDelivery</a></li>
<li><a href="../classes/ParentAudience.html">ParentAudience</a></li>
<li><a href="../classes/Park.html">Park</a></li>
<li><a href="../classes/ParkingFacility.html">ParkingFacility</a></li>
<li><a href="../classes/PathologyTest.html">PathologyTest</a></li>
<li><a href="../classes/Pathway.html">Pathway</a></li>
<li><a href="../classes/PathwayComponent.html">PathwayComponent</a></li>
<li><a href="../classes/PathwaySet.html">PathwaySet</a></li>
<li><a href="../classes/Patient.html">Patient</a></li>
<li><a href="../classes/PawnShop.html">PawnShop</a></li>
<li><a href="../classes/PayAction.html">PayAction</a></li>
<li><a href="../classes/PaymentCard.html">PaymentCard</a></li>
<li><a href="../classes/PaymentChargeSpecification.html">PaymentChargeSpecification</a></li>
<li><a href="../classes/PaymentMethod.html">PaymentMethod</a></li>
<li><a href="../classes/PaymentService.html">PaymentService</a></li>
<li><a href="../classes/PaymentStatusType.html">PaymentStatusType</a></li>
<li><a href="../classes/PeopleAudience.html">PeopleAudience</a></li>
<li><a href="../classes/PerformAction.html">PerformAction</a></li>
<li><a href="../classes/PerformanceRole.html">PerformanceRole</a></li>
<li><a href="../classes/PerformingArtsTheater.html">PerformingArtsTheater</a></li>
<li><a href="../classes/PerformingGroup.html">PerformingGroup</a></li>
<li><a href="../classes/Periodical.html">Periodical</a></li>
<li><a href="../classes/Permit.html">Permit</a></li>
<li><a href="../classes/Person.html">Person</a></li>
<li><a href="../classes/PetStore.html">PetStore</a></li>
<li><a href="../classes/Pharmacy.html">Pharmacy</a></li>
<li><a href="../classes/Photograph.html">Photograph</a></li>
<li><a href="../classes/PhotographAction.html">PhotographAction</a></li>
<li><a href="../classes/PhysicalActivity.html">PhysicalActivity</a></li>
<li><a href="../classes/PhysicalActivityCategory.html">PhysicalActivityCategory</a></li>
<li><a href="../classes/PhysicalExam.html">PhysicalExam</a></li>
<li><a href="../classes/PhysicalTherapy.html">PhysicalTherapy</a></li>
<li><a href="../classes/Physician.html">Physician</a></li>
<li><a href="../classes/Place.html">Place</a></li>
<li><a href="../classes/PlaceOfWorship.html">PlaceOfWorship</a></li>
<li><a href="../classes/PlanAction.html">PlanAction</a></li>
<li><a href="../classes/Play.html">Play</a></li>
<li><a href="../classes/PlayAction.html">PlayAction</a></li>
<li><a href="../classes/Playground.html">Playground</a></li>
<li><a href="../classes/Plumber.html">Plumber</a></li>
<li><a href="../classes/PodcastEpisode.html">PodcastEpisode</a></li>
<li><a href="../classes/PodcastSeason.html">PodcastSeason</a></li>
<li><a href="../classes/PodcastSeries.html">PodcastSeries</a></li>
<li><a href="../classes/PoliceStation.html">PoliceStation</a></li>
<li><a href="../classes/Pond.html">Pond</a></li>
<li><a href="../classes/PostalAddress.html">PostalAddress</a></li>
<li><a href="../classes/PostalCodeRangeSpecification.html">PostalCodeRangeSpecification</a></li>
<li><a href="../classes/Poster.html">Poster</a></li>
<li><a href="../classes/PostOffice.html">PostOffice</a></li>
<li><a href="../classes/PreOrderAction.html">PreOrderAction</a></li>
<li><a href="../classes/PrependAction.html">PrependAction</a></li>
<li><a href="../classes/Preschool.html">Preschool</a></li>
<li><a href="../classes/PresentationDigitalDocument.html">PresentationDigitalDocument</a></li>
<li><a href="../classes/PreventionIndication.html">PreventionIndication</a></li>
<li><a href="../classes/PriceComponentTypeEnumeration.html">PriceComponentTypeEnumeration</a></li>
<li><a href="../classes/PriceSpecification.html">PriceSpecification</a></li>
<li><a href="../classes/PriceTypeEnumeration.html">PriceTypeEnumeration</a></li>
<li><a href="../classes/ProcessProfile.html">ProcessProfile</a></li>
<li><a href="../classes/Product.html">Product</a></li>
<li><a href="../classes/ProductCollection.html">ProductCollection</a></li>
<li><a href="../classes/ProductGroup.html">ProductGroup</a></li>
<li><a href="../classes/ProductModel.html">ProductModel</a></li>
<li><a href="../classes/ProductReturnEnumeration.html">ProductReturnEnumeration</a></li>
<li><a href="../classes/ProductReturnPolicy.html">ProductReturnPolicy</a></li>
<li><a href="../classes/ProfessionalDoctorate.html">ProfessionalDoctorate</a></li>
<li><a href="../classes/ProfessionalService.html">ProfessionalService</a></li>
<li><a href="../classes/ProficiencyScale.html">ProficiencyScale</a></li>
<li><a href="../classes/ProfilePage.html">ProfilePage</a></li>
<li><a href="../classes/ProgramMembership.html">ProgramMembership</a></li>
<li><a href="../classes/ProgressionLevel.html">ProgressionLevel</a></li>
<li><a href="../classes/ProgressionModel.html">ProgressionModel</a></li>
<li><a href="../classes/Project.html">Project</a></li>
<li><a href="../classes/PronounceableText.html">PronounceableText</a></li>
<li><a href="../classes/Property.html">Property</a></li>
<li><a href="../classes/PropertyValue.html">PropertyValue</a></li>
<li><a href="../classes/PropertyValueSpecification.html">PropertyValueSpecification</a></li>
<li><a href="../classes/PsychologicalTreatment.html">PsychologicalTreatment</a></li>
<li><a href="../classes/PublicationEvent.html">PublicationEvent</a></li>
<li><a href="../classes/PublicationIssue.html">PublicationIssue</a></li>
<li><a href="../classes/PublicationVolume.html">PublicationVolume</a></li>
<li><a href="../classes/PublicSwimmingPool.html">PublicSwimmingPool</a></li>
<li><a href="../classes/PublicToilet.html">PublicToilet</a></li>
<li><a href="../classes/QACredentialOrganization.html">QACredentialOrganization</a></li>
<li><a href="../classes/QAPage.html">QAPage</a></li>
<li><a href="../classes/QualitativeValue.html">QualitativeValue</a></li>
<li><a href="../classes/QualityAssuranceCredential.html">QualityAssuranceCredential</a></li>
<li><a href="../classes/QuantitativeValue.html">QuantitativeValue</a></li>
<li><a href="../classes/QuantitativeValueDistribution.html">QuantitativeValueDistribution</a></li>
<li><a href="../classes/Quantity.html">Quantity</a></li>
<li><a href="../classes/Question.html">Question</a></li>
<li><a href="../classes/Quiz.html">Quiz</a></li>
<li><a href="../classes/Quotation.html">Quotation</a></li>
<li><a href="../classes/QuoteAction.html">QuoteAction</a></li>
<li><a href="../classes/RadiationTherapy.html">RadiationTherapy</a></li>
<li><a href="../classes/RadioBroadcastService.html">RadioBroadcastService</a></li>
<li><a href="../classes/RadioChannel.html">RadioChannel</a></li>
<li><a href="../classes/RadioClip.html">RadioClip</a></li>
<li><a href="../classes/RadioEpisode.html">RadioEpisode</a></li>
<li><a href="../classes/RadioSeason.html">RadioSeason</a></li>
<li><a href="../classes/RadioSeries.html">RadioSeries</a></li>
<li><a href="../classes/RadioStation.html">RadioStation</a></li>
<li><a href="../classes/Rating.html">Rating</a></li>
<li><a href="../classes/ReactAction.html">ReactAction</a></li>
<li><a href="../classes/ReadAction.html">ReadAction</a></li>
<li><a href="../classes/RealEstateAgent.html">RealEstateAgent</a></li>
<li><a href="../classes/RealEstateListing.html">RealEstateListing</a></li>
<li><a href="../classes/ReceiveAction.html">ReceiveAction</a></li>
<li><a href="../classes/Recipe.html">Recipe</a></li>
<li><a href="../classes/RecognizeAction.html">RecognizeAction</a></li>
<li><a href="../classes/Recommendation.html">Recommendation</a></li>
<li><a href="../classes/RecommendedDoseSchedule.html">RecommendedDoseSchedule</a></li>
<li><a href="../classes/RecyclingCenter.html">RecyclingCenter</a></li>
<li><a href="../classes/RefundTypeEnumeration.html">RefundTypeEnumeration</a></li>
<li><a href="../classes/RegisterAction.html">RegisterAction</a></li>
<li><a href="../classes/RegulateAction.html">RegulateAction</a></li>
<li><a href="../classes/RejectAction.html">RejectAction</a></li>
<li><a href="../classes/Relation.html">Relation</a></li>
<li><a href="../classes/RenewAction.html">RenewAction</a></li>
<li><a href="../classes/RentAction.html">RentAction</a></li>
<li><a href="../classes/RentalCarReservation.html">RentalCarReservation</a></li>
<li><a href="../classes/RepaymentSpecification.html">RepaymentSpecification</a></li>
<li><a href="../classes/ReplaceAction.html">ReplaceAction</a></li>
<li><a href="../classes/ReplyAction.html">ReplyAction</a></li>
<li><a href="../classes/Report.html">Report</a></li>
<li><a href="../classes/ReportageNewsArticle.html">ReportageNewsArticle</a></li>
<li><a href="../classes/ReportedDoseSchedule.html">ReportedDoseSchedule</a></li>
<li><a href="../classes/ResearchDoctorate.html">ResearchDoctorate</a></li>
<li><a href="../classes/Researcher.html">Researcher</a></li>
<li><a href="../classes/ResearchProject.html">ResearchProject</a></li>
<li><a href="../classes/Reservation.html">Reservation</a></li>
<li><a href="../classes/ReservationPackage.html">ReservationPackage</a></li>
<li><a href="../classes/ReservationStatusType.html">ReservationStatusType</a></li>
<li><a href="../classes/ReserveAction.html">ReserveAction</a></li>
<li><a href="../classes/Reservoir.html">Reservoir</a></li>
<li><a href="../classes/Residence.html">Residence</a></li>
<li><a href="../classes/Resort.html">Resort</a></li>
<li><a href="../classes/Restaurant.html">Restaurant</a></li>
<li><a href="../classes/RestrictedDiet.html">RestrictedDiet</a></li>
<li><a href="../classes/ResumeAction.html">ResumeAction</a></li>
<li><a href="../classes/ReturnAction.html">ReturnAction</a></li>
<li><a href="../classes/ReturnFeesEnumeration.html">ReturnFeesEnumeration</a></li>
<li><a href="../classes/Review.html">Review</a></li>
<li><a href="../classes/ReviewAction.html">ReviewAction</a></li>
<li><a href="../classes/ReviewNewsArticle.html">ReviewNewsArticle</a></li>
<li><a href="../classes/RevocationProfile.html">RevocationProfile</a></li>
<li><a href="../classes/RevokeAction.html">RevokeAction</a></li>
<li><a href="../classes/RightsAction.html">RightsAction</a></li>
<li><a href="../classes/RiverBodyOfWater.html">RiverBodyOfWater</a></li>
<li><a href="../classes/Role.html">Role</a></li>
<li><a href="../classes/Rollup.html">Rollup</a></li>
<li><a href="../classes/RollupRule.html">RollupRule</a></li>
<li><a href="../classes/RoofingContractor.html">RoofingContractor</a></li>
<li><a href="../classes/Room.html">Room</a></li>
<li><a href="../classes/RsvpAction.html">RsvpAction</a></li>
<li><a href="../classes/RsvpResponseType.html">RsvpResponseType</a></li>
<li><a href="../classes/RuleSet.html">RuleSet</a></li>
<li><a href="../classes/RuleSetProfile.html">RuleSetProfile</a></li>
<li><a href="../classes/RVPark.html">RVPark</a></li>
<li><a href="../classes/SaleEvent.html">SaleEvent</a></li>
<li><a href="../classes/SatiricalArticle.html">SatiricalArticle</a></li>
<li><a href="../classes/Schedule.html">Schedule</a></li>
<li><a href="../classes/ScheduleAction.html">ScheduleAction</a></li>
<li><a href="../classes/ScholarlyArticle.html">ScholarlyArticle</a></li>
<li><a href="../classes/School.html">School</a></li>
<li><a href="../classes/SchoolDistrict.html">SchoolDistrict</a></li>
<li><a href="../classes/ScreeningEvent.html">ScreeningEvent</a></li>
<li><a href="../classes/Sculpture.html">Sculpture</a></li>
<li><a href="../classes/SeaBodyOfWater.html">SeaBodyOfWater</a></li>
<li><a href="../classes/SearchAction.html">SearchAction</a></li>
<li><a href="../classes/SearchResultsPage.html">SearchResultsPage</a></li>
<li><a href="../classes/Season.html">Season</a></li>
<li><a href="../classes/Seat.html">Seat</a></li>
<li><a href="../classes/SecondarySchoolDiploma.html">SecondarySchoolDiploma</a></li>
<li><a href="../classes/SeekToAction.html">SeekToAction</a></li>
<li><a href="../classes/SelectionComponent.html">SelectionComponent</a></li>
<li><a href="../classes/SelfStorage.html">SelfStorage</a></li>
<li><a href="../classes/SellAction.html">SellAction</a></li>
<li><a href="../classes/SendAction.html">SendAction</a></li>
<li><a href="../classes/Series.html">Series</a></li>
<li><a href="../classes/Service.html">Service</a></li>
<li><a href="../classes/ServiceChannel.html">ServiceChannel</a></li>
<li><a href="../classes/ShareAction.html">ShareAction</a></li>
<li><a href="../classes/SheetMusic.html">SheetMusic</a></li>
<li><a href="../classes/ShippingDeliveryTime.html">ShippingDeliveryTime</a></li>
<li><a href="../classes/ShippingRateSettings.html">ShippingRateSettings</a></li>
<li><a href="../classes/ShoeStore.html">ShoeStore</a></li>
<li><a href="../classes/ShoppingCenter.html">ShoppingCenter</a></li>
<li><a href="../classes/ShortStory.html">ShortStory</a></li>
<li><a href="../classes/SingleFamilyResidence.html">SingleFamilyResidence</a></li>
<li><a href="../classes/SiteNavigationElement.html">SiteNavigationElement</a></li>
<li><a href="../classes/SizeGroupEnumeration.html">SizeGroupEnumeration</a></li>
<li><a href="../classes/SizeSpecification.html">SizeSpecification</a></li>
<li><a href="../classes/SizeSystemEnumeration.html">SizeSystemEnumeration</a></li>
<li><a href="../classes/Skill.html">Skill</a></li>
<li><a href="../classes/SkiResort.html">SkiResort</a></li>
<li><a href="../classes/SocialEvent.html">SocialEvent</a></li>
<li><a href="../classes/SocialMediaPosting.html">SocialMediaPosting</a></li>
<li><a href="../classes/SoftwareApplication.html">SoftwareApplication</a></li>
<li><a href="../classes/SoftwareSourceCode.html">SoftwareSourceCode</a></li>
<li><a href="../classes/SolveMathAction.html">SolveMathAction</a></li>
<li><a href="../classes/SomeProducts.html">SomeProducts</a></li>
<li><a href="../classes/SpeakableSpecification.html">SpeakableSpecification</a></li>
<li><a href="../classes/SpecialAnnouncement.html">SpecialAnnouncement</a></li>
<li><a href="../classes/Specialty.html">Specialty</a></li>
<li><a href="../classes/SportingGoodsStore.html">SportingGoodsStore</a></li>
<li><a href="../classes/SportsActivityLocation.html">SportsActivityLocation</a></li>
<li><a href="../classes/SportsClub.html">SportsClub</a></li>
<li><a href="../classes/SportsEvent.html">SportsEvent</a></li>
<li><a href="../classes/SportsOrganization.html">SportsOrganization</a></li>
<li><a href="../classes/SportsTeam.html">SportsTeam</a></li>
<li><a href="../classes/SpreadsheetDigitalDocument.html">SpreadsheetDigitalDocument</a></li>
<li><a href="../classes/StadiumOrArena.html">StadiumOrArena</a></li>
<li><a href="../classes/State.html">State</a></li>
<li><a href="../classes/StatisticalPopulation.html">StatisticalPopulation</a></li>
<li><a href="../classes/StatusEnumeration.html">StatusEnumeration</a></li>
<li><a href="../classes/SteeringPositionValue.html">SteeringPositionValue</a></li>
<li><a href="../classes/Store.html">Store</a></li>
<li><a href="../classes/StructuredValue.html">StructuredValue</a></li>
<li><a href="../classes/StupidType.html">StupidType</a></li>
<li><a href="../classes/SubscribeAction.html">SubscribeAction</a></li>
<li><a href="../classes/Substance.html">Substance</a></li>
<li><a href="../classes/SubwayStation.html">SubwayStation</a></li>
<li><a href="../classes/Suite.html">Suite</a></li>
<li><a href="../classes/SuperficialAnatomy.html">SuperficialAnatomy</a></li>
<li><a href="../classes/SurgicalProcedure.html">SurgicalProcedure</a></li>
<li><a href="../classes/SuspendAction.html">SuspendAction</a></li>
<li><a href="../classes/Synagogue.html">Synagogue</a></li>
<li><a href="../classes/Table.html">Table</a></li>
<li><a href="../classes/TakeAction.html">TakeAction</a></li>
<li><a href="../classes/Task.html">Task</a></li>
<li><a href="../classes/TattooParlor.html">TattooParlor</a></li>
<li><a href="../classes/Taxi.html">Taxi</a></li>
<li><a href="../classes/TaxiReservation.html">TaxiReservation</a></li>
<li><a href="../classes/TaxiService.html">TaxiService</a></li>
<li><a href="../classes/TaxiStand.html">TaxiStand</a></li>
<li><a href="../classes/TechArticle.html">TechArticle</a></li>
<li><a href="../classes/TelevisionChannel.html">TelevisionChannel</a></li>
<li><a href="../classes/TelevisionStation.html">TelevisionStation</a></li>
<li><a href="../classes/TennisComplex.html">TennisComplex</a></li>
<li><a href="../classes/TextDigitalDocument.html">TextDigitalDocument</a></li>
<li><a href="../classes/TheaterEvent.html">TheaterEvent</a></li>
<li><a href="../classes/TheaterGroup.html">TheaterGroup</a></li>
<li><a href="../classes/TherapeuticProcedure.html">TherapeuticProcedure</a></li>
<li><a href="../classes/Thesis.html">Thesis</a></li>
<li><a href="../classes/Thing.html">Thing</a></li>
<li><a href="../classes/this.html">this</a></li>
<li><a href="../classes/Ticket.html">Ticket</a></li>
<li><a href="../classes/TieAction.html">TieAction</a></li>
<li><a href="../classes/TipAction.html">TipAction</a></li>
<li><a href="../classes/TireShop.html">TireShop</a></li>
<li><a href="../classes/TouristAttraction.html">TouristAttraction</a></li>
<li><a href="../classes/TouristDestination.html">TouristDestination</a></li>
<li><a href="../classes/TouristInformationCenter.html">TouristInformationCenter</a></li>
<li><a href="../classes/TouristTrip.html">TouristTrip</a></li>
<li><a href="../classes/ToyStore.html">ToyStore</a></li>
<li><a href="../classes/TrackAction.html">TrackAction</a></li>
<li><a href="../classes/TradeAction.html">TradeAction</a></li>
<li><a href="../classes/TrainReservation.html">TrainReservation</a></li>
<li><a href="../classes/TrainStation.html">TrainStation</a></li>
<li><a href="../classes/TrainTrip.html">TrainTrip</a></li>
<li><a href="../classes/TransferAction.html">TransferAction</a></li>
<li><a href="../classes/TransferValueProfile.html">TransferValueProfile</a></li>
<li><a href="../classes/TravelAction.html">TravelAction</a></li>
<li><a href="../classes/TravelAgency.html">TravelAgency</a></li>
<li><a href="../classes/TreatmentIndication.html">TreatmentIndication</a></li>
<li><a href="../classes/Trip.html">Trip</a></li>
<li><a href="../classes/Triple.html">Triple</a></li>
<li><a href="../classes/TVClip.html">TVClip</a></li>
<li><a href="../classes/TVEpisode.html">TVEpisode</a></li>
<li><a href="../classes/TVSeason.html">TVSeason</a></li>
<li><a href="../classes/TVSeries.html">TVSeries</a></li>
<li><a href="../classes/TypeAndQuantityNode.html">TypeAndQuantityNode</a></li>
<li><a href="../classes/UKNonprofitType.html">UKNonprofitType</a></li>
<li><a href="../classes/UnitPriceSpecification.html">UnitPriceSpecification</a></li>
<li><a href="../classes/UnRegisterAction.html">UnRegisterAction</a></li>
<li><a href="../classes/UpdateAction.html">UpdateAction</a></li>
<li><a href="../classes/UseAction.html">UseAction</a></li>
<li><a href="../classes/UserBlocks.html">UserBlocks</a></li>
<li><a href="../classes/UserCheckins.html">UserCheckins</a></li>
<li><a href="../classes/UserComments.html">UserComments</a></li>
<li><a href="../classes/UserDownloads.html">UserDownloads</a></li>
<li><a href="../classes/UserInteraction.html">UserInteraction</a></li>
<li><a href="../classes/UserLikes.html">UserLikes</a></li>
<li><a href="../classes/UserPageVisits.html">UserPageVisits</a></li>
<li><a href="../classes/UserPlays.html">UserPlays</a></li>
<li><a href="../classes/UserPlusOnes.html">UserPlusOnes</a></li>
<li><a href="../classes/UserReview.html">UserReview</a></li>
<li><a href="../classes/UserTweets.html">UserTweets</a></li>
<li><a href="../classes/USNonprofitType.html">USNonprofitType</a></li>
<li><a href="../classes/ValueProfile.html">ValueProfile</a></li>
<li><a href="../classes/Vehicle.html">Vehicle</a></li>
<li><a href="../classes/Vein.html">Vein</a></li>
<li><a href="../classes/VerificationServiceProfile.html">VerificationServiceProfile</a></li>
<li><a href="../classes/Vessel.html">Vessel</a></li>
<li><a href="../classes/VeterinaryCare.html">VeterinaryCare</a></li>
<li><a href="../classes/VideoGallery.html">VideoGallery</a></li>
<li><a href="../classes/VideoGame.html">VideoGame</a></li>
<li><a href="../classes/VideoGameClip.html">VideoGameClip</a></li>
<li><a href="../classes/VideoGameSeries.html">VideoGameSeries</a></li>
<li><a href="../classes/VideoObject.html">VideoObject</a></li>
<li><a href="../classes/ViewAction.html">ViewAction</a></li>
<li><a href="../classes/VirtualLocation.html">VirtualLocation</a></li>
<li><a href="../classes/VisualArtsEvent.html">VisualArtsEvent</a></li>
<li><a href="../classes/VisualArtwork.html">VisualArtwork</a></li>
<li><a href="../classes/VitalSign.html">VitalSign</a></li>
<li><a href="../classes/Volcano.html">Volcano</a></li>
<li><a href="../classes/VoteAction.html">VoteAction</a></li>
<li><a href="../classes/WantAction.html">WantAction</a></li>
<li><a href="../classes/WarrantyPromise.html">WarrantyPromise</a></li>
<li><a href="../classes/WarrantyScope.html">WarrantyScope</a></li>
<li><a href="../classes/WatchAction.html">WatchAction</a></li>
<li><a href="../classes/Waterfall.html">Waterfall</a></li>
<li><a href="../classes/WearableMeasurementTypeEnumeration.html">WearableMeasurementTypeEnumeration</a></li>
<li><a href="../classes/WearableSizeGroupEnumeration.html">WearableSizeGroupEnumeration</a></li>
<li><a href="../classes/WearableSizeSystemEnumeration.html">WearableSizeSystemEnumeration</a></li>
<li><a href="../classes/WearAction.html">WearAction</a></li>
<li><a href="../classes/WebAPI.html">WebAPI</a></li>
<li><a href="../classes/WebApplication.html">WebApplication</a></li>
<li><a href="../classes/WebContent.html">WebContent</a></li>
<li><a href="../classes/WebPage.html">WebPage</a></li>
<li><a href="../classes/WebPageElement.html">WebPageElement</a></li>
<li><a href="../classes/WebSite.html">WebSite</a></li>
<li><a href="../classes/WholesaleStore.html">WholesaleStore</a></li>
<li><a href="../classes/WinAction.html">WinAction</a></li>
<li><a href="../classes/Winery.html">Winery</a></li>
<li><a href="../classes/WorkBasedProgram.html">WorkBasedProgram</a></li>
<li><a href="../classes/WorkersUnion.html">WorkersUnion</a></li>
<li><a href="../classes/WorkExperienceComponent.html">WorkExperienceComponent</a></li>
<li><a href="../classes/WorkRole.html">WorkRole</a></li>
<li><a href="../classes/WPAdBlock.html">WPAdBlock</a></li>
<li><a href="../classes/WPFooter.html">WPFooter</a></li>
<li><a href="../classes/WPHeader.html">WPHeader</a></li>
<li><a href="../classes/WPSideBar.html">WPSideBar</a></li>
<li><a href="../classes/WriteAction.html">WriteAction</a></li>
<li><a href="../classes/XPathType.html">XPathType</a></li>
<li><a href="../classes/Zoo.html">Zoo</a></li>
</ul>
<ul id="api-modules" class="apis modules">
<li><a href="../modules/com.eduworks.html">com.eduworks</a></li>
<li><a href="../modules/com.eduworks.ec.html">com.eduworks.ec</a></li>
<li><a href="../modules/org.cassproject.html">org.cassproject</a></li>
<li><a href="../modules/org.credentialengine.html">org.credentialengine</a></li>
<li><a href="../modules/org.json.ld.html">org.json.ld</a></li>
<li><a href="../modules/org.schema.html">org.schema</a></li>
<li><a href="../modules/org.w3.skos.html">org.w3.skos</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1>Ticket Class</h1>
<div class="box meta">
<div class="extends">
Extends <a href="../classes/Intangible.html" class="crosslink">Intangible</a>
</div>
<div class="foundat">
Defined in: <a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l3"><code>node_modules\cassproject\src\org\schema\Ticket.js:3</code></a>
</div>
Module: <a href="../modules/org.schema.html">org.schema</a>
</div>
<div class="box intro">
<p><a href="http://Schema.org/Ticket">Schema.org/Ticket</a>
Used to describe a ticket to an event, a flight, a bus ride, etc.</p>
</div>
<div id="classdocs" class="tabview">
<ul class="api-class-tabs">
<li class="api-class-tab index"><a href="#index">Index</a></li>
<li class="api-class-tab properties"><a href="#properties">Properties</a></li>
</ul>
<div>
<div id="index" class="api-class-tabpanel index">
<h2 class="off-left">Item Index</h2>
<div class="index-section properties">
<h3>Properties</h3>
<ul class="index-list properties extends">
<li class="index-item property inherited">
<a href="#property_additionalType">additionalType</a>
</li>
<li class="index-item property inherited">
<a href="#property_alternateName">alternateName</a>
</li>
<li class="index-item property">
<a href="#property_dateIssued">dateIssued</a>
</li>
<li class="index-item property inherited">
<a href="#property_description">description</a>
</li>
<li class="index-item property inherited">
<a href="#property_disambiguatingDescription">disambiguatingDescription</a>
</li>
<li class="index-item property inherited">
<a href="#property_identifier">identifier</a>
</li>
<li class="index-item property inherited">
<a href="#property_image">image</a>
</li>
<li class="index-item property">
<a href="#property_issuedBy">issuedBy</a>
</li>
<li class="index-item property inherited">
<a href="#property_mainEntityOfPage">mainEntityOfPage</a>
</li>
<li class="index-item property inherited">
<a href="#property_name">name</a>
</li>
<li class="index-item property inherited">
<a href="#property_potentialAction">potentialAction</a>
</li>
<li class="index-item property">
<a href="#property_priceCurrency">priceCurrency</a>
</li>
<li class="index-item property inherited">
<a href="#property_sameAs">sameAs</a>
</li>
<li class="index-item property inherited">
<a href="#property_subjectOf">subjectOf</a>
</li>
<li class="index-item property">
<a href="#property_ticketedSeat">ticketedSeat</a>
</li>
<li class="index-item property">
<a href="#property_ticketNumber">ticketNumber</a>
</li>
<li class="index-item property">
<a href="#property_ticketToken">ticketToken</a>
</li>
<li class="index-item property">
<a href="#property_totalPrice">totalPrice</a>
</li>
<li class="index-item property">
<a href="#property_underName">underName</a>
</li>
<li class="index-item property inherited">
<a href="#property_url">url</a>
</li>
</ul>
</div>
</div>
<div id="properties" class="api-class-tabpanel">
<h2 class="off-left">Properties</h2>
<div id="property_additionalType" class="property item inherited">
<h3 class="name"><code>additionalType</code></h3>
<span class="type">URL</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_additionalType">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l66"><code>node_modules\cassproject\src\org\schema\Thing.js:66</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/additionalType">Schema.org/additionalType</a>
An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax. This is a relationship between something and a class that the thing is in. In RDFa syntax, it is better to use the native RDFa syntax - the 'typeof' attribute - for multiple types. <a href="http://Schema.org">Schema.org</a> tools may have only weaker understanding of extra types, in particular those defined externally.</p>
</div>
</div>
<div id="property_alternateName" class="property item inherited">
<h3 class="name"><code>alternateName</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_alternateName">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l85"><code>node_modules\cassproject\src\org\schema\Thing.js:85</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/alternateName">Schema.org/alternateName</a>
An alias for the item.</p>
</div>
</div>
<div id="property_dateIssued" class="property item">
<h3 class="name"><code>dateIssued</code></h3>
<span class="type">DateTime</span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l86"><code>node_modules\cassproject\src\org\schema\Ticket.js:86</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/dateIssued">Schema.org/dateIssued</a>
The date the ticket was issued.</p>
</div>
</div>
<div id="property_description" class="property item inherited">
<h3 class="name"><code>description</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_description">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l30"><code>node_modules\cassproject\src\org\schema\Thing.js:30</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/description">Schema.org/description</a>
A description of the item.</p>
</div>
</div>
<div id="property_disambiguatingDescription" class="property item inherited">
<h3 class="name"><code>disambiguatingDescription</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_disambiguatingDescription">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l121"><code>node_modules\cassproject\src\org\schema\Thing.js:121</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/disambiguatingDescription">Schema.org/disambiguatingDescription</a>
A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.</p>
</div>
</div>
<div id="property_identifier" class="property item inherited">
<h3 class="name"><code>identifier</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_identifier">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l75"><code>node_modules\cassproject\src\org\schema\Thing.js:75</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/identifier">Schema.org/identifier</a>
The identifier property represents any kind of identifier for any kind of [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. <a href="http://Schema.org">Schema.org</a> provides dedicated properties for representing many of these, either as textual strings or as URL (URI) links. See <a href="/docs/datamodel.html#identifierBg">background notes</a> for more details.</p>
</div>
</div>
<div id="property_image" class="property item inherited">
<h3 class="name"><code>image</code></h3>
<span class="type"><a href="../classes/ImageObject.html" class="crosslink">ImageObject</a></span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_image">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l112"><code>node_modules\cassproject\src\org\schema\Thing.js:112</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/image">Schema.org/image</a>
An image of the item. This can be a [[URL]] or a fully described [[ImageObject]].</p>
</div>
</div>
<div id="property_issuedBy" class="property item">
<h3 class="name"><code>issuedBy</code></h3>
<span class="type"><a href="../classes/Organization.html" class="crosslink">Organization</a></span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l59"><code>node_modules\cassproject\src\org\schema\Ticket.js:59</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/issuedBy">Schema.org/issuedBy</a>
The organization issuing the ticket or permit.</p>
</div>
</div>
<div id="property_mainEntityOfPage" class="property item inherited">
<h3 class="name"><code>mainEntityOfPage</code></h3>
<span class="type">URL</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_mainEntityOfPage">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l57"><code>node_modules\cassproject\src\org\schema\Thing.js:57</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/mainEntityOfPage">Schema.org/mainEntityOfPage</a>
Indicates a page (or other CreativeWork) for which this thing is the main entity being described. See <a href="/docs/datamodel.html#mainEntityBackground">background notes</a> for details.</p>
</div>
</div>
<div id="property_name" class="property item inherited">
<h3 class="name"><code>name</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_name">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l94"><code>node_modules\cassproject\src\org\schema\Thing.js:94</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/name">Schema.org/name</a>
The name of the item.</p>
</div>
</div>
<div id="property_potentialAction" class="property item inherited">
<h3 class="name"><code>potentialAction</code></h3>
<span class="type"><a href="../classes/Action.html" class="crosslink">Action</a></span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_potentialAction">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l48"><code>node_modules\cassproject\src\org\schema\Thing.js:48</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/potentialAction">Schema.org/potentialAction</a>
Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.</p>
</div>
</div>
<div id="property_priceCurrency" class="property item">
<h3 class="name"><code>priceCurrency</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l32"><code>node_modules\cassproject\src\org\schema\Ticket.js:32</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/priceCurrency">Schema.org/priceCurrency</a>
The currency of the price, or a price component when attached to [[PriceSpecification]] and its subtypes.\n\nUse standard formats: <a href="http://en.wikipedia.org/wiki/ISO_4217">ISO 4217 currency format</a> e.g. "USD"; <a href="https://en.wikipedia.org/wiki/List_of_cryptocurrencies">Ticker symbol</a> for cryptocurrencies e.g. "BTC"; well known names for <a href="https://en.wikipedia.org/wiki/Local_exchange_trading_system">Local Exchange Tradings Systems</a> (LETS) and other currency types e.g. "Ithaca HOUR".</p>
</div>
</div>
<div id="property_sameAs" class="property item inherited">
<h3 class="name"><code>sameAs</code></h3>
<span class="type">URL</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_sameAs">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l21"><code>node_modules\cassproject\src\org\schema\Thing.js:21</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/sameAs">Schema.org/sameAs</a>
URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.</p>
</div>
</div>
<div id="property_subjectOf" class="property item inherited">
<h3 class="name"><code>subjectOf</code></h3>
<span class="type"><a href="../classes/Event.html" class="crosslink">Event</a></span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_subjectOf">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l39"><code>node_modules\cassproject\src\org\schema\Thing.js:39</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/subjectOf">Schema.org/subjectOf</a>
A CreativeWork or Event about this Thing.</p>
</div>
</div>
<div id="property_ticketedSeat" class="property item">
<h3 class="name"><code>ticketedSeat</code></h3>
<span class="type"><a href="../classes/Seat.html" class="crosslink">Seat</a></span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l77"><code>node_modules\cassproject\src\org\schema\Ticket.js:77</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/ticketedSeat">Schema.org/ticketedSeat</a>
The seat associated with the ticket.</p>
</div>
</div>
<div id="property_ticketNumber" class="property item">
<h3 class="name"><code>ticketNumber</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l41"><code>node_modules\cassproject\src\org\schema\Ticket.js:41</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/ticketNumber">Schema.org/ticketNumber</a>
The unique identifier for the ticket.</p>
</div>
</div>
<div id="property_ticketToken" class="property item">
<h3 class="name"><code>ticketToken</code></h3>
<span class="type">Text</span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l68"><code>node_modules\cassproject\src\org\schema\Ticket.js:68</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/ticketToken">Schema.org/ticketToken</a>
Reference to an asset (e.g., Barcode, QR code image or PDF) usable for entrance.</p>
</div>
</div>
<div id="property_totalPrice" class="property item">
<h3 class="name"><code>totalPrice</code></h3>
<span class="type">Number</span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l50"><code>node_modules\cassproject\src\org\schema\Ticket.js:50</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/totalPrice">Schema.org/totalPrice</a>
The total price for the reservation or ticket, including applicable taxes, shipping, etc.\n\nUsage guidelines:\n\n* Use values from 0123456789 (Unicode 'DIGIT ZERO' (U+0030) to 'DIGIT NINE' (U+0039)) rather than superficially similiar Unicode symbols.\n* Use '.' (Unicode 'FULL STOP' (U+002E)) rather than ',' to indicate a decimal point. Avoid using these symbols as a readability separator.</p>
</div>
</div>
<div id="property_underName" class="property item">
<h3 class="name"><code>underName</code></h3>
<span class="type"><a href="../classes/Organization.html" class="crosslink">Organization</a></span>
<div class="meta">
<p>
Defined in
<a href="../files/node_modules_cassproject_src_org_schema_Ticket.js.html#l23"><code>node_modules\cassproject\src\org\schema\Ticket.js:23</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/underName">Schema.org/underName</a>
The person or organization the reservation or ticket is for.</p>
</div>
</div>
<div id="property_url" class="property item inherited">
<h3 class="name"><code>url</code></h3>
<span class="type">URL</span>
<div class="meta">
<p>Inherited from
<a href="../classes/Thing.html#property_url">Thing</a>:
<a href="../files/node_modules_cassproject_src_org_schema_Thing.js.html#l103"><code>node_modules\cassproject\src\org\schema\Thing.js:103</code></a>
</p>
</div>
<div class="description">
<p><a href="http://Schema.org/url">Schema.org/url</a>
URL of the item.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
| Eduworks/CASS | docs/classes/Ticket.html | HTML | apache-2.0 | 126,893 |
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.mvel.compiler.phreak;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.impl.InternalKnowledgeBase;
import org.drools.core.impl.KnowledgeBaseFactory;
import org.junit.Test;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.internal.builder.KnowledgeBuilder;
import org.kie.internal.builder.KnowledgeBuilderFactory;
import org.kie.internal.io.ResourceFactory;
import org.kie.internal.runtime.StatefulKnowledgeSession;
public class PhreakLiaNodeTest {
@Test
public void test() {
String str = "package org.drools.mvel.compiler.test\n" +
"\n" +
"import " + A.class.getCanonicalName() + "\n" +
"import " + B.class.getCanonicalName() + "\n" +
"\n" +
"rule r1 \n" +
" when \n" +
" $a : A( object == 1 )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n" +
"rule r2 \n" +
" when \n" +
" $a : A( object == 2 )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n " +
"rule r3 \n" +
" when \n" +
" $a : A( object == 2 )\n" +
" $b : B( )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n " +
"rule r4 \n" +
" when \n" +
" $a : A( object == 3 )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n";
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add( ResourceFactory.newByteArrayResource(str.getBytes()), ResourceType.DRL);
if ( builder.hasErrors() ) {
throw new RuntimeException(builder.getErrors().toString());
}
InternalKnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addPackages(builder.getKnowledgePackages());
KieSession ksession = knowledgeBase.newKieSession();
InternalFactHandle fhB = ( InternalFactHandle ) ksession.insert( B.b(1) );
InternalFactHandle fhA = ( InternalFactHandle ) ksession.insert( A.a(1) );
ksession.fireAllRules();
System.out.println( "---1---" );
// ksession.update( fhA, a(1) );
// ksession.fireAllRules();
// System.out.println( "---2---" );
//
ksession.update( fhA, A.a(2) );
ksession.fireAllRules();
System.out.println( "---3---" );
ksession.update( fhA, A.a(2) );
ksession.fireAllRules();
System.out.println( "---4---" );
ksession.update( fhA, A.a(3) );
ksession.fireAllRules();
System.out.println( "---5---" );
ksession.update( fhB, B.b(1) );
ksession.update( fhA, A.a(3) );
ksession.fireAllRules();
// ksession.update( fhA, a(1) );
// ksession.fireAllRules();
//
// ksession.update( fhA, a(1) );
// ksession.fireAllRules();
ksession.dispose();
}
@Test
public void test2() {
String str = "package org.drools.mvel.compiler.test\n" +
"\n" +
"import " + A.class.getCanonicalName() + "\n" +
"import " + B.class.getCanonicalName() + "\n" +
"\n" +
"rule r1 \n" +
" when \n" +
" $a : A( object == 1 )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n" +
"rule r2 \n" +
" when \n" +
" $a : A( object == 2 )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n " +
"rule r3 \n" +
" when \n" +
" $a : A( object == 2 )\n" +
" $b : B( )\n" +
" then \n" +
" System.out.println( $a + \" : \" + $b );"
+ " modify($a) { setObject(3) }; \n" +
"end \n " +
"rule r4 \n" +
" when \n" +
" $a : A( object == 3 )\n" +
" then \n" +
" System.out.println( $a ); \n" +
"end \n";
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
builder.add( ResourceFactory.newByteArrayResource( str.getBytes() ), ResourceType.DRL);
if ( builder.hasErrors() ) {
throw new RuntimeException(builder.getErrors().toString());
}
InternalKnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addPackages(builder.getKnowledgePackages());
KieSession ksession = knowledgeBase.newKieSession();
InternalFactHandle fhB = ( InternalFactHandle ) ksession.insert( B.b(1) );
InternalFactHandle fhA = ( InternalFactHandle ) ksession.insert( A.a(1) );
ksession.fireAllRules();
System.out.println( "---1---" );
// ksession.update( fhA, a(1) );
// ksession.fireAllRules();
// System.out.println( "---2---" );
//
InternalFactHandle fhB2 = ( InternalFactHandle ) ksession.insert( B.b(2) );
InternalFactHandle fhB3 = ( InternalFactHandle ) ksession.insert( B.b(3) );
ksession.update( fhA, A.a(2) );
ksession.fireAllRules();
System.out.println( "---3---" );
// ksession.update( fhA, a(2) );
// ksession.fireAllRules();
// System.out.println( "---4---" );
//
// ksession.update( fhA, a(3) );
// ksession.fireAllRules();
// System.out.println( "---5---" );
//
// ksession.update( fhB, b(1) );
//
// ksession.update( fhA, a(3) );
// ksession.fireAllRules();
// ksession.update( fhA, a(1) );
// ksession.fireAllRules();
//
// ksession.update( fhA, a(1) );
// ksession.fireAllRules();
ksession.dispose();
}
}
| droolsjbpm/drools | drools-mvel/src/test/java/org/drools/mvel/compiler/phreak/PhreakLiaNodeTest.java | Java | apache-2.0 | 7,187 |
package com.nearinfinity.examples.zookeeper.confservice;
import java.io.IOException;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.apache.zookeeper.KeeperException;
public class ConfigUpdater {
public static final String PATH = "/config";
private ActiveKeyValueStore _store;
private Random _random = new Random();
public ConfigUpdater(String hosts) throws IOException, InterruptedException {
_store = new ActiveKeyValueStore();
_store.connect(hosts);
}
public void run() throws InterruptedException, KeeperException {
//noinspection InfiniteLoopStatement
while (true) {
String value = _random.nextInt(100) + "";
_store.write(PATH, value);
System.out.printf("Set %s to %s\n", PATH, value);
TimeUnit.SECONDS.sleep(_random.nextInt(10));
}
}
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
ConfigUpdater updater = new ConfigUpdater(args[0]);
updater.run();
}
}
| httpgithub/zk | src/main/java/com/nearinfinity/examples/zookeeper/confservice/ConfigUpdater.java | Java | apache-2.0 | 1,085 |
# AUTOGENERATED FILE
FROM balenalib/spacely-tx2-ubuntu:eoan-build
ENV NODE_VERSION 14.15.4
ENV YARN_VERSION 1.22.4
RUN for key in \
6A010C5166006599AA17F08146C2130DFD2497F5 \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
done \
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-arm64.tar.gz" \
&& echo "b681bda8eaa1ed2ac85e0ed2c2041a0408963c2198a24da183dc3ab60d93d975 node-v$NODE_VERSION-linux-arm64.tar.gz" | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-arm64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-arm64.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& npm config set unsafe-perm true -g --unsafe-perm \
&& rm -rf /tmp/*
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \
&& echo "Running test-stack@node" \
&& chmod +x test-stack@node.sh \
&& bash test-stack@node.sh \
&& rm -rf test-stack@node.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Ubuntu eoan \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v14.15.4, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/node/spacely-tx2/ubuntu/eoan/14.15.4/build/Dockerfile | Dockerfile | apache-2.0 | 2,756 |
# AUTOGENERATED FILE
FROM balenalib/artik530-debian:jessie-build
ENV GO_VERSION 1.14.13
RUN mkdir -p /usr/local/go \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/golang/v$GO_VERSION/go$GO_VERSION.linux-armv7hf.tar.gz" \
&& echo "53c5236a76730f6487052fa1a629d6f5efdde6341cfc2e0544b0b28aefc27708 go$GO_VERSION.linux-armv7hf.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.linux-armv7hf.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.linux-armv7hf.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Jessie \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.14.13 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | nghiant2710/base-images | balena-base-images/golang/artik530/debian/jessie/1.14.13/build/Dockerfile | Dockerfile | apache-2.0 | 2,028 |
// Automatically generated by xdrgen
// DO NOT EDIT or your changes may be overwritten
using System;
namespace stellar_dotnet_sdk.xdr
{
// === xdr source ============================================================
// union PublicKey switch (PublicKeyType type)
// {
// case PUBLIC_KEY_TYPE_ED25519:
// uint256 ed25519;
// };
// ===========================================================================
public class PublicKey
{
public PublicKey()
{
}
public PublicKeyType Discriminant { get; set; } = new PublicKeyType();
public Uint256 Ed25519 { get; set; }
public static void Encode(XdrDataOutputStream stream, PublicKey encodedPublicKey)
{
stream.WriteInt((int) encodedPublicKey.Discriminant.InnerValue);
switch (encodedPublicKey.Discriminant.InnerValue)
{
case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519:
Uint256.Encode(stream, encodedPublicKey.Ed25519);
break;
}
}
public static PublicKey Decode(XdrDataInputStream stream)
{
PublicKey decodedPublicKey = new PublicKey();
PublicKeyType discriminant = PublicKeyType.Decode(stream);
decodedPublicKey.Discriminant = discriminant;
switch (decodedPublicKey.Discriminant.InnerValue)
{
case PublicKeyType.PublicKeyTypeEnum.PUBLIC_KEY_TYPE_ED25519:
decodedPublicKey.Ed25519 = Uint256.Decode(stream);
break;
}
return decodedPublicKey;
}
}
} | elucidsoft/dotnetcore-stellar-sdk | stellar-dotnet-sdk-xdr/generated/PublicKey.cs | C# | apache-2.0 | 1,660 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_65) on Thu Jan 22 19:02:37 GMT 2015 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.taverna.scufl2.api.common.Visitor.VisitorAdapter (Apache Taverna Language APIs (Scufl2, Databundle) 0.16.1-incubating-SNAPSHOT API)</title>
<meta name="date" content="2015-01-22">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.taverna.scufl2.api.common.Visitor.VisitorAdapter (Apache Taverna Language APIs (Scufl2, Databundle) 0.16.1-incubating-SNAPSHOT API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/apache/taverna/scufl2/api/common/Visitor.VisitorAdapter.html" title="class in org.apache.taverna.scufl2.api.common">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/taverna/scufl2/api/common/class-use/Visitor.VisitorAdapter.html" target="_top">Frames</a></li>
<li><a href="Visitor.VisitorAdapter.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.taverna.scufl2.api.common.Visitor.VisitorAdapter" class="title">Uses of Class<br>org.apache.taverna.scufl2.api.common.Visitor.VisitorAdapter</h2>
</div>
<div class="classUseContainer">No usage of org.apache.taverna.scufl2.api.common.Visitor.VisitorAdapter</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../org/apache/taverna/scufl2/api/common/Visitor.VisitorAdapter.html" title="class in org.apache.taverna.scufl2.api.common">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/taverna/scufl2/api/common/class-use/Visitor.VisitorAdapter.html" target="_top">Frames</a></li>
<li><a href="Visitor.VisitorAdapter.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| stain/incubator-taverna-site | src/site/resources/javadoc/taverna-language/org/apache/taverna/scufl2/api/common/class-use/Visitor.VisitorAdapter.html | HTML | apache-2.0 | 4,851 |
sequence' :: Monad m => [m a] -> m [a]
sequence' [] = return []
sequence' (m:ms) = m >>= \ a -> do as <- sequence' ms
return (a: as)
sequence'' ms = foldr func (return []) ms
where
func :: (Monad m) => m a -> m [a] -> m [a]
func m acc = do x <- m
xs <- acc
return (x: xs)
sequence''' [] = return []
sequence''' (m : ms) = do a <- m
as <- sequence''' ms
return (a:as)
{--
sequence'''' [] = return []
sequence'''' (m : ms) = m >>= \ a -> do as <- sequence'''' ms
return (a : as)
--}
mapM' :: Monad m => (a -> m b) -> [a] -> m [b]
mapM' f as = sequence' (map f as)
mapM'' f [] = return []
mapM'' f (a : as) = f a >>= \ b -> mapM'' f as >>= \ bs -> return (b : bs)
sequence_' :: Monad m => [m a] -> m ()
sequence_' [] = return ()
sequence_' (m : ms) = m >> sequence_' ms
--mapM''' :: Monad m => (a -> m b) -> [a] -> m [b]
--mapM''' f as = sequence_' (map f as)
mapMM f [] = return []
mapMM f (a : as) = do b <- f a
bs <- mapMM f as
return (b : bs)
mapMM' f [] = return []
mapMM' f (a : as) = f a >>= \ b ->
do bs <- mapMM' f as
return (b : bs)
mapMM'' f [] = return []
mapMM'' f (a : as) = f a >>= \ b ->
do bs <- mapMM'' f as
return (bs ++ [b])
filterM' :: Monad m => (a -> m Bool) -> [a] -> m [a]
filterM' _ [] = return []
filterM' p (x : xs) = do flag <- p x
ys <- filterM' p xs
if flag then return (x: ys) else return ys
foldLeftM :: Monad m => (a -> b -> m a) -> a -> [b] -> m a
foldLeftM f a [] = return a
foldLeftM f a (x: xs) = do z <- f a x
foldLeftM f z xs
foldRightM :: Monad m => (a -> b -> m b) -> b -> [a] -> m b
foldRightM f a [] = return a
foldRightM f a as = do z <- f (last as) a
foldRightM f z $ init as
liftM :: Monad m => (a -> b) -> m a -> m b
liftM f m = do a <- m
return (f a)
liftM' :: Monad m => (a -> b) -> m a -> m b
liftM' f m = m >>= \ a -> return (f a)
liftM'' :: Monad m => (a -> b) -> m a -> m b
liftM'' f m = m >>= \ a -> m >>= \ b -> return (f a)
liftM''' :: Monad m => (a -> b) -> m a -> m b
liftM''' f m = m >>= \ a -> m >>= \ b -> return (f b)
--liftMM f m = mapM f [m]
| dongarerahul/edx-haskell | chapter-8-hw.hs | Haskell | apache-2.0 | 2,479 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Thu Mar 08 14:17:42 MST 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Interface org.wildfly.swarm.config.elytron.SslSessionSupplier (BOM: * : All 2018.3.3 API)</title>
<meta name="date" content="2018-03-08">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Interface org.wildfly.swarm.config.elytron.SslSessionSupplier (BOM: * : All 2018.3.3 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.3.3</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/elytron/class-use/SslSessionSupplier.html" target="_top">Frames</a></li>
<li><a href="SslSessionSupplier.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Interface org.wildfly.swarm.config.elytron.SslSessionSupplier" class="title">Uses of Interface<br>org.wildfly.swarm.config.elytron.SslSessionSupplier</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">SslSessionSupplier</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.config.elytron">org.wildfly.swarm.config.elytron</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.wildfly.swarm.config.elytron">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">SslSessionSupplier</a> in <a href="../../../../../../org/wildfly/swarm/config/elytron/package-summary.html">org.wildfly.swarm.config.elytron</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../org/wildfly/swarm/config/elytron/package-summary.html">org.wildfly.swarm.config.elytron</a> with parameters of type <a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">SslSessionSupplier</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../org/wildfly/swarm/config/elytron/ClientSslContext.html" title="type parameter in ClientSslContext">T</a></code></td>
<td class="colLast"><span class="typeNameLabel">ClientSslContext.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/elytron/ClientSslContext.html#sslSession-org.wildfly.swarm.config.elytron.SslSessionSupplier-">sslSession</a></span>(<a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">SslSessionSupplier</a> supplier)</code>
<div class="block">Install a supplied SslSession object to the list of subresources</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/wildfly/swarm/config/elytron/ServerSslContext.html" title="type parameter in ServerSslContext">T</a></code></td>
<td class="colLast"><span class="typeNameLabel">ServerSslContext.</span><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/elytron/ServerSslContext.html#sslSession-org.wildfly.swarm.config.elytron.SslSessionSupplier-">sslSession</a></span>(<a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">SslSessionSupplier</a> supplier)</code>
<div class="block">Install a supplied SslSession object to the list of subresources</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/elytron/SslSessionSupplier.html" title="interface in org.wildfly.swarm.config.elytron">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../../../../../../overview-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">WildFly Swarm API, 2018.3.3</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/elytron/class-use/SslSessionSupplier.html" target="_top">Frames</a></li>
<li><a href="SslSessionSupplier.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2018 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| wildfly-swarm/wildfly-swarm-javadocs | 2018.3.3/apidocs/org/wildfly/swarm/config/elytron/class-use/SslSessionSupplier.html | HTML | apache-2.0 | 8,298 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
import java.util.Arrays;
import java.util.List;
public final class XhtmlConstants
{
private XhtmlConstants(){}
public static final String DEBUG_PARTIAL_RESPONSES_PARAM =
"org.apache.myfaces.trinidadinternal.DEBUG_PARTIAL_RESPONSES";
//
// Copied from UIConstants
//
/**
* A portlet facet; when supported, this facet should
* result in a version of page content optimized for use in portlets.
*/
public static final String FACET_PORTLET = CoreRenderKit.OUTPUT_MODE_PORTLET;
public static final String SCRIPT_NAME = "script";
// Input components
public static final String AUTOSUBMIT_EVENT = "autosub";
// Mobile dateField and LovField
// "picker" events and types
public static final String DATE_EVENT = "date";
public static final String CANCEL_EVENT = "cancel";
public static final String TYPE_POST = "post";
// NavigationBar
public static final String GOTO_EVENT = "goto";
// HideShow
public static final String HIDE_EVENT = "hide";
public static final String SHOW_EVENT = "show";
// HGrid
public static final int INCOMPLETE_DATA_SET = -1;
// SortableHeader
public static final String SORT_EVENT = "sort";
// Poll
public static final String POLL_EVENT = "poll";
// Chart Drill down
public static final String CHART_DRILL_DOWN_EVENT = "chartDrillDown";
/**
* Constant for the value of the "value" event parameter when
* the user is asking to see all rows.
*/
public static final String VALUE_SHOW_ALL = "all";
//
// Context Property Names
//
/**
* String rendering property for the name of the current form bean.
*/
public static final String FORM_NAME_PROPERTY = "formName";
/**
* Key used to store the initialFocus on the RenderingContext
* under the UIConstants.MARLIN_NAMESPACE. initialFocus is an attribute
* of body and is an id indicating the component
* which should have the initial focus.
*/
public static final Object INITIAL_FOCUS_CONTEXT_PROPERTY = "initialFocus";
//
// parameter names
//
public static final String PARTIAL_PARAM = "partial";
public static final String PARTIAL_TARGETS_PARAM = "partialTargets";
public static final String SIZE_PARAM = "size";
public static final String SOURCE_PARAM = "source";
public static final String STATE_PARAM = "state";
public static final String TYPE_PARAM = "type";
public static final String VALUE_PARAM = "value";
public static final String TARGETITEM_PARAM = "targetItem";
//
// parameter values
//
// calendar, mobile dateField params
public static final String EVENT_PARAM = "event";
public static final String LOC_PARAM = "loc";
public static final String MAX_VALUE_PARAM = "maxValue";
public static final String MIN_VALUE_PARAM = "minValue";
public static final String MONTH_PARAM = "month";
public static final String SCROLLED_VALUE_PARAM = "scrolledValue";
public static final String YEAR_PARAM = "year";
//
// Named Children
//
public static final String PATH_STAMP_CHILD = "pathStamp";
//
// Enumerated Values
//
// Horizontal alignment
/**
* Horizontal alignment constant for end alignment; right
* alignment will be used in left-to-right languages, left
* alignment in right-to-left languages.
*/
public static final String H_ALIGN_END = "end";
// Vertical alignment
/**
* Vertical alignment constant for centering.
*/
public static final String V_ALIGN_MIDDLE = "middle";
/**
* Vertical alignment constant for top alignment.
*/
public static final String V_ALIGN_TOP = "top";
// MAX_VALUE_ATTR
public static final int MAX_VALUE_UNKNOWN = -1;
// MESSAGE_TYPE_ATTR
/**
* Message type if the associated message is informational.
*/
public static final String MESSAGE_TYPE_INFO = "info";
/**
* Message type if the associated message is a warning.
*/
public static final String MESSAGE_TYPE_WARNING = "warning";
/**
* Message type if the associated message is an error.
*/
public static final String MESSAGE_TYPE_ERROR = "error";
/**
* Message type if the associated message is a confirmation.
*/
public static final String MESSAGE_TYPE_CONFIRMATION = "confirmation";
/**
* Message type if the page layout messageType is processing.
*/
public static final String MESSAGE_TYPE_PROCESSING = "processing";
/**
* Message type if there is no type of message.
*/
public static final String MESSAGE_TYPE_NONE = "none";
// SORTABLE_ATTR
/**
* Sortable value if the table column is sortable and is currently
* sorted with ascending values down the column.
*/
public static final String SORTABLE_ASCENDING = "ascending";
/**
* Sortable value if the table column is sortable and is currently
* sorted with descending values down the column.
*/
public static final String SORTABLE_DESCENDING = "descending";
/**
* The default text used for a secret field.
* When working with password fields, compare the value submitted
* with this value. If they are the same, then the user did not modify
* the field.
*/
public static final String SECRET_FIELD_DEFAULT_VALUE = "******";
// ORIENTATION_ATTR
/**
* Value to indicate orientation is vertical (currently used by BreadCrumbs)
*/
public final static String ORIENTATION_VERTICAL="vertical";
public static final String SELECTED_KEY = "selected";
// ===================== End of copy from UIConstants =======================
public static final String STYLES_CACHE_DIRECTORY = "/adf/styles/cache/";
public static final String OUTPUT_MODE_PORTLET = FACET_PORTLET;
// ============= Html elements ================
public static final String DIV_ELEMENT = "div";
public static final List<String> HEADER_ELEMENTS =
Arrays.asList(new String[]{"h1", "h2", "h3",
"h4", "h5", "h6"});
public static final String LINK_ELEMENT = "a";
public static final String PARAGRAPH_ELEMENT = "p";
public static final String SCRIPT_ELEMENT = "script";
public static final String SPAN_ELEMENT = "span";
public static final String TABLE_DATA_ELEMENT = "td";
public static final String TABLE_BODY_ELEMENT = "tbody";
public static final String TABLE_ELEMENT = "table";
public static final String TABLE_HEADER_ELEMENT = "th";
public static final String TABLE_ROW_ELEMENT = "tr";
public static final String FIELDSET_ELEMENT = "fieldset";
public static final String LEGEND_ELEMENT = "legend";
//
// Copied from BaseDesktopConstants
//
public static final String BASE_DESKTOP_ID = "base.desktop";
//
// Copied from XhtmlLafConstants
//
public static final String APACHE_TRINIDAD_DESKTOP =
"org.apache.myfaces.trinidad.desktop";
public static final String APACHE_TRINIDAD_PDA =
"org.apache.myfaces.trinidad.pda";
public static final String APACHE_TRINIDAD_PORTLET =
CoreRenderKit.OUTPUT_MODE_PORTLET;
/** Unicode character for non-breaking space */
public static final char NBSP_CHAR = 0xA0;
/** String containing Unicode character for non-breaking space */
public static final String NBSP_STRING = String.valueOf(NBSP_CHAR);
public static final String ALIGN_ATTRIBUTE = "align";
public static final String COLS_ATTRIBUTE = "cols";
public static final String COLSPAN_ATTRIBUTE = "colspan";
public static final String HEIGHT_ATTRIBUTE = "height";
public static final String HREF_ATTRIBUTE = "href";
public static final String ID_ATTRIBUTE = "id";
public static final String NOWRAP_ATTRIBUTE = "nowrap";
public static final String ONCLICK_ATTRIBUTE = "onclick";
public static final String ROWS_ATTRIBUTE = "rows";
public static final String ROWSPAN_ATTRIBUTE = "rowspan";
public static final String SIZE_ATTRIBUTE = "size";
public static final String STYLE_ATTRIBUTE = "style";
public static final String VALIGN_ATTRIBUTE = "valign";
public static final String WIDTH_ATTRIBUTE = "width";
public static final String DIR_ATTRIBUTE_VALUE = "dir";
public static final String EMPTY_STRING_ATTRIBUTE_VALUE = "";
public static final String LEFT_ATTRIBUTE_VALUE = "left";
public static final String MIDDLE_ATTRIBUTE_VALUE = "middle";
public static final String ONE_HUNDRED_PERCENT_ATTRIBUTE_VALUE = "100%";
public static final String RIGHT_ATTRIBUTE_VALUE = "right";
public static final String COLOR_PALETTE_TRANSPARENT_ICON_NAME = "cpt.gif";
// 'xc' stands for uiX Composite
// -= Simon =-
// FIXME: Should it be renamed to remove UIX reference?
public static final String COMPOSITE_ID_EXTENSION = "__xc_";
// context property to indicate that form elements are repeated and the
// data needs to be kept in sync
public static final Object REPEAT_PROPERTY = new Object();
//Constants for Non JavaScript browser support
public static final String NO_JS_PARAMETER_KEY = "_parameterkey";
public static final String NO_JS_PARAMETER_KEY_BUTTON = "go";
public static final String MULTIPLE_VALUE_PARAM = "multipleValueParam";
public static final String NON_JS_BROWSER = "_noJavaScript";
public static final String NON_JS_BROWSER_TRUE = "true";
public static final String NON_JS_DETAIL_DISCLOSED_ICON = "-";
public static final String NON_JS_DETAIL_UNDISCLOSED_ICON = "+";
public static final String NON_JS_ASC_ICON = "v";
public static final String NON_JS_DESC_ICON = "^";
}
| adamrduffy/trinidad-1.0.x | trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java | Java | apache-2.0 | 10,748 |
/*
* Copyright 2021 Google LLC
*
* 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.
*/
import {
Component,
ChangeDetectionStrategy,
Input,
ElementRef,
ChangeDetectorRef,
OnDestroy,
HostBinding,
ComponentRef,
ViewChild,
Output,
EventEmitter,
} from '@angular/core';
import { ComponentSize, ISelectItem } from 'cd-interfaces';
import { OverlayService } from '../overlay/overlay.service';
import { Subscription } from 'rxjs';
import { SelectComponent } from '../select/select.component';
import { assignMenuIndex } from '../input/input.utils';
import { injectResetState } from '../input/select-input/select-input.utils';
const MIN_WIDTH = 150;
@Component({
selector: 'cd-select-button',
templateUrl: './select-button.component.html',
styleUrls: ['./select-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SelectButtonComponent implements OnDestroy {
private _subscriptions: Subscription = Subscription.EMPTY;
private _componentRef?: ComponentRef<SelectComponent>;
private _menuData: ISelectItem[] = [];
private _active = false;
@Input() resetState?: string;
@Input() size: ComponentSize = ComponentSize.Small;
@Input() iconSize: ComponentSize = ComponentSize.Small;
@Input() data: ISelectItem[] = [];
@Input() iconName = 'add'; // Default material icon
@Input() disabled = false;
@Input() highlight = false;
@Input() ariaLabel = '';
@Output() selected = new EventEmitter<ISelectItem>();
@HostBinding('class.active')
set active(active: boolean) {
this._active = active;
}
get active() {
return this._active;
}
@ViewChild('btnRef', { read: ElementRef, static: true })
_btnRef!: ElementRef;
constructor(
protected _elemRef: ElementRef,
protected _overlayService: OverlayService,
protected _cdRef: ChangeDetectorRef
) {}
get bounds(): DOMRect {
return this._elemRef.nativeElement.getBoundingClientRect();
}
onClick(e: MouseEvent): void {
e.preventDefault();
e.stopImmediatePropagation();
if (this.disabled) return;
const target = e.currentTarget as HTMLElement;
this.active = true;
target.blur();
this.createMenu();
}
createMenu(): void {
const { data } = this;
if (!data.length) return;
const config = { parentRect: this.bounds };
const componentRef = this._overlayService.attachComponent(SelectComponent, config);
const menuData = assignMenuIndex(injectResetState(this.data, this.resetState));
componentRef.instance.data = menuData;
componentRef.instance.showFilter = true;
componentRef.instance.width = MIN_WIDTH;
this._subscriptions = this._overlayService.closed.subscribe(this.handleCloseSubscription);
// Component refs manage their own subscriptions
const subscriptions = new Subscription();
subscriptions.add(componentRef.instance.selected.subscribe(this.handleSelectionSubscription));
subscriptions.add(componentRef.instance.close.subscribe(this.handleCloseSubscription));
componentRef.onDestroy(() => subscriptions.unsubscribe());
this._componentRef = componentRef;
this._menuData = menuData;
}
handleCloseSubscription = (_focus: boolean) => {
this.cleanupComponentRef();
};
handleSelectionSubscription = (index: number) => {
const item = this._menuData[index];
if (!item) return;
this.selected.emit(item);
};
cleanupComponentRef = () => {
this.active = false;
this._cdRef.markForCheck();
if (this._componentRef) {
this._overlayService.close();
this._componentRef = undefined;
}
};
ngOnDestroy(): void {
this.cleanupComponentRef();
this._subscriptions.unsubscribe();
}
}
| google/web-prototyping-tool | projects/cd-common/src/lib/components/select-button/select-button.component.ts | TypeScript | apache-2.0 | 4,209 |
# Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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.
module AWS
module Core
# Mixed into clients that use v2 authorization.
# @private
module AuthorizeV2
def string_to_sign
parts = [http_method,
host,
path,
params.sort.collect { |p| p.encoded }.join('&')]
parts.join("\n")
end
def add_authorization! signer
self.access_key_id = signer.access_key_id
add_param('AWSAccessKeyId', access_key_id)
add_param('SignatureVersion', '2')
add_param('SignatureMethod', 'HmacSHA256')
add_param('Signature', signer.sign(string_to_sign))
end
end
end
end
| kostia/aws-sdk-for-ruby | lib/aws/core/authorize_v2.rb | Ruby | apache-2.0 | 1,210 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.