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
|
|---|---|---|---|---|---|
/*
* Copyright 2011 Thingtrack, S.L.
*
* 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.thingtrack.konekti.dao.api;
import java.util.List;
import com.thingtrack.konekti.dao.template.Dao;
import com.thingtrack.konekti.domain.Organization;
import com.thingtrack.konekti.domain.SupplierType;
/**
* Supplier Group Data Access Layer
* <p>
* @author Thingtrack S.L.
*
*/
public interface SupplierTypeDao extends Dao<SupplierType, Integer> {
public List<SupplierType> getAll(Organization organization) throws Exception;
public SupplierType getByName(Organization organization, String name) throws Exception;
}
|
thingtrack/konekti
|
core/konekti.dao.api/src/main/java/com/thingtrack/konekti/dao/api/SupplierTypeDao.java
|
Java
|
apache-2.0
| 1,128
|
package com.sixsq.slipstream.authn;
/*
* +=================================================================+
* SlipStream Server (WAR)
* =====
* Copyright (C) 2013 SixSq Sarl (sixsq.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.
* -=================================================================-
*/
import org.restlet.Request;
import org.restlet.data.Form;
import org.restlet.data.MediaType;
import org.restlet.data.Reference;
import org.restlet.representation.Representation;
import org.restlet.representation.StringRepresentation;
import org.restlet.resource.Get;
import org.w3c.dom.Document;
import com.sixsq.slipstream.resource.BaseResource;
import com.sixsq.slipstream.util.HtmlUtil;
import com.sixsq.slipstream.util.ResourceUriUtil;
import com.sixsq.slipstream.util.SerializationUtil;
public class AuthnResource extends BaseResource {
private final String templateName; // name of the page
protected AuthnResource(String templateName) {
this.templateName = templateName;
}
@Get("html")
public Representation toHtml() {
String metadata = "";
if (getUser() != null) {
Document document = SerializationUtil.toXmlDocument(getUser());
metadata = SerializationUtil.documentToString(document);
}
return new StringRepresentation(HtmlUtil.toHtml(metadata, templateName,
getUser(), getRequest()), MediaType.TEXT_HTML);
}
protected Reference extractRedirectURL(Request request) {
return extractRedirectURL(request, "/dashboard");
}
/**
* If the defaultUrl is null and no redirect URL query parameter is
* provided, the redirect URL is the base URL.
*
* @param request
* @param defaultUrl
* @return redirectUrl
*/
protected Reference extractRedirectURL(Request request, String defaultUrl) {
Reference resourceRef = request.getResourceRef();
Form queryForm = resourceRef.getQueryAsForm();
String relativeURL = queryForm.getFirstValue("redirectURL", true);
Reference baseRefSlash = ResourceUriUtil.getBaseRefSlash(request);
Reference redirectUrl = null;
if (relativeURL != null) {
redirectUrl = new Reference(baseRefSlash, relativeURL);
} else if (defaultUrl != null) {
redirectUrl = new Reference(baseRefSlash, defaultUrl);
} else {
redirectUrl = new Reference(baseRefSlash);
}
return redirectUrl;
}
@Override
protected String getPageRepresentation() {
return null;
}
}
|
slipstream/SlipStreamServer
|
jar-service/src/main/java/com/sixsq/slipstream/authn/AuthnResource.java
|
Java
|
apache-2.0
| 2,892
|
package io.eels.component.hive
import org.apache.hadoop.fs.FileSystem
import org.apache.hadoop.hive.metastore.IMetaStoreClient
import scala.collection.JavaConverters._
case class HiveDatabase(dbName: String)(implicit fs: FileSystem, client: IMetaStoreClient) {
def tables(): List[HiveTable] = {
val tables = client.getAllTables(dbName).asScala
tables.map { it => HiveTable(dbName, it) }.toList
}
def table(tableName: String): HiveTable = {
val exists = client.tableExists(dbName, tableName)
if (!exists)
throw new IllegalArgumentException(s"$dbName.$tableName does not exist")
HiveTable(dbName, tableName)
}
}
|
stheppi/eel
|
eel-hive/src/main/scala/io/eels/component/hive/HiveDatabase.scala
|
Scala
|
apache-2.0
| 646
|
.accordion{background:#fff;overflow:hidden;}
.accordion .accordion-header{background:#efefef;border-top-width:0;cursor:pointer;}
.accordion .accordion-header .panel-title{font-weight:normal;}
.accordion .accordion-header-selected .panel-title{font-weight:bold;}
.accordion-noborder .accordion-header{border-width:0 0 1px;}
.accordion-noborder .accordion-body{border-width:0px;}
.accordion-collapse{background:url('images/accordion_collapse.png') no-repeat;}
.accordion-expand{background:url('images/accordion_expand.png') no-repeat;}
.calendar{background:#fff;border:1px solid #d3d3d3;padding:1px;overflow:hidden;}
.calendar-noborder{border:0px;}
.calendar-header{position:relative;background:#efefef;font-size:12px;height:22px;}
.calendar-title{text-align:center;height:22px;}
.calendar-title span{position:relative;top:2px;display:inline-block;padding:3px;cursor:pointer;-moz-border-radius:4px;-webkit-border-radius:4px;}
.calendar-prevmonth,.calendar-nextmonth,.calendar-prevyear,.calendar-nextyear{position:absolute;top:4px;width:14px;height:14px;line-height:12px;cursor:pointer;font-size:1px;-moz-border-radius:4px;-webkit-border-radius:4px;}
.calendar-prevmonth{left:20px;background:url('images/calendar_prevmonth.gif') no-repeat 3px 2px;}
.calendar-nextmonth{right:20px;background:url('images/calendar_nextmonth.gif') no-repeat 3px 2px;}
.calendar-prevyear{left:3px;background:url('images/calendar_prevyear.gif') no-repeat 1px 2px;}
.calendar-nextyear{right:3px;background:url('images/calendar_nextyear.gif') no-repeat 1px 2px;}
.calendar-body{font-size:12px;position:relative;}
.calendar-body table{width:100%;height:100%;border:1px solid #eee;font-size:12px;padding1:5px;}
.calendar-body th,.calendar-body td{text-align:center;}
.calendar-body th{background:#fafafa;color:#888;border-bottom1:1px solid #ccc;}
.calendar-day{color:#222;cursor:pointer;border:1px solid #fff;-moz-border-radius:4px;-webkit-border-radius:4px;}
.calendar-sunday{color:#CC2222;}
.calendar-saturday{color:#00ee00;}
.calendar-today{color:#0000ff;}
.calendar-other-month{opacity:0.3;filter:alpha(opacity=30);}
.calendar-hover{border:1px solid red;}
.calendar-selected{background:#FBEC88;border:1px solid red;}
.calendar-nav-hover{background-color:#FBEC88;}
.calendar-menu{position:absolute;top:0px;left:0px;width:180px;height:150px;padding:5px;font-size:12px;background:#fafafa;opacity:0.8;filter:alpha(opacity=80);display:none;}
.calendar-menu-year-inner{text-align:center;padding-bottom:5px;}
.calendar-menu-year{width:40px;text-align:center;border:1px solid #ccc;padding:2px;font-weight:bold;}
.calendar-menu-prev,.calendar-menu-next{display:inline-block;width:21px;height:21px;vertical-align:top;cursor:pointer;}
.calendar-menu-prev{margin-right:10px;background:url('images/calendar_prevyear.gif') no-repeat 5px 6px;}
.calendar-menu-next{margin-left:10px;background:url('images/calendar_nextyear.gif') no-repeat 5px 6px;}
.calendar-menu-hover{background-color:#FBEC88;}
.calendar-menu-month-inner table{width:100%;height:100%;}
.calendar-menu-month{text-align:center;cursor:pointer;border:1px solid #fafafa;font-weight:bold;color:#666;-moz-border-radius:4px;-webkit-border-radius:4px;}
.combo{display:inline-block;white-space:nowrap;font-size:12px;margin:0;padding:0;border:1px solid #d3d3d3;background:#fff;}
.combo-text{font-size:12px;border:0px;line-height:20px;height:20px;padding:0px;*height:18px;*line-height:18px;_height:18px;_line-height:18px;}
.combo-arrow{background:#E0ECF9 url('images/combo_arrow.gif') no-repeat 3px 4px;width:18px;height:20px;overflow:hidden;display:inline-block;vertical-align:top;cursor:pointer;opacity:0.6;filter:alpha(opacity=60);}
.combo-arrow-hover{opacity:1.0;filter:alpha(opacity=100);}
.combo-panel{background:#fff;overflow:auto;}
.combobox-item{padding:2px;font-size:12px;padding:3px;padding-right:0px;}
.combobox-item-hover{background:#fafafa;}
.combobox-item-selected{background:#FBEC88;}.datagrid .panel-body{overflow:hidden;}
.datagrid-wrap{position:relative;}
.datagrid-view{position:relative;overflow:hidden;}
.datagrid-view1{position:absolute;overflow:hidden;left:0px;top:0px;border-right1:1px solid #ccc;}
.datagrid-view2{position:absolute;overflow:hidden;left:210px;top:0px;}
.datagrid-mask{position:absolute;left:0;top:0;background:#ccc;opacity:0.3;filter:alpha(opacity=30);display:none;}
.datagrid-mask-msg{position:absolute;cursor1:wait;left:100px;top:50px;width:auto;height:16px;padding:12px 5px 10px 30px;background:#fff url('images/pagination_loading.gif') no-repeat scroll 5px 10px;border:2px solid #ccc;color:#222;display:none;}
.datagrid-title{background:url('images/datagrid_title_bg.gif') repeat-x;border-bottom:1px solid #D3D3D3;border-top:1px solid #fff;position:relative;padding:5px 0px;}
.datagrid-title-text{color:#3F3F3F;font-weight:bold;padding-left:5px;}
.datagrid-title-with-icon{padding-left:22px;}
.datagrid-title-icon{position:absolute;width:16px;height:16px;left:3px;top:4px!important;top:6px;}
.datagrid-sort-desc .datagrid-sort-icon{padding:2px 13px 3px 0px;background:url('images/datagrid_sort_desc.gif') no-repeat center center;}
.datagrid-sort-asc .datagrid-sort-icon{padding:2px 13px 3px 0px;background:url('images/datagrid_sort_asc.gif') no-repeat center center;}
.datagrid-toolbar{height:28px;background:#efefef;padding:1px 2px;border-bottom:1px solid #ccc;}
.datagrid-btn-separator{float:left;height:24px;border-left:1px solid #ccc;border-right:1px solid #fff;margin:2px 1px;}
.datagrid-pager{background:#efefef;border-top:1px solid #ccc;position:relative;}
.datagrid-header{overflow:hidden;background:#fafafa url('images/datagrid_header_bg.gif') repeat-x left bottom;border-bottom:1px solid #ccc;}
.datagrid-header-inner{float:left;width:10000px;}
.datagrid-header td{border-right:1px dotted #ccc;font-size:12px;font-weight:normal;background:#fafafa url('images/datagrid_header_bg.gif') repeat-x left bottom;border-bottom:1px dotted #ccc;border-top:1px dotted #fff;}
.datagrid-header td.datagrid-header-over{background:#EBF3FD;}
.datagrid-header .datagrid-cell{margin:0;padding:3px 4px;white-space:nowrap;word-wrap:normal;overflow:hidden;text-align:center;}
.datagrid-header .datagrid-cell-group{margin:0;padding:4px 2px 4px 4px;white-space:nowrap;word-wrap:normal;overflow:hidden;text-align:center;}
.datagrid-header-rownumber{width:25px;text-align:center;margin:0px;padding:3px 0px;}
.datagrid-td-rownumber{background:#fafafa url('images/datagrid_header_bg.gif') repeat-x left bottom;}
.datagrid-cell-rownumber{width:25px;text-align:center;margin:0px;padding:3px 0px;color:#000;}
.datagrid-body{margin:0;padding:0;overflow:auto;zoom:1;}
.datagrid-view1 .datagrid-body-inner{padding-bottom:20px;}
.datagrid-view1 .datagrid-body{overflow:hidden;}
.datagrid-footer{overflow:hidden;}
.datagrid-footer-inner{border-top:1px solid #ccc;width:10000px;float:left;}
.datagrid-body td,.datagrid-footer td{font-size:12px;border-right:1px dotted #ccc;border-bottom:1px dotted #ccc;overflow:hidden;padding:0;margin:0;}
.datagrid-body .datagrid-cell,.datagrid-footer .datagrid-cell{overflow:hidden;margin:0;padding:3px 4px;white-space:nowrap;word-wrap:normal;}
.datagrid-header-check{padding:3px 6px;}
.datagrid-cell-check{padding:3px 6px;font-size:1px;overflow:hidden;}
.datagrid-header-check input{margin:0;padding:0;width:15px;height:15px;}
.datagrid-cell-check input{margin:0;padding:0;width:15px;height:15px;}
.datagrid-row-collapse{background:url('images/datagrid_row_collapse.gif') no-repeat center center;}
.datagrid-row-expand{background:url('images/datagrid_row_expand.gif') no-repeat center center;}
.datagrid-row-alt{background:#fafafa;}
.datagrid-row-over{background:#efefef;background1:#FBEC88;cursor:default;}
.datagrid-row-selected{background:#FBEC88;}
.datagrid-resize-proxy{position:absolute;width:1px;top:0;height:10000px;background:red;cursor:e-resize;display:none;}
.datagrid-body .datagrid-editable{padding:0;}
.datagrid-body .datagrid-editable td{border:0;padding:0;}
.datagrid-body .datagrid-editable .datagrid-editable-input{width:100%;font-size:12px;border:1px solid #ccc;padding:3px 2px;}.datebox .combo-arrow{background:url('images/datebox_arrow.png') no-repeat center center;}
.datebox-calendar-inner{height:180px;}
.datebox-button{height:18px;padding:2px 5px;font-size:12px;background-color:#fafafa;text-align:center;}
.datebox-current,.datebox-close{float:left;color:#888;text-decoration:none;font-weight:bold;}
.datebox-close{float:right;}
.datebox-ok{color:#888;text-decoration:none;font-weight:bold;}
.datebox-button-hover{color:#A4BED4;}
.dialog-content{overflow:auto;}
.dialog-toolbar{background:#fafafa;padding:2px 5px;border-bottom:1px solid #eee;}
.dialog-tool-separator{float:left;height:24px;border-left:1px solid #ccc;border-right:1px solid #fff;margin:2px 1px;}
.dialog-button{border-top:1px solid #eee;background:#fafafa;padding:5px 5px;text-align:right;}
.dialog-button .l-btn{margin-left:5px;}.layout{position:relative;overflow:hidden;margin:0;padding:0;}
.layout-panel{position:absolute;overflow:hidden;}
.layout-panel-east,.layout-panel-west{z-index:2;background1:#fff;}
.layout-panel-north,.layout-panel-south{z-index:3;background1:#fff;}
.layout-button-up{background:url('images/layout_button_up.gif') no-repeat;}
.layout-button-down{background:url('images/layout_button_down.gif') no-repeat;}
.layout-button-left{background:url('images/layout_button_left.gif') no-repeat;}
.layout-button-right{background:url('images/layout_button_right.gif') no-repeat;}
.layout-expand{position:absolute;padding:0px 5px;padding:0px;background:#efefef;font-size:1px;cursor:pointer;z-index:1;}
.layout-expand .panel-header{background:transparent;border-bottom-width:0px;}
.layout-expand .panel-header .panel-tool{top: 5px;}
.layout-expand .panel-body{overflow:hidden;}
.layout-expand-over{background:#fafafa;}
.layout-body{overflow:auto;background:#fff;}
.layout-split-proxy-h{position:absolute;width:5px;background:#ccc;font-size:1px;cursor:e-resize;display:none;z-index:5;}
.layout-split-proxy-v{position:absolute;height:5px;background:#ccc;font-size:1px;cursor:n-resize;display:none;z-index:5;}
.layout-split-north{border-bottom:5px solid #efefef;}
.layout-split-south{border-top:5px solid #efefef;}
.layout-split-east{border-left:5px solid #efefef;}
.layout-split-west{border-right:5px solid #efefef;}
.layout-mask{position:absolute;background:#fafafa;filter:alpha(opacity=10);opacity:0.10;z-index:4;}
a.l-btn{color:#444;background:url('images/button_a_bg.gif') no-repeat top right;font-size:12px;text-decoration:none;display:inline-block;zoom:1;height:24px;padding-right:18px;cursor:pointer;outline:none;}
a.l-btn-plain{background:transparent;padding-right:5px;border:1px solid transparent;_border:0px solid #efefef;_padding:1px 6px 1px 1px;}
a.l-btn-disabled{color:#ccc;opacity:0.5;filter:alpha(opacity=50);cursor:default;}
a.l-btn span.l-btn-left{display:inline-block;background:url('images/button_span_bg.gif') no-repeat top left;padding:4px 0px 4px 18px;line-height:16px;height:16px;}
a.l-btn-plain span.l-btn-left{background:transparent;padding-left:5px;}
a.l-btn span span.l-btn-text{display:inline-block;height:16px;line-height:16px;padding:0px;}
a.l-btn span span span.l-btn-empty{display:inline-block;padding:0px;width:16px;}
a:hover.l-btn{background-position: bottom right;outline:none;}
a:hover.l-btn span.l-btn-left{background-position: bottom left;}
a:hover.l-btn-plain{border:1px solid #d3d3d3;background:url('images/button_plain_hover.png') repeat-x left bottom;_padding:0px 5px 0px 0px;-moz-border-radius:3px;-webkit-border-radius: 3px;}
a:hover.l-btn-disabled{background-position:top right;}
a:hover.l-btn-disabled span.l-btn-left{background-position:top left;}
.menu{position:absolute;background:#f0f0f0 url('images/menu.gif') repeat-y;margin:0;padding:2px;border:1px solid #ccc;overflow:hidden;}
.menu-item{position:relative;margin:0;padding:0;height:22px;line-height:20px;overflow:hidden;font-size:12px;cursor:pointer;border:1px solid transparent;_border:1px solid #f0f0f0;}
.menu-text{position:absolute;left:28px;top:0px;}
.menu-icon{position:absolute;width:16px;height:16px;top:3px;left:2px;}
.menu-rightarrow{position: absolute;width:4px;height:7px;top:7px;right:5px;background:url('images/menu_rightarrow.png') no-repeat;}
.menu-sep{margin:3px 0px 3px 24px;line-height:2px;font-size:2px;background:url('images/menu_sep.png') repeat-x;}
.menu-active{border:1px solid #d3d3d3;background:#fafafa;-moz-border-radius:3px;-webkit-border-radius: 3px;}
.menu-shadow{position:absolute;background:#ddd;-moz-border-radius:5px;-webkit-border-radius: 5px;-moz-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);-webkit-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);}
.menu-item-disabled{opacity:0.5;filter:alpha(opacity=50);cursor:default;}
.menu-active-disabled{border-color:#d3d3d3;}
.m-btn-downarrow{display:inline-block;width:12px;line-height:14px;*line-height:15px;background:url('images/menu_downarrow.png') no-repeat 4px center;}
a.m-btn-active{background-position: bottom right;}
a.m-btn-active span.l-btn-left{background-position: bottom left;}
a.m-btn-plain-active{background:transparent;border:1px solid #d3d3d3;_padding:0px 5px 0px 0px;-moz-border-radius:3px;-webkit-border-radius: 3px;}
.messager-body{padding:5px 10px;}
.messager-button{text-align:center;padding-top:10px;}
.messager-icon{float:left;width:47px;height:35px;}
.messager-error{background:url('images/messager_error.gif') no-repeat scroll left top;}
.messager-info{background:url('images/messager_info.gif') no-repeat scroll left top;}
.messager-question{background:url('images/messager_question.gif') no-repeat scroll left top;}
.messager-warning{background:url('images/messager_warning.gif') no-repeat scroll left top;}
.messager-input{width: 262px;border:1px solid #ccc;}
.messager-progress{padding:10px;}
.messager-p-msg{margin-bottom:5px;}.pagination{zoom:1;}
.pagination table{float:left;height:30px;}
.pagination-btn-separator{float:left;height:24px;border-left:1px solid #ccc;border-right:1px solid #fff;margin:3px 1px;}
.pagination-num{border:1px solid #ccc;margin:0 2px;}
.pagination-page-list{margin:0px 6px;}
.pagination-info{float:right;padding-right:6px;padding-top:8px;font-size:12px;}
.pagination span{font-size:12px;}
.pagination-first{background:url('images/pagination_first.gif') no-repeat;}
.pagination-prev{background:url('images/pagination_prev.gif') no-repeat;}
.pagination-next{background:url('images/pagination_next.gif') no-repeat;}
.pagination-last{background:url('images/pagination_last.gif') no-repeat;}
.pagination-load{background:url('images/pagination_load.png') no-repeat;}
.pagination-loading{background:url('images/pagination_loading.gif') no-repeat;}
.panel{overflow:hidden;font-size:12px;}
.panel-header{padding:5px;line-height:15px;color:#3F3F3F;font-weight:bold;font-size:12px;background:url('images/panel_title.gif') repeat-x;position:relative;border:1px solid #D3D3D3;}
.panel-title{background:url('images/blank.gif') no-repeat;}
.panel-header-noborder{border-width:0px;border-bottom:1px solid #D3D3D3;}
.panel-body{overflow:auto;border:1px solid #D3D3D3;border-top-width:0px;}
.panel-body-noheader{border-top-width:1px;}
.panel-body-noborder{border-width:0px;}
.panel-with-icon{padding-left:18px;}
.panel-icon{position:absolute;left:5px;top:4px;width:16px;height:16px;}
.panel-tool{position:absolute;right:5px;top:4px;}
.panel-tool div{display:block;float:right;width:16px;height:16px;margin-left:2px;cursor:pointer;opacity:0.6;filter:alpha(opacity=60);}
.panel-tool div.panel-tool-over{opacity:1;filter:alpha(opacity=100);}
.panel-tool-close{background:url('images/panel_tools.gif') no-repeat -16px 0px;}
.panel-tool-min{background:url('images/panel_tools.gif') no-repeat 0px 0px;}
.panel-tool-max{background:url('images/panel_tools.gif') no-repeat 0px -16px;}
.panel-tool-restore{background:url('images/panel_tools.gif') no-repeat -16px -16px;}
.panel-tool-collapse{background:url('images/panel_tool_collapse.gif') no-repeat;}
.panel-tool-expand{background:url('images/panel_tool_expand.gif') no-repeat;}
.panel-loading{padding:11px 0px 10px 30px;background:url('images/panel_loading.gif') no-repeat 10px 10px;}
.progressbar{border:1px solid #D3D3D3;border-radius:5px;overflow:hidden;}
.progressbar-text{text-align:center;color:#3F3F3F;position:absolute;}
.progressbar-value{background-color:#eee;border-radius:5px;width:0;}
.propertygrid .datagrid-view1 .datagrid-body,.propertygrid .datagrid-group{background:#fafafa;}
.propertygrid .datagrid-group{height:21px;overflow:hidden;}
.propertygrid .datagrid-view1 .datagrid-body td{border-color:#fafafa;}
.propertygrid .datagrid-view1 .datagrid-row-over,.propertygrid .datagrid-view1 .datagrid-row-selected{background:#fafafa;}
.propertygrid .datagrid-group span{color:#3F3F3F;font-weight:bold;padding-left:4px;}
.propertygrid .datagrid-row-collapse,.propertygrid .datagrid-row-expand{background-position:3px center;}.searchbox{display:inline-block;white-space:nowrap;font-size:12px;margin:0;padding:0;border:1px solid #d3d3d3;background:#fff;}
.searchbox-text{font-size:12px;border:0px;line-height:20px;height:20px;padding:0px;*height:18px;*line-height:18px;_height:18px;_line-height:18px;}
.searchbox-button{background:url('images/searchbox_button.png') no-repeat center center;width:18px;height:20px;overflow:hidden;display:inline-block;vertical-align:top;cursor:pointer;opacity:0.6;filter:alpha(opacity=60);}
.searchbox-button-hover{opacity:1.0;filter:alpha(opacity=100);}
.searchbox-prompt{font-size:12px;color:#ccc;}
.searchbox a.l-btn-plain{background-color:#efefef;height:20px;border:0;padding:0 6px 0 0;vertical-align:top;}
.searchbox a.l-btn .l-btn-left{padding:2px 0 2px 2px;}
.searchbox a.l-btn-plain:hover{-moz-border-radius:0px;-webkit-border-radius: 0px;border:0;padding:0 6px 0 0;}
.searchbox a.m-btn-plain-active{-moz-border-radius:0px;-webkit-border-radius: 0px;}.spinner{display:inline-block;white-space:nowrap;font-size:12px;margin:0;padding:0;border:1px solid #d3d3d3;}
.spinner-text{font-size:12px;border:0px;line-height:20px;height:20px;padding:0px;*height:18px;*line-height:18px;_height:18px;_line-height:18px;}
.spinner-arrow{display:inline-block;vertical-align:top;margin:0;padding:0;}
.spinner-arrow-up,.spinner-arrow-down{display:block;background:#E0ECF9 url('images/spinner_arrow_up.gif') no-repeat 5px 2px;font-size:1px;width:18px;height:10px;}
.spinner-arrow-down{background:#E0ECF9 url('images/spinner_arrow_down.gif') no-repeat 5px 3px;}
.spinner-arrow-hover{background-color:#ECF9F9;}.s-btn-downarrow{display:inline-block;width:16px;line-height:14px;*line-height:15px;background:url('images/menu_downarrow.png') no-repeat 9px center;}
a.s-btn-active{background-position: bottom right;}
a.s-btn-active span.l-btn-left{background-position: bottom left;}
a.s-btn-active .s-btn-downarrow{background:url('images/menu_split_downarrow.png') no-repeat 4px -19px;}
a:hover.l-btn .s-btn-downarrow{background:url('images/menu_split_downarrow.png') no-repeat 4px -19px;}
a.s-btn-plain-active{background:transparent;border:1px solid #d3d3d3;_padding:0px 5px 0px 0px;-moz-border-radius:3px;-webkit-border-radius: 3px;}
a.s-btn-plain-active .s-btn-downarrow{background:url('images/menu_split_downarrow.png') no-repeat 4px -19px;}.tabs-container{overflow:hidden;background:#fff;}
.tabs-header{border:1px solid #D3D3D3;background:#efefef;border-bottom:0px;position:relative;overflow:hidden;padding:0px;padding-top:2px;overflow:hidden;}
.tabs-header-noborder{border:0px;}
.tabs-header-plain{border:0px;background:transparent;}
.tabs-scroller-left{position:absolute;left:0px;top:-1px;width:18px;height:28px!important;height:30px;border:1px solid #D3D3D3;font-size:1px;display:none;cursor:pointer;background:#efefef url('images/tabs_leftarrow.png') no-repeat 1px 5px;}
.tabs-scroller-right{position:absolute;right:0;top:-1px;width:18px;height:28px!important;height:30px;border:1px solid #D3D3D3;font-size:1px;display:none;cursor:pointer;background:#efefef url('images/tabs_rightarrow.png') no-repeat 2px 5px;}
.tabs-tool{position:absolute;top:-1px;border:1px solid #D3D3D3;padding:1px;background:#efefef;overflow:hidden;}
.tabs-header-plain .tabs-scroller-left{top:2px;height:25px!important;height:27px;}
.tabs-header-plain .tabs-scroller-right{top:2px;height:25px!important;height:27px;}
.tabs-header-plain .tabs-tool{top:2px;padding-top:0;}
.tabs-scroller-over{background-color:#fafafa;}
.tabs-wrap{position:relative;left:0px;overflow:hidden;width:100%;margin:0px;padding:0px;}
.tabs-scrolling{margin-left:18px;margin-right:18px;}
.tabs{list-style-type:none;height:26px;margin:0px;padding:0px;padding-left:4px;font-size:12px;width:5000px;border-bottom:1px solid #D3D3D3;}
.tabs li{float:left;display:inline-block;margin1:0px 1px;margin-right:4px;margin-bottom:-1px;padding:0;position:relative;border:1px solid #D3D3D3;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px;-webkit-border-top-left-radius:5px;-webkit-border-top-right-radius:5px;}
.tabs li a.tabs-inner{display:inline-block;text-decoration:none;color:#3F3F3F;background:url('images/tabs_enabled.gif') repeat-x left top;margin:0px;padding:0px 10px;height:25px;line-height:25px;text-align:center;white-space:nowrap;-moz-border-radius-topleft:5px;-moz-border-radius-topright:5px;-webkit-border-top-left-radius:5px;-webkit-border-top-right-radius:5px;}
.tabs li a.tabs-inner:hover{background:#fff;}
.tabs li.tabs-selected{border:1px solid #D3D3D3;border-bottom:1px solid #fff;border-top1:2px solid #D3D3D3;}
.tabs li.tabs-selected a{color:#3F3F3F;font-weight:bold;background:#fff;background:#fff;outline: none;}
.tabs li.tabs-selected a:hover{cursor:default;pointer:default;}
.tabs-with-icon{padding-left:18px;}
.tabs-icon{position:absolute;width:16px;height:16px;left:10px;top:5px;}
.tabs-closable{padding-right:8px;}
.tabs li a.tabs-close{position:absolute;font-size:1px;display:block;padding:0px;width:11px;height:11px;top:7px;right:5px;opacity:0.6;filter:alpha(opacity=60);background:url('images/tabs_close.gif') no-repeat 2px 2px;}
.tabs li a:hover.tabs-close{opacity:1;filter:alpha(opacity=100);cursor:hand;cursor:pointer;background-color:#D3D3D3;}
.tabs-panels{margin:0px;padding:0px;border:1px solid #D3D3D3;border-top:0px;overflow:hidden;}
.tabs-panels-noborder{border:0px;}
.tree{font-size:12px;margin:0;padding:0;list-style-type:none;}
.tree li{white-space:nowrap;}
.tree li ul{list-style-type:none;margin:0;padding:0;}
.tree-node{height:18px;white-space:nowrap;cursor:pointer;}
.tree-indent{display:inline-block;width:16px;height:18px;vertical-align:middle;}
.tree-hit{cursor:pointer;}
.tree-expanded{display:inline-block;width:16px;height:18px;vertical-align:middle;background:url('images/tree_arrows.gif') no-repeat -18px 0px;}
.tree-expanded-hover{background:url('images/tree_arrows.gif') no-repeat -50px 0px;}
.tree-collapsed{display:inline-block;width:16px;height:18px;vertical-align:middle;background:url('images/tree_arrows.gif') no-repeat 0px 0px;}
.tree-collapsed-hover{background:url('images/tree_arrows.gif') no-repeat -32px 0px;}
.tree-folder{display:inline-block;background:url('images/tree_folder.gif') no-repeat;width:16px;height:18px;vertical-align:middle;}
.tree-folder-open{background:url('images/tree_folder_open.gif') no-repeat;}
.tree-file{display:inline-block;background:url('images/tree_file.gif') no-repeat;width:16px;height:18px;vertical-align:middle;}
.tree-loading{background:url('images/tree_loading.gif') no-repeat;}
.tree-title{display:inline-block;text-decoration:none;vertical-align:middle;padding:1px 2px 1px 2px;white-space:nowrap;}
.tree-node-hover{background:#fafafa;}
.tree-node-selected{background:#FBEC88;}
.tree-checkbox{display:inline-block;width:16px;height:18px;vertical-align:middle;}
.tree-checkbox0{background:url('images/tree_checkbox_0.gif') no-repeat;}
.tree-checkbox1{background:url('images/tree_checkbox_1.gif') no-repeat;}
.tree-checkbox2{background:url('images/tree_checkbox_2.gif') no-repeat;}
.tree-node-proxy{font-size:12px;padding:1px 2px 1px 18px;background:#fafafa;border:1px solid #ccc;z-index:9900000;}
.tree-dnd-yes{background:url('images/tree_dnd_yes.png') no-repeat 0 center;}
.tree-dnd-no{background:url('images/tree_dnd_no.png') no-repeat 0 center;}
.tree-node-top{border-top:1px dotted red;}
.tree-node-bottom{border-bottom:1px dotted red;}
.tree-node-append .tree-title{border:1px dotted red;}
.tree-editor{border:1px solid #ccc;font-size:12px;line-height:16px;width:80px;position:absolute;top:0;}
.validatebox-invalid{background:#FFFFEE url('images/validatebox_warning.png') no-repeat right 1px;}
.validatebox-tip{position:absolute;width:200px;height:auto;display:none;z-index:9900000;}
.validatebox-tip-content{display:inline-block;position:absolute;top:0px;left:10px;padding:3px 5px;border:1px solid #CC9933;background:#FFFFCC;z-index:9900001;font-size:12px;}
.validatebox-tip-pointer{background:url('images/validatebox_pointer.gif') no-repeat left top;display:inline-block;width:10px;height:19px;position:absolute;left:1px;top:0px;z-index:9900002;}.window{font-size:12px;position:absolute;overflow:hidden;background:#eee url('images/panel_title.gif') repeat-x;padding:5px;border:1px solid #D3D3D3;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius: 5px;}
.window-shadow{position:absolute;background:#ddd;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius: 5px;-moz-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);-webkit-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.2);filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);}
.window .window-header{background:transparent;padding:2px 0px 4px 0px;}
.window .window-body{background:#fff;border:1px solid #D3D3D3;border-top-width:0px;}
.window .window-body-noheader{border-top-width:1px;}
.window .window-header .panel-icon{left:1px;top:1px;}
.window .window-header .panel-with-icon{padding-left:18px;}
.window .window-header .panel-tool{top:0px;right:1px;}
.window-proxy{position:absolute;overflow:hidden;border:1px dashed #3F3F3F;}
.window-proxy-mask{position:absolute;background:#fafafa;filter:alpha(opacity=10);opacity:0.10;}
.window-mask{position:absolute;left:0;top:0;width:100%;height:100%;filter:alpha(opacity=40);opacity:0.40;background:#ccc;display1:none;font-size:1px;*zoom:1;overflow:hidden;}
|
kamiba/CSharpGoWeb
|
CSharpGoWeb/js/themes/gray/easyui.css
|
CSS
|
apache-2.0
| 26,621
|
import * as awsExpress from "aws-serverless-express";
import * as log4js from "log4js";
import * as App from "./app";
log4js.configure({
appenders: {out: {type: "stdout"}},
categories: {
default: {appenders: ["out"], level: "debug"},
},
});
const server = awsExpress.createServer(App.app);
exports.handler = (event, context) => {
const logger = log4js.getLogger();
logger.info("EVENT: " + JSON.stringify(event));
awsExpress.proxy(server, event, context);
};
|
fgauthier/xustosbe
|
src/index.ts
|
TypeScript
|
apache-2.0
| 481
|
/*
* Copyright (C) 2013 salesforce.com, 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.
*/
({
optionSeparator: ";",
init: function(cmp) {
var currentValue = cmp.get("v.value");
if ($A.util.isEmpty(cmp.get("v.options")) && !$A.util.isEmpty(cmp.get("v.body"))) {
cmp.set("v.renderBody", true);
}
if (!$A.util.isUndefined(currentValue)) {
// if a "value" attribute is specified on initial render, it should win over what the individual options report
this.updateOptionsFromValue(cmp);
} else {
// otherwise update the "value" attribute based on the options that claim to be selected
this.updateValueFromOptions(cmp);
}
},
updateMenuListWidth: function(cmp) {
var menuListElement = cmp.find("options").getElement();
if (menuListElement) {
var triggerRect = cmp.find("selectTrigger").getElement().getBoundingClientRect();
var width = typeof triggerRect.width !== 'undefined' ? triggerRect.width : triggerRect.right - triggerRect.left;
if (width > 0) {
menuListElement.style.width = width + "px";
var minWidth = 200;
// In case the width exceeds the max width we want to still limit to the width of the trigger,
// unless it's smaller than minWidth
menuListElement.style.maxWidth = Math.max(minWidth, width) + "px";
menuListElement.style.minWidth = minWidth + "px";
}
}
},
/**
* Iterates over the options in the select element and returns a semicolon-delimited string of the selected values
*/
getDomElementValue: function(el) {
var selectedOptions = [];
for (var i = 0; i < el.options.length; i++) {
if (el.options[i].selected) {
selectedOptions.push(el.options[i].value);
}
}
return selectedOptions.join(this.optionSeparator);
},
/**
* Returns a package with the array of options (as either an array of components or an array of JS objects)
* and the strategy to work with that array
*/
getOptionsWithStrategy: function(cmp) {
var strat = this.optionsStrategy,
opts = strat.getOptions(cmp);
if ($A.util.isEmpty(opts)) {
strat = this.bodyStrategy;
opts = strat.getOptions(cmp);
}
return {options: opts, strategy: strat};
},
menuOptionSelected: function(cmp) {
var menuItems = cmp.find("options").get("v.body");
var buildAListOfSelectedOptions = function(accumulator, menuItem) {
if (menuItem.get("v.selected")) {
accumulator.push({label: menuItem.get("v.label"), value: menuItem.get("v.value")});
}
return accumulator;
};
var selectedOptions = menuItems.reduce(buildAListOfSelectedOptions, []);
var newSelectedLabel = selectedOptions.map(function(value) { return value.label; }).join(this.optionSeparator);
var newValue = selectedOptions.map(function(value) { return value.value; }).join(this.optionSeparator);
if (cmp.get("v.selectedLabel") === newSelectedLabel) {
return;
}
cmp.set("v.selectedLabel", newSelectedLabel);
cmp._suspendChangeHandlers = true;
cmp.set("v.value", newValue);
cmp.get("e.change").fire();
cmp._suspendChangeHandlers = false;
},
createMenuItems: function(cmp) {
var options = cmp.get("v.options");
var menuItems = [];
var handleCreatedMenuItem = function(menuItem, status) {
if (status === "SUCCESS") {
menuItems.push(menuItem);
if (menuItems.length === options.length) {
cmp.find("options").set("v.body", menuItems);
}
}
};
var multiSelect = cmp.get("v.multiple");
var menuItemComponentName = multiSelect ? "ui:checkboxMenuItem" : "ui:radioMenuItem";
$A.getDefinition(menuItemComponentName, function() {
for (var i = 0; i < options.length; i++) {
$A.createComponent(menuItemComponentName, {
"class": options[i].class,
"label": options[i].label,
"value": options[i].value,
"selected": $A.util.getBooleanValue(options[i].selected),
"hideMenuAfterSelected": !multiSelect
}, handleCreatedMenuItem);
}
});
},
updateMenuLabel: function(cmp) {
var options = cmp.get("v.options");
var newLabel = options.filter(function(option) { return option.selected; })
.map(function(option) { return option.label; })
.join(this.optionSeparator);
// If nothing was selected, just default the label to the first item
if (newLabel === "" && options[0]) {
newLabel = options[0].label;
}
cmp.set("v.selectedLabel", newLabel);
},
/**
* Updates all options' "selected" attributes in the select element, based on the semicolon-delimited newValue string
*/
updateOptionsFromValue: function(cmp, createNewOptions) {
if (cmp._suspendChangeHandlers) {
return;
}
var value = cmp.get("v.value"),
optionsPack = this.getOptionsWithStrategy(cmp),
selectedOptions = optionsPack.strategy.getSelected(optionsPack.options);
if (optionsPack.options.length === 0) {
cmp._initOptionsFromValue = true;
return;
}
if (this.isAlreadySelected(cmp, selectedOptions)) {
return;
}
var valueOrEmpty = cmp.get("v.value") || "";
var newValues;
var isMultiple = $A.util.getBooleanValue(cmp.get("v.multiple"));
if (isMultiple) {
// This breaks if the option itself contains the separator
newValues = valueOrEmpty.split(this.optionSeparator);
} else {
newValues = [valueOrEmpty];
}
if (!optionsPack.strategy.updateOptions(cmp, optionsPack.options, newValues, createNewOptions) && !(isMultiple && value === "")) {
this.updateValueFromOptions(cmp, optionsPack);
} else {
cmp._suspendChangeHandlers = true;
optionsPack.strategy.persistOptions(cmp, optionsPack.options);
cmp._suspendChangeHandlers = false;
}
},
isAlreadySelected: function(cmp, selectedOptions) {
var value = cmp.get("v.value");
var isMultiple = $A.util.getBooleanValue(cmp.get("v.multiple"));
return selectedOptions.length > 0 &&
(isMultiple && value === selectedOptions.join(this.optionSeparator)) ||
(!isMultiple && value === selectedOptions[0]);
},
/**
* Updates this component's "value" attribute based on the state of its options' "selected" attributes
*/
updateValueFromOptions: function(cmp, optionsPack) {
if (cmp._suspendChangeHandlers) {
return;
}
optionsPack = optionsPack || this.getOptionsWithStrategy(cmp);
var value = cmp.get("v.value"),
isMultiple = $A.util.getBooleanValue(cmp.get("v.multiple")),
selectedOptions = optionsPack.strategy.getSelected(optionsPack.options);
var optionValue = selectedOptions.join(this.optionSeparator);
if (selectedOptions.length === 0 || value !== optionValue) {
if (!isMultiple && selectedOptions.length === 0) {
optionValue = optionsPack.strategy.getValue(optionsPack.options, 0);
optionsPack.strategy.setOptionSelected(optionsPack.options, 0, true);
cmp._suspendChangeHandlers = true;
optionsPack.strategy.persistOptions(cmp, optionsPack.options);
cmp._suspendChangeHandlers = false;
}
cmp.set("v.value", optionValue, true);
}
},
/**
* Strategies for working with either an array of option objects or of body components, passed through to the
* select component either through the "v.options" attribute or through the body in markup.
* Abstracts the implementation away so that the logic specific to the two data structures can be separated from
* the main component logic
*
* Main functions available:
* updateOptions(options, newValues) - updates the list of options based on newValues, which is either an array or a string
* Used for ensuring consistency between "v.value" and the list of options
* getValues(options) - returns a ';'-concatenated String of selected values and whether a selected value was found
* Used for seeing which options are selected from the perspective of the options
* getText(options, index) - returns the internal text of options[index]
* setOptionSelected(options, index, selected) - equivalent to options[index].selected = selected
* persistOptions(cmp, options) - persists the array of options into the appropriate component attribute
*/
/**
* Strategy object for an array of option objects
*/
optionsStrategy: {
getOptions: function(cmp) {
return cmp.get("v.options");
},
// If an option is in newValues, we want to select it
updateOptions: function(cmp, options, newValues, createNewOptions) {
var found = false;
var i;
for (i = 0; i < options.length; i++) {
var option = options[i];
var val = option.value;
if ($A.util.isUndefinedOrNull(val)) {
continue;
}
var selectOption = (newValues.length > 1 && newValues.indexOf(val) > -1) || newValues[0] === val.toString();
found = found || selectOption;
option.selected = selectOption;
}
if (!found && createNewOptions) {
for (i=0; i<newValues.length; i++) {
options.unshift({
label: newValues[i],
value: newValues[i],
selected: true
});
}
}
return found;
},
// If an option is selected, we want to aggregate it into our list
getSelected: function(options) {
var values = [];
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.selected) {
values.push(option.value || "");
}
}
return values;
},
getValue: function(options, index) {
if (!$A.util.isUndefinedOrNull(options[index])) {
return options[index].value;
}
return undefined;
},
setOptionSelected: function(options, index, selected) {
if (!$A.util.isUndefinedOrNull(options[index])) {
options[index].selected = selected;
// } else {
// TODO: somehow expose that the option couldn't be set.
}
},
persistOptions: function(cmp, options) {
cmp.set("v.options", options);
}
},
/**]
* Strategy object for an array of components (used for maintaining support for using inputSelectOption components in the body)
*/
bodyStrategy: {
SUPPORTEDCONTAINERS: ["ui:inputSelectOptionGroup", "aura:iteration", "aura:if", "aura:renderIf"],
getOptions: function(cmp) {
var options = [];
this.performOperationOnCmps(cmp.get("v.body"), this.addOptionToList, options);
return options;
},
// Updates options based on their existence in newValues
updateOptions: function(cmp, options, newValues) {
var result = {found: false};
// Perform single option update function on all of our options
this.performOperationOnCmps(options, this.updateOption, result, newValues);
return result.found;
},
getSelected: function(bodyCmps) {
var values = [];
this.performOperationOnCmps(bodyCmps, this.pushIfSelected, values);
return values;
},
getValue: function(options, index) {
if (options[index]) {
return options[index].get("v.text");
}
return undefined;
},
setOptionSelected: function(options, index, selected) {
if (!$A.util.isUndefinedOrNull(options[index])) {
options[index].set("v.value", selected);
// } else {
// TODO: somehow expose that the option couldn't be set.
}
},
persistOptions: function() {
// v.body should remain the same in case iteration options change. See W-2926861
//cmp.set("v.body", options);
},
// Performs op on every ui:inputSelectOption in opts, where op = function(optionCmp, resultsObject, optionalArguments)
performOperationOnCmps: function(opts, op, result, newValues) {
for (var i = 0; i < opts.length; i++) {
var cmp = opts[i];
if (cmp.isInstanceOf("ui:inputSelectOption")) {
op(cmp, result, newValues);
} else if (this.canSupportOptions(cmp)) {
var groupBody = cmp.get("v.body");
if (!$A.util.isEmpty(groupBody)) {
this.performOperationOnCmps(groupBody, op, result, newValues);
}
} else {
var cmpType = cmp.getType();
$A.warning("<" + cmpType + "> is currently not supported inside <ui:inputSelect> since it does not properly " +
"attach the options to the component. This will lead to undefined behavior. Please " +
"use 'v.options' to insert your option objects instead.");
}
}
},
// Helper function for updateOptions
// Update optionCmp if it exists in newValues; passes result back in result object
updateOption: function(optionCmp, result, newValues) {
var text = optionCmp.get("v.text");
var selectOption = (newValues.length > 1 && newValues.indexOf(text) > -1) || newValues[0] === text;
result.found = result.found || selectOption;
optionCmp.set("v.value", selectOption);
},
// Helper function for getValues
// Push optionCmp's value into valueList if selected
pushIfSelected: function(optionCmp, valueList) {
if ($A.util.getBooleanValue(optionCmp.get("v.value")) === true) {
var text = optionCmp.get("v.text");
if (!$A.util.isUndefined(text)) {
valueList.push(text);
}
}
},
addOptionToList: function(cmp, list) {
list.push(cmp);
},
canSupportOptions: function(cmp) {
for (var i = 0; i < this.SUPPORTEDCONTAINERS.length; i++) {
if (cmp.isInstanceOf(this.SUPPORTEDCONTAINERS[i])) {
return true;
}
}
return false;
}
},
/**
* Render the option elements from the provided option objects
*
* Expected option structure:
* {
* value : // value for the option
* label (optional) : // display text for the option. Defaults to value
* class (optional) : // CSS class for the option
* selected (optional) : // whether option should be selected
* disabled (optional) : // whether option should be disabled
* }
*/
renderOptions: function(cmp, options) {
var fragment = document.createDocumentFragment();
for (var i = 0; i < options.length; ++i) {
var optionElement = document.createElement('option');
fragment.appendChild(this.updateOptionElement(cmp, options[i], optionElement));
}
return fragment;
},
updateOptionElement: function(cmp, option, optionElement) {
var internalText = this.getInternalText(option);
// Check/update label
try {
if (optionElement.label !== option.label || optionElement.label !== internalText) {
optionElement.label = option.label || internalText;
}
} catch (e) {
//IE9,10,11 is complaining because we're reading "label" attribute before writing to it
optionElement.label = option.label || internalText;
}
// Check/update value
if (optionElement.value !== option.value) {
optionElement.value = option.value;
if ($A.util.isUndefined(option.value)) {
$A.warning("Option with label '" + option.label + "' in select component " + cmp.getGlobalId() + " has an undefined value.");
}
}
// Check/update class
var optionClass = option["class"];
if (!$A.util.isEmpty(optionClass) && optionElement.getAttribute("class") !== optionClass) {
optionElement.setAttribute("class", optionClass);
}
// Check/update selected
if (optionElement.selected !== option.selected) {
optionElement.selected = option.selected ? "selected" : undefined;
}
// Check/update disabled
if (optionElement.disabled !== option.disabled) {
optionElement.disabled = option.disabled ? "disabled" : undefined;
}
// Check/update internalText
if (optionElement.textContent !== internalText) {
$A.util.setText(optionElement, internalText);
}
return optionElement;
},
getInternalText: function(option) {
return ($A.util.isEmpty(option.label) ? option.value : option.label) || '';
}
})// eslint-disable-line semi
|
madmax983/aura
|
aura-components/src/main/components/ui/inputSelect/inputSelectHelper.js
|
JavaScript
|
apache-2.0
| 18,634
|
body.f-body {
height: auto;
/*background-image: url(../images/square.gif);*/
padding: 10px;
}
body.f-body.f-theme-access {
background-image: none;
}
.marginr {
margin-right: 5px;
}
.formitem {
margin-bottom: 5px;
}
.clear {
clear: both;
}
ol.result {
list-style-type: decimal;
margin: 10px 0 10px 25px;
}
table.result {
margin: 10px 0;
width: 500px;
}
table.result th {
font-weight: bold;
font-size: 13px;
}
table.result td, table.result th {
border-bottom: solid 1px #efefef;
padding: 5px;
text-align: left;
}
|
u0hz/FineUI
|
src/FineUI.Examples/res/css/main.css
|
CSS
|
apache-2.0
| 680
|
/*
* Licensed to Crate under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership. Crate 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.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial
* agreement.
*/
package io.crate.execution.engine.indexing;
import io.crate.data.Input;
import io.crate.data.Row;
import io.crate.execution.dsl.projection.SourceIndexWriterReturnSummaryProjection;
import io.crate.execution.engine.collect.CollectExpression;
import io.crate.expression.InputFactory;
import io.crate.metadata.TransactionContext;
import org.elasticsearch.cluster.node.DiscoveryNode;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
public class UpsertResultContext {
public static UpsertResultContext forRowCount() {
return new UpsertResultContext(
() -> null, () -> null, () -> null, Collections.emptyList(), UpsertResultCollectors.newRowCountCollector()) {
@Override
BiConsumer<ShardedRequests, String> getItemFailureRecorder() {
return (s, f) -> { };
}
@Override
Predicate<ShardedRequests> getHasSourceUriFailureChecker() {
return (ignored) -> false;
}
};
}
public static UpsertResultContext forResultRows() {
return new UpsertResultContext(
() -> null, () -> null, () -> null, Collections.emptyList(), UpsertResultCollectors.newResultRowCollector()) {
@Override
BiConsumer<ShardedRequests, String> getItemFailureRecorder() {
return (s, f) -> { };
}
@Override
Predicate<ShardedRequests> getHasSourceUriFailureChecker() {
return (ignored) -> false;
}
};
}
public static UpsertResultContext forReturnSummary(TransactionContext txnCtx,
SourceIndexWriterReturnSummaryProjection projection,
DiscoveryNode discoveryNode,
InputFactory inputFactory) {
InputFactory.Context<CollectExpression<Row, ?>> ctxSourceInfo = inputFactory.ctxForInputColumns(txnCtx);
//noinspection unchecked
Input<String> sourceUriInput = (Input<String>) ctxSourceInfo.add(projection.sourceUri());
//noinspection unchecked
Input<String> sourceUriFailureInput = (Input<String>) ctxSourceInfo.add(projection.sourceUriFailure());
//noinspection unchecked
Input<Long> lineNumberInput = (Input<Long>) ctxSourceInfo.add(projection.lineNumber());
return new UpsertResultContext(
sourceUriInput,
sourceUriFailureInput,
lineNumberInput,
ctxSourceInfo.expressions(),
UpsertResultCollectors.newSummaryCollector(discoveryNode));
}
private final Input<String> sourceUriInput;
private final Input<String> sourceUriFailureInput;
private final Input<Long> lineNumberInput;
private final List<? extends CollectExpression<Row, ?>> sourceInfoExpressions;
private final UpsertResultCollector resultCollector;
private UpsertResultContext(Input<String> sourceUriInput,
Input<String> sourceUriFailureInput,
Input<Long> lineNumberInput,
List<? extends CollectExpression<Row, ?>> sourceInfoExpressions,
UpsertResultCollector resultCollector) {
this.sourceUriInput = sourceUriInput;
this.sourceUriFailureInput = sourceUriFailureInput;
this.lineNumberInput = lineNumberInput;
this.sourceInfoExpressions = sourceInfoExpressions;
this.resultCollector = resultCollector;
}
Input<String> getSourceUriInput() {
return sourceUriInput;
}
Input<Long> getLineNumberInput() {
return lineNumberInput;
}
List<? extends CollectExpression<Row, ?>> getSourceInfoExpressions() {
return sourceInfoExpressions;
}
UpsertResultCollector getResultCollector() {
return resultCollector;
}
BiConsumer<ShardedRequests, String> getItemFailureRecorder() {
return (s, f) -> s.addFailedItem(sourceUriInput.value(), f, lineNumberInput.value());
}
Predicate<ShardedRequests> getHasSourceUriFailureChecker() {
return s -> {
String sourceUriFailure = sourceUriFailureInput.value();
if (sourceUriFailure != null) {
s.addFailedUri(sourceUriInput.value(), sourceUriFailureInput.value());
return true;
}
return false;
};
}
}
|
EvilMcJerkface/crate
|
server/src/main/java/io/crate/execution/engine/indexing/UpsertResultContext.java
|
Java
|
apache-2.0
| 5,582
|
package org.docksidestage.hanger.simpleflute.dto.bs;
import java.io.Serializable;
import java.util.*;
import net.vvakame.util.jsonpullparser.annotation.*;
import org.docksidestage.hanger.simpleflute.AppCDef;
import org.docksidestage.hanger.simpleflute.dto.*;
/**
* The simple DTO of (地域)REGION as TABLE. <br>
* <pre>
* [primary-key]
* REGION_ID
*
* [column]
* REGION_ID, REGION_NAME
*
* [sequence]
*
*
* [identity]
*
*
* [version-no]
*
*
* [foreign-table]
*
*
* [referrer-table]
* MEMBER_ADDRESS
*
* [foreign-property]
*
*
* [referrer-property]
* memberAddressList
* </pre>
* @author DBFlute(AutoGenerator)
*/
@JsonModel(decamelize = false)
public abstract class BsRegionDto implements Serializable {
// ===================================================================================
// Definition
// ==========
/** The serial version UID for object serialization. (Default) */
private static final long serialVersionUID = 1L;
// ===================================================================================
// Attribute
// =========
// -----------------------------------------------------
// Column
// ------
/** (地域ID)REGION_ID: {PK, NotNull, INTEGER(10), classification=Region} */
@JsonKey
protected Integer _regionId;
/** (地域名称)REGION_NAME: {NotNull, VARCHAR(50)} */
@JsonKey
protected String _regionName;
// -----------------------------------------------------
// Internal
// --------
/** The modified properties for this DTO. */
protected final Set<String> __modifiedProperties = new LinkedHashSet<String>();
// ===================================================================================
// Constructor
// ===========
public BsRegionDto() {
}
// ===================================================================================
// Modified Properties
// ===================
public Set<String> mymodifiedProperties() {
return __modifiedProperties;
}
public void clearModifiedInfo() {
__modifiedProperties.clear();
}
public boolean hasModification() {
return !__modifiedProperties.isEmpty();
}
// ===================================================================================
// Classification Property
// =======================
/**
* Set the value of regionId as the classification of Region. <br>
* mainly region of member address
* @param cdef The instance of classification definition (as ENUM type). (NullAllowed)
*/
public void setRegionIdAsRegion(AppCDef.Region cdef) {
setRegionId(cdef != null ? Integer.valueOf(cdef.code()) : null);
}
/**
* Get the value of regionId as the classification of Region. <br>
* mainly region of member address
* <p>It's treated as case insensitive and if the code value is null, it returns null.</p>
* @return The instance of classification definition (as ENUM type). (NullAllowed)
*/
public AppCDef.Region getRegionIdAsRegion() {
return AppCDef.Region.codeOf(getRegionId());
}
// ===================================================================================
// Classification Setting
// ======================
/**
* Set the value of regionId as America. <br>
* AMERICA
*/
public void setRegionId_America() {
setRegionIdAsRegion(AppCDef.Region.America);
}
/**
* Set the value of regionId as Canada. <br>
* CANADA
*/
public void setRegionId_Canada() {
setRegionIdAsRegion(AppCDef.Region.Canada);
}
/**
* Set the value of regionId as China. <br>
* CHINA
*/
public void setRegionId_China() {
setRegionIdAsRegion(AppCDef.Region.China);
}
/**
* Set the value of regionId as Chiba. <br>
* CHIBA
*/
public void setRegionId_Chiba() {
setRegionIdAsRegion(AppCDef.Region.Chiba);
}
// ===================================================================================
// Classification Determination
// ============================
/**
* Is the value of regionId 'America'? <br>
* AMERICA
* <p>It's treated as case insensitive and if the code value is null, it returns false.</p>
* @return The determination, true or false.
*/
public boolean isRegionIdAmerica() {
AppCDef.Region cdef = getRegionIdAsRegion();
return cdef != null ? cdef.equals(AppCDef.Region.America) : false;
}
/**
* Is the value of regionId 'Canada'? <br>
* CANADA
* <p>It's treated as case insensitive and if the code value is null, it returns false.</p>
* @return The determination, true or false.
*/
public boolean isRegionIdCanada() {
AppCDef.Region cdef = getRegionIdAsRegion();
return cdef != null ? cdef.equals(AppCDef.Region.Canada) : false;
}
/**
* Is the value of regionId 'China'? <br>
* CHINA
* <p>It's treated as case insensitive and if the code value is null, it returns false.</p>
* @return The determination, true or false.
*/
public boolean isRegionIdChina() {
AppCDef.Region cdef = getRegionIdAsRegion();
return cdef != null ? cdef.equals(AppCDef.Region.China) : false;
}
/**
* Is the value of regionId 'Chiba'? <br>
* CHIBA
* <p>It's treated as case insensitive and if the code value is null, it returns false.</p>
* @return The determination, true or false.
*/
public boolean isRegionIdChiba() {
AppCDef.Region cdef = getRegionIdAsRegion();
return cdef != null ? cdef.equals(AppCDef.Region.Chiba) : false;
}
// ===================================================================================
// Foreign Table
// =============
// ===================================================================================
// Referrer Table
// ==============
protected List<MemberAddressDto> _memberAddressList;
public List<MemberAddressDto> getMemberAddressList() {
if (_memberAddressList == null) { _memberAddressList = new ArrayList<MemberAddressDto>(); }
return _memberAddressList;
}
public void setMemberAddressList(List<MemberAddressDto> memberAddressList) {
this._memberAddressList = memberAddressList;
}
// ===================================================================================
// Basic Override
// ==============
public boolean equals(Object other) {
if (other == null || !(other instanceof BsRegionDto)) { return false; }
final BsRegionDto otherEntity = (BsRegionDto)other;
if (!helpComparingValue(getRegionId(), otherEntity.getRegionId())) { return false; }
return true;
}
protected boolean helpComparingValue(Object value1, Object value2) {
if (value1 == null && value2 == null) { return true; }
return value1 != null && value2 != null && value1.equals(value2);
}
public int hashCode() {
int result = 17;
result = xCH(result, "REGION");
result = xCH(result, getRegionId());
return result;
}
protected int xCH(int result, Object value) { // calculateHashcode()
if (value == null) {
return result;
}
return (31 * result) + (value instanceof byte[] ? ((byte[]) value).length : value.hashCode());
}
public int instanceHash() {
return super.hashCode();
}
public String toString() {
String c = ", ";
StringBuilder sb = new StringBuilder();
sb.append(c).append(getRegionId());
sb.append(c).append(getRegionName());
if (sb.length() > 0) { sb.delete(0, c.length()); }
sb.insert(0, "{").append("}");
return sb.toString();
}
// ===================================================================================
// Accessor
// ========
/**
* [get] (地域ID)REGION_ID: {PK, NotNull, INTEGER(10), classification=Region} <br>
* @return The value of the column 'REGION_ID'. (NullAllowed)
*/
public Integer getRegionId() {
return _regionId;
}
/**
* [set] (地域ID)REGION_ID: {PK, NotNull, INTEGER(10), classification=Region} <br>
* @param regionId The value of the column 'REGION_ID'. (NullAllowed)
*/
public void setRegionId(Integer regionId) {
__modifiedProperties.add("regionId");
this._regionId = regionId;
}
/**
* [get] (地域名称)REGION_NAME: {NotNull, VARCHAR(50)} <br>
* @return The value of the column 'REGION_NAME'. (NullAllowed)
*/
public String getRegionName() {
return _regionName;
}
/**
* [set] (地域名称)REGION_NAME: {NotNull, VARCHAR(50)} <br>
* @param regionName The value of the column 'REGION_NAME'. (NullAllowed)
*/
public void setRegionName(String regionName) {
__modifiedProperties.add("regionName");
this._regionName = regionName;
}
}
|
dbflute-test/dbflute-test-active-hanger
|
src/main/java/org/docksidestage/hanger/simpleflute/dto/bs/BsRegionDto.java
|
Java
|
apache-2.0
| 10,838
|
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* 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.
*
*
* Original Author: Arnaud Roques
*/
package net.sourceforge.plantuml.ugraphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble;
public class MinMaxMutable {
private double maxX;
private double maxY;
private double minX;
private double minY;
public static MinMaxMutable getEmpty(boolean initToZero) {
if (initToZero) {
return new MinMaxMutable(0, 0, 0, 0);
}
return new MinMaxMutable(Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE);
}
public boolean isInfinity() {
return minX == Double.MAX_VALUE;
}
@Override
public String toString() {
return "X=" + minX + " " + maxX + " Y=" + minY + " " + maxY;
}
private MinMaxMutable(double minX, double minY, double maxX, double maxY) {
if (Double.isNaN(minX)) {
throw new IllegalArgumentException();
}
if (Double.isNaN(maxX)) {
throw new IllegalArgumentException();
}
if (Double.isNaN(minY)) {
throw new IllegalArgumentException();
}
if (Double.isNaN(maxY)) {
throw new IllegalArgumentException();
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
}
public void addPoint(double x, double y) {
if (Double.isNaN(x)) {
throw new IllegalArgumentException();
}
if (Double.isNaN(y)) {
throw new IllegalArgumentException();
}
this.maxX = Math.max(x, maxX);
this.maxY = Math.max(y, maxY);
this.minX = Math.min(x, minX);
this.minY = Math.min(y, minY);
}
public static MinMaxMutable fromMax(double maxX, double maxY) {
if (Double.isNaN(maxX)) {
throw new IllegalArgumentException();
}
if (Double.isNaN(maxY)) {
throw new IllegalArgumentException();
}
final MinMaxMutable result = MinMaxMutable.getEmpty(true);
result.addPoint(maxX, maxY);
return result;
}
public final double getMaxX() {
return maxX;
}
public final double getMaxY() {
return maxY;
}
public final double getMinX() {
return minX;
}
public final double getMinY() {
return minY;
}
public Dimension2D getDimension() {
return new Dimension2DDouble(maxX - minX, maxY - minY);
}
}
|
talsma-ict/umldoclet
|
src/plantuml-asl/src/net/sourceforge/plantuml/ugraphic/MinMaxMutable.java
|
Java
|
apache-2.0
| 3,153
|
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0 */
package net.sf.mmm.content.parser.impl.poi;
import java.io.InputStream;
import net.sf.mmm.content.parser.api.ContentParserOptions;
import net.sf.mmm.content.parser.base.AbstractContentParser;
import net.sf.mmm.util.context.api.MutableGenericContext;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
* This is the abstract base implementation of the
* {@link net.sf.mmm.content.parser.api.ContentParser} interface for parsing
* binary Microsoft office documents using apache POI.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
*/
public abstract class AbstractContentParserPoi extends AbstractContentParser {
/** name of the entry for a word document in the POI filesystem */
public static final String POIFS_WORD_DOC = "WordDocument";
/** name of the entry for a powerpoint document in the POI filesystem */
public static final String POIFS_POWERPOINT_DOC = "PowerPoint Document";
/** name of the entry for a excel document in the POI filesystem */
public static final String POIFS_EXCEL_DOC = "Workbook";
/**
* The constructor.
*/
public AbstractContentParserPoi() {
super();
}
/**
* {@inheritDoc}
*/
@Override
public void parse(InputStream inputStream, long filesize, ContentParserOptions options,
MutableGenericContext context) throws Exception {
POIFSFileSystem poiFs = new POIFSFileSystem(inputStream);
SummaryInformation summaryInfo = (SummaryInformation) PropertySetFactory.create(poiFs
.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME));
String title = summaryInfo.getTitle();
if (title != null) {
context.setVariable(VARIABLE_NAME_TITLE, title);
}
String author = summaryInfo.getAuthor();
if (author != null) {
context.setVariable(VARIABLE_NAME_CREATOR, author);
}
String keywords = summaryInfo.getKeywords();
if (keywords != null) {
context.setVariable(VARIABLE_NAME_KEYWORDS, keywords);
}
context.setVariable(VARIABLE_NAME_TEXT, extractText(poiFs, filesize, options));
}
/**
* This method extracts the text from the office document given by
* <code>poiFs</code>.
*
* @param poiFs is the POI filesystem of the office document.
* @param filesize is the size (content-length) of the content to parse in
* bytes or <code>0</code> if NOT available (unknown). If available,
* the parser may use this value for optimized allocations.
* @param options are the {@link ContentParserOptions}.
* @return the plain text extracted from the content.
* @throws Exception if something goes wrong.
*/
protected abstract String extractText(POIFSFileSystem poiFs, long filesize,
ContentParserOptions options) throws Exception;
}
|
m-m-m/search
|
content-parser/impl-poi/src/main/java/net/sf/mmm/content/parser/impl/poi/AbstractContentParserPoi.java
|
Java
|
apache-2.0
| 2,988
|
.kchart{position:relative}
.danmaku_view{position:absolute;top:96px;left:0;width:100%;height:256px;overflow:hidden;text-align:left;z-index:100}
.danmaku_item{display:block;*zoom:1;position:absolute;left:100%;margin:4px 0;padding:0 3px;white-space:nowrap;font-family:"simsong",serif;font-size:14px;letter-spacing:1px;background-color:#ffeeda;background-color:rgba(255,171,71,0.2);*background-color:#ffeeda;color:#3d3d3d;border-radius:2px}
.danmaku_item.my{background-color:#daeeff;background-color:rgba(71,171,255,0.2);*background-color:#daeeff}
.danmaku_item.row_1{top:0}
.danmaku_item.row_2{top:24px}
.danmaku_item.row_3{top:48px}
.danmaku_item.row_4{top:72px}
.danmaku_item.row_5{top:120px}
.danmaku_item.row_6{top:144px}
.danmaku_item.row_7{top:168px}
.danmaku_item.row_8{top:192px}
#altcontenttsBox{height:410px}
.danmaku_ctrl{position:relative;height:25px;padding-left:40px;margin-top:-3px;margin-bottom:3px;line-height:25px;color:#8c8c8c}
.danmaku_ctrl:after{content:" ";display:block;height:0;clear:both}
.danmaku_ctrl *{box-sizing:content-box}
.danmaku_ctrl div,.danmaku_ctrl a,.danmaku_ctrl input{display:block;position:absolute}
.danmaku_ctrl input{height:19px;width:245px;left:110px;padding:2px;border:1px solid #ccc;transition:.5s}
.danmaku_ctrl input.flash{border:1px solid #db1011;box-shadow:0 0 5px #db1011;transition:.25s;outline-color:#db1011}
.danmaku_ctrl .chat_btn{height:23px;width:34px;left:360px;line-height:25px;color:#fff;background-color:#66a0dc;border:1px solid #1a75d4;cursor:pointer;text-decoration:none;text-align:center}
.danmaku_power{position:relative;left:66px;height:19px;margin:3px;width:34px;background-color:#ccc;border-radius:20px;cursor:pointer;transition:.5s}
.danmaku_power.on{background-color:#66a0dc}
.danmaku_power.on .danmaku_power_btn{left:16px}
.danmaku_power_btn{position:absolute;top:1px;left:1px;height:17px;width:17px;background-color:#fff;border-radius:20px;transition:.5s}
.kchart_big .danmaku_ctrl{padding-left:21%}
.kchart_big .money_chart{height:575px}
.chart_hidden{position:absolute;width:512px;height:0;overflow:hidden;visibility:hidden;left:-10000px}
.dm_tip{position:absolute;top:-100px;left:50%;margin-left:-75px;z-index:9999;width:150px;height:32px;background-color:#ff8090;background-color:rgba(255,0,32,0.5);border-radius:5px;box-shadow:0 0 5px rgba(0,0,0,0.5);text-align:center;line-height:32px;color:#fff;transform:translateY(10px);transition:.5s;opacity:0;visibility:hidden}
.dm_tip.show{transform:translateY(0px);opacity:1;visibility:visible}
.guess_btn{position:absolute;left:410px;color:#f25728;border:1px solid #fdd6d1;padding:0 .5em;border-radius:3px;text-decoration:none;cursor:pointer;transition:.5s}
.guess_btn:hover{background-color:#fef0ef;text-decoration:none}
|
StockFucker/BankRoll
|
diverseData/浦发银行 17.80 (-2.57%) (600000)_个股行情_网易财经_files/danmaku.959699.css
|
CSS
|
apache-2.0
| 2,741
|
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.elasticsearch.search.aggregations.bucket.histogram;
import org.apache.lucene.document.SortedNumericDocValuesField;
import org.apache.lucene.document.SortedSetDocValuesField;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.CheckedBiConsumer;
import org.elasticsearch.index.mapper.DateFieldMapper;
import org.elasticsearch.index.mapper.KeywordFieldMapper;
import org.elasticsearch.index.mapper.NumberFieldMapper;
import org.elasticsearch.index.mapper.NumberFieldMapper.NumberType;
import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.search.aggregations.AggregatorTestCase;
import org.elasticsearch.search.aggregations.InternalAggregation;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
public abstract class DateHistogramAggregatorTestCase extends AggregatorTestCase {
/**
* A date that is always "aggregable" because it has doc values but may or
* may not have a search index. If it doesn't then we can't use our fancy
* date rounding mechanism that needs to know the minimum and maximum dates
* it is going to round because it ready *that* out of the search index.
*/
protected static final String AGGREGABLE_DATE = "aggregable_date";
protected final <R extends InternalAggregation> void asSubAggTestCase(AggregationBuilder builder, Consumer<R> verify)
throws IOException {
CheckedBiConsumer<RandomIndexWriter, DateFieldMapper.DateFieldType, IOException> buildIndex = (iw, dft) -> {
iw.addDocument(List.of(
new SortedNumericDocValuesField(AGGREGABLE_DATE, dft.parse("2020-02-01T00:00:00Z")),
new SortedSetDocValuesField("k1", new BytesRef("a")),
new SortedSetDocValuesField("k2", new BytesRef("a")),
new SortedNumericDocValuesField("n", 1)
));
iw.addDocument(List.of(
new SortedNumericDocValuesField(AGGREGABLE_DATE, dft.parse("2020-03-01T00:00:00Z")),
new SortedSetDocValuesField("k1", new BytesRef("a")),
new SortedSetDocValuesField("k2", new BytesRef("a")),
new SortedNumericDocValuesField("n", 2)
));
iw.addDocument(List.of(
new SortedNumericDocValuesField(AGGREGABLE_DATE, dft.parse("2021-02-01T00:00:00Z")),
new SortedSetDocValuesField("k1", new BytesRef("a")),
new SortedSetDocValuesField("k2", new BytesRef("a")),
new SortedNumericDocValuesField("n", 3)
));
iw.addDocument(List.of(
new SortedNumericDocValuesField(AGGREGABLE_DATE, dft.parse("2021-03-01T00:00:00Z")),
new SortedSetDocValuesField("k1", new BytesRef("a")),
new SortedSetDocValuesField("k2", new BytesRef("b")),
new SortedNumericDocValuesField("n", 4)
));
iw.addDocument(List.of(
new SortedNumericDocValuesField(AGGREGABLE_DATE, dft.parse("2020-02-01T00:00:00Z")),
new SortedSetDocValuesField("k1", new BytesRef("b")),
new SortedSetDocValuesField("k2", new BytesRef("b")),
new SortedNumericDocValuesField("n", 5)
));
};
asSubAggTestCase(builder, buildIndex, verify);
}
protected final <R extends InternalAggregation> void asSubAggTestCase(
AggregationBuilder builder,
CheckedBiConsumer<RandomIndexWriter, DateFieldMapper.DateFieldType, IOException> buildIndex,
Consumer<R> verify
) throws IOException {
KeywordFieldMapper.KeywordFieldType k1ft = new KeywordFieldMapper.KeywordFieldType("k1");
KeywordFieldMapper.KeywordFieldType k2ft = new KeywordFieldMapper.KeywordFieldType("k2");
NumberFieldMapper.NumberFieldType nft = new NumberFieldMapper.NumberFieldType("n", NumberType.LONG);
DateFieldMapper.DateFieldType dft = aggregableDateFieldType(false, randomBoolean());
testCase(builder, new MatchAllDocsQuery(), iw -> buildIndex.accept(iw, dft), verify, k1ft, k2ft, nft, dft);
}
protected final DateFieldMapper.DateFieldType aggregableDateFieldType(boolean useNanosecondResolution, boolean isSearchable) {
return new DateFieldMapper.DateFieldType(AGGREGABLE_DATE, isSearchable, true,
DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER,
useNanosecondResolution ? DateFieldMapper.Resolution.NANOSECONDS : DateFieldMapper.Resolution.MILLISECONDS,
Collections.emptyMap());
}
}
|
gingerwizard/elasticsearch
|
server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogramAggregatorTestCase.java
|
Java
|
apache-2.0
| 5,523
|
-- /useSkill skillName uses filter
-- skillName vai ser o nome usado para acessar essa skill, não use nomes separados por espaços
-- uses vai marcar quantos usos da habilidade vão ser gastos, se por um numero negativo vai recuperar ao inves de gastar
-- filter permite escolher de que personagem essa habilidade vai ser usada(npc|pc|pcOnline|all|mine)
local uses = tonumber(arg[2]);
while uses == nil do
uses = tonumber(inputQuery("Informe quantos usos foram gastos: "));
end
local filter = arg[3];
local personagem = sheet;
if filter == "all" or filter == "pc" or filter == "pcOnline" or filter=="npc" or filter == "mine" then
personagem = getCharacterSheet(chooseCharacter("Para qual personagem deseja criar/alterar a habilidade?", filter));
end;
local skillName = arg[1];
local indice;
if skillName == nil then
local habilidades = ndb.getChildNodes(personagem.macroSavedSkills);
local lista = {};
for i=1, #habilidades, 1 do
lista[i] = habilidades[i].nome;
end;
indice, skillName = choose("Que habilidade deseja usar?", lista, 1);
end
if personagem.macroSavedSkills == nil then
escrever("Esse personagem não tem habilidades salvas. Use /setSkill para criar habilidades para ele primeiro!");
return;
end;
if personagem.macroSavedSkills[skillName] == nil then
escrever("Esse personagem não tem nenhuma habilidade com esse nome salva. Use exatamente o mesmo nome para acessar a habilidade. Em caso de duvida use /showSkills para exibir as habilidades que possui. ");
return;
end;
personagem.macroSavedSkills[skillName].min = personagem.macroSavedSkills[skillName].min - uses;
if personagem.macroSavedSkills[skillName].min < 0 then
enviar("Foram usadas " .. (personagem.macroSavedSkills[skillName].min*-1) .. "cargas a mais que o personagem tinha.");
personagem.macroSavedSkills[skillName].min = 0;
end;
enviar("Foram gastos " .. uses .. " cargas da habilidade " .. skillName .. ". Saldo atual: " .. personagem.macroSavedSkills[skillName].min .. "/" .. personagem.macroSavedSkills[skillName].max);
|
rrpgfirecast/firecast
|
Macros/Ficha/useSkill.lua
|
Lua
|
apache-2.0
| 2,025
|
/*
* Copyright 2019 Wultra 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 io.getlime.security.powerauth.lib.webflow.authentication.method.approvalsca.model.request;
import io.getlime.security.powerauth.lib.nextstep.model.enumeration.AuthInstrument;
import io.getlime.security.powerauth.lib.webflow.authentication.base.AuthStepRequest;
import java.util.Collections;
import java.util.List;
/**
* Model for an init request for SCA approval.
*
* @author Roman Strobl, roman.strobl@wultra.com
*/
public class ApprovalScaAuthRequest extends AuthStepRequest {
@Override
public List<AuthInstrument> getAuthInstruments() {
return Collections.emptyList();
}
}
|
lime-company/lime-security-powerauth-webauth
|
powerauth-webflow-authentication-approval-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/approvalsca/model/request/ApprovalScaAuthRequest.java
|
Java
|
apache-2.0
| 1,205
|
/*
* Copyright (c) 2017 SamuelGjk <samuel.alva@outlook.com>
*
* This file is part of DiyCode
*
* DiyCode is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DiyCode 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 DiyCode. If not, see <http://www.gnu.org/licenses/>.
*/
package com.bibabo.fragment.watch;
import com.bibabo.base.mvp.BasePresenterImpl;
/**
* MVPPlugin
*/
public class BabyWatchPresenter extends BasePresenterImpl<BabyWatchContract.View> implements
BabyWatchContract.Presenter {
}
|
chengzijian/Bibabo
|
app/src/main/java/com/bibabo/fragment/watch/BabyWatchPresenter.java
|
Java
|
apache-2.0
| 975
|
/*
* File: TFileHandler.java
* This file is part of Tico, an application to create and perform
* interactive communication boards to be used by people with
* severe motor disabilities.
*
* Authors: Pablo Muñoz
*
* Date: Aug 22, 2006
*
* Company: Universidad de Zaragoza, CPS, DIIS
*
* License:
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package araword.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import araword.utils.TFileUtils;
/**
* Static class that manages the current editing project internal files.
*
* @author Pablo Muñoz
* @version 1.0 Nov 20, 2006
*/
public class TFileHandler {
private final static String CURRENT_BASE_DIRECTORY_PATH = "current";
private final static File CURRENT_BASE_DIRECTORY = new File(
CURRENT_BASE_DIRECTORY_PATH);
private final static File DEFAULT_IMPORT_DIR = new File("templates");
private static String currentDirectoryPath;
private static File currentDirectory;
static {
if (!CURRENT_BASE_DIRECTORY.exists())
CURRENT_BASE_DIRECTORY.mkdirs();
int i = 0;
currentDirectory = new File(CURRENT_BASE_DIRECTORY_PATH
+ File.separator + i++);
while (currentDirectory.exists())
currentDirectory = new File(CURRENT_BASE_DIRECTORY_PATH
+ File.separator + i++);
currentDirectoryPath = currentDirectory.getAbsolutePath();
currentDirectory.mkdirs();
}
/**
* Imports the specified <code>file</code> to the internal application
* structure.
*
* @param fileAbsolutePath The specified <code>file</code> fileAbsolutePath
* @return The new internal file
* @throws IOException If there is any problem importing the file
*/
public static File importFile(String fileAbsolutePath) throws IOException {
File file = new File(fileAbsolutePath);
return TFileHandler.importFile(file);
}
/**
* Imports the specified <code>file</code> to the internal application
* structure.
*
* @param file The specified <code>file</code>
* @return The new internal file
* @throws IOException If there is any problem importing the file
*/
public static File importFile(File file) throws IOException {
String directoryPath = currentDirectoryPath;
if (TFileUtils.isImageFile(file))
{
directoryPath += File.separator + "image";}
if (TFileUtils.isSoundFile(file)){
directoryPath += File.separator + "sound";
}
if (TFileUtils.isVideoFile(file)){
directoryPath += File.separator + "video";
}
File directory = new File(directoryPath);
if (!directory.exists())
directory.mkdirs();
return TFileHandler.importFile(file, directory);
}
/**
* Removes the specified <code>file</code> from the internal application
* structure.
*
* @param fileAbsolutePath The specified <code>file</code> fileAbsolutePath
*/
public static void remove(String fileAbsolutePath) {
File file = new File(fileAbsolutePath);
TFileHandler.remove(file);
}
// Import an external file to an internal file
private static File importFile(File srcFile, File dstDir)
throws IOException {
String baseFilename;
File newFile;
String name = getFilename(srcFile.getName());
String extension = getExtension(srcFile.getName());
String nameRenamed = replace(name);
if (!nameRenamed.equals(name)){
newFile = new File(dstDir,nameRenamed+"."+extension);
baseFilename = nameRenamed+"."+extension;
}else{
newFile = new File(dstDir, srcFile.getName());
baseFilename = srcFile.getName();
}
if ((!dstDir.exists()) || (!dstDir.canWrite()))
throw new IOException("Invalid destination directory");
if ((!srcFile.exists()) || (srcFile.isDirectory()))
throw new IOException("Invalid input file");
if (!srcFile.canRead())
throw new IOException("Input file can't be read");
int fileCount = 1;
while (newFile.exists())
newFile = new File(dstDir, TFileUtils.getFilename(baseFilename)
+ "_" + (fileCount++) + "."
+ TFileUtils.getExtension(baseFilename));
newFile.createNewFile();
copyFile(srcFile, newFile);
return newFile;
}
// Remove a file
private static void remove(File file) {
file.delete();
}
/**
* Returns the editor internal <code>currentDirectory</code>.
*
* @return The editor internal <code>currentDirectory</code>
*/
public static File getCurrentDirectory() {
return currentDirectory;
}
/**
* Returns the editor internal <code>currentDirectoryPath</code>.
*
* @return The editor internal <code>currentDirectoryPath</code>
*/
public static String getCurrentDirectoryPath() {
return currentDirectoryPath;
}
/**
* Converts the specified internal <code>file</code> absolute path to a
* current directory partial path.
*
* @param file The specified internal <code>file</code>
* @return The <code>file</code> partial path
*/
public static String convertToPartial(File file) {
return convertToPartial(file.getAbsolutePath());
}
/**
* Converts the specified internal <code>file</code> absolute path to a
* current directory partial path.
*
* @param path The specified internal <code>file</code> path
* @return The <code>file</code> partial path
*/
public static String convertToPartial(String path) {
return removeDirectoryPath(currentDirectoryPath, path);
}
/**
* Removes the specified <code>directory</code> from the specified
* <code>path</code>.
*
* @param directory The specified <code>directory</code>
* @param path The specified <code>path</code>
* @return Specified
*/
public static String removeDirectoryPath(String directory, String path) {
if (path.substring(0, directory.length()).equals(directory)) {
return path.substring(directory.length() + 1);
}
return null;
}
/**
* Converts the specified internal <code>file</code> partial path to
* an absolute path adding the current directory path.
*
* @param path The specified internal <code>file</code> partial path
* @return The <code>file</code> absolute path
*/
public static String convertToAbsolute(String path) {
return currentDirectoryPath + File.separator + path;
}
/**
* Deletes the current directory and all its contents.
*/
public static void deleteCurrentDirectory() {
deleteDirectory(currentDirectory);
currentDirectory.delete();
}
/**
* Deletes all the current directory contents.
*/
public static void cleanCurrentDirectory() {
deleteDirectory(currentDirectory);
}
/**
* Deletes the specified <code>directory</code> and all its contents.
*
* @param directory The specified <code>directory</code>
*/
public static void deleteDirectory(File directory) {
File[] files = directory.listFiles();
if (files != null)
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory())
deleteDirectory(files[i]);
files[i].delete();
}
}
/**
* Copies the content of an <code>in</code> file to an
* <code>out</code> file.
*
* @param in The <code>in</code> file
* @param out The <code>out</code> file
* @throws IOException If there is a problem with any of both files
*/
public static void copyFile(File in, File out) throws IOException {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
sourceChannel.close();
destinationChannel.close();
}
private static String replace(String word){
String result = word.replace(' ', '_').replace(',', '-').replace('�', 'a').replace('�', 'e').replace('�', 'i').replace('�', 'o').replace('�', 'u').
replace('�', 'A').replace('�', 'E').replace('�', 'I').replace('�', 'O').replace('�', 'U').replace("�", "ny").replace("�", "NY").toLowerCase();
return result;
}
public static String getFilename(String filePath) {
String fileName = null;
int ini = -1;
int end = filePath.lastIndexOf('.');
if ((ini < end) && (ini >= -1 && ini < filePath.length() - 1)
&& (end >= 0 && end < filePath.length()))
fileName = filePath.substring(ini + 1, end);
return fileName;
}
public static String getExtension(String filePath) {
String extension = null;
int i = filePath.lastIndexOf('.');
if (i > 0 && i < filePath.length() - 1)
extension = filePath.substring(i + 1).toLowerCase();
return extension;
}
/**
* Returns the default import/export dir.
*
* @return The default import/export dir
*/
public static File getDefaultImportDirectory() {
return DEFAULT_IMPORT_DIR;
}
}
|
ProgettoRadis/ArasuiteIta
|
AraWord/src/araword/utils/TFileHandler.java
|
Java
|
apache-2.0
| 9,264
|
// Copyright 2016 Google 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 uber
import (
"strings"
"testing"
istioconfig "istio.io/api/istio/config/v1"
"istio.io/mixer/pkg/aspectsupport"
"istio.io/mixer/pkg/attribute"
"istio.io/mixer/pkg/expr"
)
type (
fakereg struct {
RegistryQuerier
}
fakemgr struct {
kind string
aspectsupport.Manager
}
fakebag struct {
attribute.Bag
}
fakeevaluator struct {
expr.Evaluator
}
)
func (m *fakemgr) Kind() string {
return m.kind
}
func TestManager(t *testing.T) {
r := &fakereg{}
mgrs := []aspectsupport.Manager{&fakemgr{kind: "k1"}, &fakemgr{kind: "k2"}}
m := NewManager(r, mgrs)
cfg := &aspectsupport.CombinedConfig{
Aspect: &istioconfig.Aspect{},
Adapter: &istioconfig.Adapter{},
}
attrs := &fakebag{}
mapper := &fakeevaluator{}
if _, err := m.Execute(cfg, attrs, mapper); err != nil {
if !strings.Contains(err.Error(), "could not find aspect manager") {
t.Error("excute errored out: ", err)
}
}
}
|
mandarjog/mixr
|
pkg/aspectsupport/uber/manager_test.go
|
GO
|
apache-2.0
| 1,514
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("./index");
var express = require("express");
var jwt = require("jsonwebtoken");
var cors = require("cors");
var app = express();
app.use(cors());
var mountpoint = '/';
var prefix = '';
var options = {};
if (!process.env.VIDEOFOLDER) {
throw Error('no videofolder provided (by process env)');
}
var videofolder = process.env.VIDEOFOLDER;
if (process.env.PREFIX)
prefix = process.env.PREFIX;
if (!process.env.SERVERURI) {
throw Error('no SERVERURI provided (by process env)');
}
if (!process.env.PORT) {
process.env.PORT = 3000;
}
process.env.PORT = parseInt(process.env.PORT);
if (process.env.CONVERSIONDEST) {
options.conversion = { dest: process.env.CONVERSIONDEST };
}
if (process.env.MODE === 'user' && process.env.SECRET) {
options.mode = { type: 'users', secret: process.env.SECRET, ignoreExpiration: true };
}
options.serverUri = { path: videofolder, uri: process.env.SERVERURI + mountpoint + 'videolibrary/' };
if (!process.env.MODE) {
console.log(videofolder);
}
else if (process.env.MODE === 'user') {
if (!process.env.SECRET) {
throw Error('no secret provided (by process env)');
}
console.log(jwt.sign({ prefix: '' }, process.env.SECRET));
}
app.use(mountpoint, index_1.default(videofolder, options));
app.listen(process.env.PORT);
|
dottgonzo/express-media-files
|
server.js
|
JavaScript
|
apache-2.0
| 1,391
|
/**
* 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.openejb.test.entity.cmr.onetomany;
import java.util.Set;
import javax.ejb.EJBLocalObject;
/**
* @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
*/
public interface ArtistLocal extends EJBLocalObject {
// CMP
public Integer getId();
public void setId(Integer id);
public String getName();
public void setName(String name);
// CMR
public Set<SongLocal> getPerformed();
public void setPerformed(Set<SongLocal> performed);
public Set<SongLocal> getComposed();
public void setComposed(Set<SongLocal> composed);
}
|
apache/openejb
|
itests/openejb-itests-beans/src/main/java/org/apache/openejb/test/entity/cmr/onetomany/ArtistLocal.java
|
Java
|
apache-2.0
| 1,416
|
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "boot.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)
|
micbuz/project2
|
boot/manage.py
|
Python
|
apache-2.0
| 802
|
{% from 'admin/macros.html' import entries_list %}
{% extends 'admin/layout_schedule_history.html' %}
{% set active_tab = 'game' %}
{% block tabcontent %}
<table class="table table-bordered" style="margin-top: 12px;">
<thead>
<tr>
<th>詳細</th>
<th>状況</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<dl>
<dt>試合名</dt>
<dd>{{ schedule.name }}</dd>
<dt>場所</dt>
<dd>{{ schedule.loc }}</dd>
<dt>開催日</dt>
<dd>{{ schedule.when_ | dateformat }}</dd>
<dt>ジャンル</dt>
<dd>{{ schedule.genre }}</dd>
<dt>締め切り</dt>
<dd>{{ schedule.deadline }}</dd>
<dt>試合代</dt>
<dd>{{ schedule.price }}円</dd>
<dt>受付開始</dt>
<dd>{{ schedule.begin_acceptance }}</dd>
<dt>試合開始</dt>
<dd>{{ schedule.begin_game }}</dd>
<dt>備考</dt>
<dd>{{ schedule.note | nl2br | safe }}</dd>
</dl>
</td>
<td>
{{ entries_list(schedule) }}
</td>
</tr>
</tbody>
</table>
{% endblock %}
|
kzkn/fc
|
fcsite/templates/admin/show_game.html
|
HTML
|
apache-2.0
| 1,520
|
package com.bright.coolweather.db;
import org.litepal.crud.DataSupport;
/**
* @author Bright on 2017/2/10
* 描述: 城市的实体类
*/
public class City extends DataSupport {
private int id;
private String cityName;
//当前市所属省份的id值
private int provinceId;
private int cityCode;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public int getProvinceId() {
return provinceId;
}
public void setProvinceId(int provinceId) {
this.provinceId = provinceId;
}
public int getCityCode() {
return cityCode;
}
public void setCityCode(int cityCode) {
this.cityCode = cityCode;
}
}
|
BrightLeeDev/coolweather
|
app/src/main/java/com/bright/coolweather/db/City.java
|
Java
|
apache-2.0
| 910
|
import { Button } from './Button';
import * as Cards from './Card';
import { TextInput } from './Input';
import { NavBar } from './NavBar';
export {
Button,
Cards,
TextInput,
NavBar
};
|
rishabhnehra/Invoicer
|
src/components/index.ts
|
TypeScript
|
apache-2.0
| 201
|
/*
* Copyright (c) 2010, Stanislav Muhametsin. 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 org.qi4j.library.sql.common;
import org.qi4j.api.common.Optional;
import org.qi4j.api.configuration.ConfigurationComposite;
import org.qi4j.api.property.Property;
import org.qi4j.library.sql.ds.DataSourceService;
/**
* Typical configuration for service, which uses data source (through {@link DataSourceService} ) as connection to SQL
* database, and given schema name as schema to create tables in.
*
* @author Stanislav Muhametsin
*/
public interface SQLConfiguration
extends ConfigurationComposite // DataSourceConfiguration
{
/**
* The schema name to use to create/find tables.
*/
@Optional
Property<String> schemaName();
}
|
Qi4j/qi4j-libraries
|
sql/src/main/java/org/qi4j/library/sql/common/SQLConfiguration.java
|
Java
|
apache-2.0
| 1,293
|
/*
* Copyright 2014 David Moreno
*
* 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.
*/
#pragma once
#include <string>
#include <vector>
#include <memory>
namespace loglang{
class value_base;
using any = std::unique_ptr<value_base>;
}
namespace std{
std::string to_string(const loglang::any &any);
std::string to_string(const loglang::value_base *any);
}
namespace loglang{
class value_base{
public:
class invalid_conversion : public std::exception {
std::string str;
public:
invalid_conversion(std::string _str, const value_base *v){
str="Invalid conversion to ";
str+=_str;
str+=" from ";
str+=std::to_string(v);
}
const char* what() const throw() override{
return str.c_str();
}
};
public:
const std::string type_name;
value_base(std::string _type_name) : type_name(std::move(_type_name)) {}
virtual ~value_base(){}
virtual any clone() const = 0;
virtual int cmp(const any &) const = 0;
virtual int64_t to_int() const{
throw invalid_conversion("int", this);
}
virtual double to_double() const{
throw invalid_conversion("double", this);
}
virtual const std::string &to_string() const{
throw invalid_conversion("string", this);
}
virtual bool to_bool() const{
throw invalid_conversion("bool", this);
}
virtual const std::vector<any> &to_list() const{
throw invalid_conversion("list", this);
}
};
class string;
class _int;
class _double;
class _bool;
class _list;
any to_any(std::string str);
any to_any(double val);
any to_any(int64_t val);
any to_any(bool val);
any to_any(std::vector<any> vec);
bool operator==(const any &, const any &);
};
|
davidmoreno/loglang
|
src/value.hpp
|
C++
|
apache-2.0
| 2,181
|
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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.
# =============================================================================
"""
Exception for errors raised while interpreting nodes.
"""
class NodeException(Exception):
"""Base class for errors raised while interpreting nodes."""
def __init__(self, *msg):
"""Set the error message."""
self.msg = ' '.join(msg)
def __str__(self):
"""Return the message."""
return repr(self.msg)
|
ChristopheVuillot/qiskit-sdk-py
|
qiskit/qasm/_node/_nodeexception.py
|
Python
|
apache-2.0
| 1,054
|
/*
* Copyright 2012-2017 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.codedeploy;
import javax.annotation.Generated;
import com.amazonaws.services.codedeploy.model.*;
import com.amazonaws.*;
import com.amazonaws.services.codedeploy.waiters.AmazonCodeDeployWaiters;
/**
* Abstract implementation of {@code AmazonCodeDeploy}. Convenient method forms pass through to the corresponding
* overload that takes a request object, which throws an {@code UnsupportedOperationException}.
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AbstractAmazonCodeDeploy implements AmazonCodeDeploy {
protected AbstractAmazonCodeDeploy() {
}
@Override
public void setEndpoint(String endpoint) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public void setRegion(com.amazonaws.regions.Region region) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public AddTagsToOnPremisesInstancesResult addTagsToOnPremisesInstances(AddTagsToOnPremisesInstancesRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetApplicationRevisionsResult batchGetApplicationRevisions(BatchGetApplicationRevisionsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetApplicationsResult batchGetApplications(BatchGetApplicationsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetApplicationsResult batchGetApplications() {
return batchGetApplications(new BatchGetApplicationsRequest());
}
@Override
public BatchGetDeploymentGroupsResult batchGetDeploymentGroups(BatchGetDeploymentGroupsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetDeploymentInstancesResult batchGetDeploymentInstances(BatchGetDeploymentInstancesRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetDeploymentsResult batchGetDeployments(BatchGetDeploymentsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetDeploymentsResult batchGetDeployments() {
return batchGetDeployments(new BatchGetDeploymentsRequest());
}
@Override
public BatchGetOnPremisesInstancesResult batchGetOnPremisesInstances(BatchGetOnPremisesInstancesRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public BatchGetOnPremisesInstancesResult batchGetOnPremisesInstances() {
return batchGetOnPremisesInstances(new BatchGetOnPremisesInstancesRequest());
}
@Override
public ContinueDeploymentResult continueDeployment(ContinueDeploymentRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public CreateApplicationResult createApplication(CreateApplicationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public CreateDeploymentResult createDeployment(CreateDeploymentRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public CreateDeploymentConfigResult createDeploymentConfig(CreateDeploymentConfigRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public CreateDeploymentGroupResult createDeploymentGroup(CreateDeploymentGroupRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DeleteApplicationResult deleteApplication(DeleteApplicationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DeleteDeploymentConfigResult deleteDeploymentConfig(DeleteDeploymentConfigRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DeleteDeploymentGroupResult deleteDeploymentGroup(DeleteDeploymentGroupRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public DeregisterOnPremisesInstanceResult deregisterOnPremisesInstance(DeregisterOnPremisesInstanceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetApplicationResult getApplication(GetApplicationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetApplicationRevisionResult getApplicationRevision(GetApplicationRevisionRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetDeploymentResult getDeployment(GetDeploymentRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetDeploymentConfigResult getDeploymentConfig(GetDeploymentConfigRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetDeploymentGroupResult getDeploymentGroup(GetDeploymentGroupRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetDeploymentInstanceResult getDeploymentInstance(GetDeploymentInstanceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public GetOnPremisesInstanceResult getOnPremisesInstance(GetOnPremisesInstanceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListApplicationRevisionsResult listApplicationRevisions(ListApplicationRevisionsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListApplicationsResult listApplications(ListApplicationsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListApplicationsResult listApplications() {
return listApplications(new ListApplicationsRequest());
}
@Override
public ListDeploymentConfigsResult listDeploymentConfigs(ListDeploymentConfigsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListDeploymentConfigsResult listDeploymentConfigs() {
return listDeploymentConfigs(new ListDeploymentConfigsRequest());
}
@Override
public ListDeploymentGroupsResult listDeploymentGroups(ListDeploymentGroupsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListDeploymentInstancesResult listDeploymentInstances(ListDeploymentInstancesRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListDeploymentsResult listDeployments(ListDeploymentsRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListDeploymentsResult listDeployments() {
return listDeployments(new ListDeploymentsRequest());
}
@Override
public ListOnPremisesInstancesResult listOnPremisesInstances(ListOnPremisesInstancesRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public ListOnPremisesInstancesResult listOnPremisesInstances() {
return listOnPremisesInstances(new ListOnPremisesInstancesRequest());
}
@Override
public RegisterApplicationRevisionResult registerApplicationRevision(RegisterApplicationRevisionRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public RegisterOnPremisesInstanceResult registerOnPremisesInstance(RegisterOnPremisesInstanceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public RemoveTagsFromOnPremisesInstancesResult removeTagsFromOnPremisesInstances(RemoveTagsFromOnPremisesInstancesRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public SkipWaitTimeForInstanceTerminationResult skipWaitTimeForInstanceTermination(SkipWaitTimeForInstanceTerminationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public StopDeploymentResult stopDeployment(StopDeploymentRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public UpdateApplicationResult updateApplication(UpdateApplicationRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public UpdateApplicationResult updateApplication() {
return updateApplication(new UpdateApplicationRequest());
}
@Override
public UpdateDeploymentGroupResult updateDeploymentGroup(UpdateDeploymentGroupRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public void shutdown() {
throw new java.lang.UnsupportedOperationException();
}
@Override
public com.amazonaws.ResponseMetadata getCachedResponseMetadata(com.amazonaws.AmazonWebServiceRequest request) {
throw new java.lang.UnsupportedOperationException();
}
@Override
public AmazonCodeDeployWaiters waiters() {
throw new java.lang.UnsupportedOperationException();
}
}
|
dagnir/aws-sdk-java
|
aws-java-sdk-codedeploy/src/main/java/com/amazonaws/services/codedeploy/AbstractAmazonCodeDeploy.java
|
Java
|
apache-2.0
| 9,991
|
<div>
<div class="row">
<div class="col-md-4">
<h3>Events</h3>
</div>
<div class="col-md-3">
<alert type="info" ng-show="newItems" role="alert" style=" margin-bottom: 0;padding-top: 6px; padding-bottom: 6px;"><i class="fa fa-info-circle"></i> {{ newItems }}</alert>
</div>
<div class="col-md-4 text-right" style="padding-top: 20px">
<gb-pager model="pageState" page-first="pageFirst()" page-previous="pagePrevious()" page-next="pageNext()"></gb-pager>
</div>
<div class="col-md-1" style="padding-top: 20px">
<!-- Need display:inline-block for margin-top to work -->
<gb-popout style="float:right;"></gb-popout>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive" style="overflow-x: auto">
<table class="table table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Alarm</th>
<th>Sev</th>
<th>User</th>
<th>Message</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr class="gb-event" ng-repeat="event in events">
<td>{{event.eventType}}</td>
<td>{{event.alarm}}</td>
<td>{{event.severity}}</td>
<td>{{event.agent}}</td>
<td>{{event.message}}</td>
<td>{{event.time | date:"h:mm:ss a, MM-dd-yyyy"}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-show="pageState === 4">
No events
</div>
</div>
</div>
|
gec/greenbus-web-views
|
template/event/events.html
|
HTML
|
apache-2.0
| 1,912
|
package com.lucien.spirit.admin.controller;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AccountException;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.lucien.spirit.admin.service.UserService;
import com.lucien.spirit.core.shiro.ShiroUser;
@Controller
public class LoginController {
private static final Logger logger = LoggerFactory.getLogger(LoginController.class);
@Autowired
UserService userService;
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login() {
Subject subject = SecurityUtils.getSubject();
if (subject.isAuthenticated()) {
return "redirect:/home";
}
return "/login";
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(Model model, HttpServletRequest request, String username, String password, boolean rememberMe) {
Subject subject = SecurityUtils.getSubject();
if (subject.isAuthenticated() || subject.isRemembered()) {
return "redirect:/home";
}
String loginKaptchaCode = request.getParameter("code");
Session shiroSession = subject.getSession();
Object kaptchaCode = shiroSession.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
if (kaptchaCode == null || !StringUtils.equalsIgnoreCase(loginKaptchaCode, kaptchaCode.toString())) {
model.addAttribute("message", "验证码错误!");
return "/login";
}
UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe, request.getRemoteHost());
try {
subject.login(token);
ShiroUser principal = (ShiroUser) subject.getPrincipal();
userService.updateLastLogin(principal.getId());
logger.info("Login successful!");
return "redirect:/home";
} catch (UnknownAccountException uae) {
model.addAttribute("message", "用户不存在");
logger.info("{} Unknown User!", username);
} catch (IncorrectCredentialsException ice) {
model.addAttribute("message", "密码不正确");
logger.info("{} Incorrect Password!", username);
} catch (LockedAccountException lae) {
model.addAttribute("message", "用户被锁定");
logger.info("{} User Locked!", username);
} catch (AccountException ae) {
model.addAttribute("message", ae.getMessage());
logger.info("{} {}", username, ae.getMessage());
} catch (AuthenticationException ae) {
model.addAttribute("message", "登录失败");
logger.info("{} Authentication Failed!", username);
}
return "/login";
}
}
|
lijunf/spirit-parent
|
spirit-web-admin/src/main/java/com/lucien/spirit/admin/controller/LoginController.java
|
Java
|
apache-2.0
| 3,626
|
/*
* Copyright 2013 Google 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.google.bitcoin.protocols.channels;
import com.google.bitcoin.core.*;
import com.google.bitcoin.protocols.channels.PaymentChannelCloseException.CloseReason;
import com.google.bitcoin.utils.Threading;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.protobuf.ByteString;
import net.jcip.annotations.GuardedBy;
import org.bitcoin.paymentchannel.Protos;
import org.slf4j.LoggerFactory;
import java.math.BigInteger;
import java.util.concurrent.locks.ReentrantLock;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
/**
* <p>A handler class which handles most of the complexity of creating a payment channel connection by providing a
* simple in/out interface which is provided with protobufs from the client and which generates protobufs which should
* be sent to the client.</p>
*
* <p>Does all required verification of messages and properly stores state objects in the wallet-attached
* {@link StoredPaymentChannelServerStates} so that they are automatically closed when necessary and payment
* transactions are not lost if the application crashes before it unlocks.</p>
*/
public class PaymentChannelServer {
//TODO: Update JavaDocs with notes for communication over stateless protocols
private static final org.slf4j.Logger log = LoggerFactory.getLogger(PaymentChannelServer.class);
protected final ReentrantLock lock = Threading.lock("channelserver");
// The step in the initialization process we are in, some of this is duplicated in the PaymentChannelServerState
private enum InitStep {
WAITING_ON_CLIENT_VERSION,
WAITING_ON_UNSIGNED_REFUND,
WAITING_ON_CONTRACT,
WAITING_ON_MULTISIG_ACCEPTANCE,
CHANNEL_OPEN
}
@GuardedBy("lock") private InitStep step = InitStep.WAITING_ON_CLIENT_VERSION;
/**
* Implements the connection between this server and the client, providing an interface which allows messages to be
* sent to the client, requests for the connection to the client to be closed, and callbacks which occur when the
* channel is fully open or the client completes a payment.
*/
public interface ServerConnection {
/**
* <p>Requests that the given message be sent to the client. There are no blocking requirements for this method,
* however the order of messages must be preserved.</p>
*
* <p>If the send fails, no exception should be thrown, however
* {@link PaymentChannelServer#connectionClosed()} should be called immediately.</p>
*
* <p>Called while holding a lock on the {@link PaymentChannelServer} object - be careful about reentrancy</p>
*/
public void sendToClient(Protos.TwoWayChannelMessage msg);
/**
* <p>Requests that the connection to the client be closed</p>
*
* <p>Called while holding a lock on the {@link PaymentChannelServer} object - be careful about reentrancy</p>
*
* @param reason The reason for the closure, see the individual values for more details.
* It is usually safe to ignore this value.
*/
public void destroyConnection(CloseReason reason);
/**
* <p>Triggered when the channel is opened and payments can begin</p>
*
* <p>Called while holding a lock on the {@link PaymentChannelServer} object - be careful about reentrancy</p>
*
* @param contractHash A unique identifier which represents this channel (actually the hash of the multisig contract)
*/
public void channelOpen(Sha256Hash contractHash);
/**
* <p>Called when the payment in this channel was successfully incremented by the client</p>
*
* <p>Called while holding a lock on the {@link PaymentChannelServer} object - be careful about reentrancy</p>
*
* @param by The increase in total payment
* @param to The new total payment to us (not including fees which may be required to claim the payment)
*/
public void paymentIncrease(BigInteger by, BigInteger to);
}
private final ServerConnection conn;
// Used to keep track of whether or not the "socket" ie connection is open and we can generate messages
@GuardedBy("lock") private boolean connectionOpen = false;
// Indicates that no further messages should be sent and we intend to settle the connection
@GuardedBy("lock") private boolean channelSettling = false;
// The wallet and peergroup which are used to complete/broadcast transactions
private final Wallet wallet;
private final TransactionBroadcaster broadcaster;
// The key used for multisig in this channel
@GuardedBy("lock") private ECKey myKey;
// The minimum accepted channel value
private final BigInteger minAcceptedChannelSize;
// The state manager for this channel
@GuardedBy("lock") private PaymentChannelServerState state;
// The time this channel expires (ie the refund transaction's locktime)
@GuardedBy("lock") private long expireTime;
/**
* <p>The amount of time we request the client lock in their funds.</p>
*
* <p>The value defaults to 24 hours - 60 seconds and should always be greater than 2 hours plus the amount of time
* the channel is expected to be used and smaller than 24 hours minus the client <-> server latency minus some
* factor to account for client clock inaccuracy.</p>
*/
public long timeWindow = 24*60*60 - 60;
/**
* Creates a new server-side state manager which handles a single client connection.
*
* @param broadcaster The PeerGroup on which transactions will be broadcast - should have multiple connections.
* @param wallet The wallet which will be used to complete transactions.
* Unlike {@link PaymentChannelClient}, this does not have to already contain a StoredState manager
* @param minAcceptedChannelSize The minimum value the client must lock into this channel. A value too large will be
* rejected by clients, and a value too low will require excessive channel reopening
* and may cause fees to be require to settle the channel. A reasonable value depends
* entirely on the expected maximum for the channel, and should likely be somewhere
* between a few bitcents and a bitcoin.
* @param conn A callback listener which represents the connection to the client (forwards messages we generate to
* the client and will close the connection on request)
*/
public PaymentChannelServer(TransactionBroadcaster broadcaster, Wallet wallet,
BigInteger minAcceptedChannelSize, ServerConnection conn) {
this.broadcaster = checkNotNull(broadcaster);
this.wallet = checkNotNull(wallet);
this.minAcceptedChannelSize = checkNotNull(minAcceptedChannelSize);
this.conn = checkNotNull(conn);
}
@GuardedBy("lock")
private void receiveVersionMessage(Protos.TwoWayChannelMessage msg) throws VerificationException {
Protos.ServerVersion.Builder versionNegotiationBuilder = Protos.ServerVersion.newBuilder()
.setMajor(0).setMinor(1);
conn.sendToClient(Protos.TwoWayChannelMessage.newBuilder()
.setType(Protos.TwoWayChannelMessage.MessageType.SERVER_VERSION)
.setServerVersion(versionNegotiationBuilder)
.build());
ByteString reopenChannelContractHash = msg.getClientVersion().getPreviousChannelContractHash();
if (reopenChannelContractHash != null && reopenChannelContractHash.size() == 32) {
Sha256Hash contractHash = new Sha256Hash(reopenChannelContractHash.toByteArray());
log.info("New client that wants to resume {}", contractHash);
StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates)
wallet.getExtensions().get(StoredPaymentChannelServerStates.EXTENSION_ID);
if (channels != null) {
StoredServerChannel storedServerChannel = channels.getChannel(contractHash);
if (storedServerChannel != null) {
final PaymentChannelServer existingHandler = storedServerChannel.setConnectedHandler(this, false);
if (existingHandler != this) {
log.warn(" ... and that channel is already in use, disconnecting other user.");
existingHandler.close();
storedServerChannel.setConnectedHandler(this, true);
}
log.info("Got resume version message, responding with VERSIONS and CHANNEL_OPEN");
state = storedServerChannel.getOrCreateState(wallet, broadcaster);
step = InitStep.CHANNEL_OPEN;
conn.sendToClient(Protos.TwoWayChannelMessage.newBuilder()
.setType(Protos.TwoWayChannelMessage.MessageType.CHANNEL_OPEN)
.build());
conn.channelOpen(contractHash);
return;
} else {
log.error(" ... but we do not have any record of that contract! Resume failed.");
}
} else {
log.error(" ... but we do not have any stored channels! Resume failed.");
}
}
log.info("Got initial version message, responding with VERSIONS and INITIATE: min value={}",
minAcceptedChannelSize.longValue());
myKey = new ECKey();
wallet.addKey(myKey);
expireTime = Utils.now().getTime() / 1000 + timeWindow;
step = InitStep.WAITING_ON_UNSIGNED_REFUND;
Protos.Initiate.Builder initiateBuilder = Protos.Initiate.newBuilder()
.setMultisigKey(ByteString.copyFrom(myKey.getPubKey()))
.setExpireTimeSecs(expireTime)
.setMinAcceptedChannelSize(minAcceptedChannelSize.longValue());
conn.sendToClient(Protos.TwoWayChannelMessage.newBuilder()
.setInitiate(initiateBuilder)
.setType(Protos.TwoWayChannelMessage.MessageType.INITIATE)
.build());
}
@GuardedBy("lock")
private void receiveRefundMessage(Protos.TwoWayChannelMessage msg) throws VerificationException {
checkState(step == InitStep.WAITING_ON_UNSIGNED_REFUND && msg.hasProvideRefund());
log.info("Got refund transaction, returning signature");
Protos.ProvideRefund providedRefund = msg.getProvideRefund();
state = new PaymentChannelServerState(broadcaster, wallet, myKey, expireTime);
byte[] signature = state.provideRefundTransaction(new Transaction(wallet.getParams(), providedRefund.getTx().toByteArray()),
providedRefund.getMultisigKey().toByteArray());
step = InitStep.WAITING_ON_CONTRACT;
Protos.ReturnRefund.Builder returnRefundBuilder = Protos.ReturnRefund.newBuilder()
.setSignature(ByteString.copyFrom(signature));
conn.sendToClient(Protos.TwoWayChannelMessage.newBuilder()
.setReturnRefund(returnRefundBuilder)
.setType(Protos.TwoWayChannelMessage.MessageType.RETURN_REFUND)
.build());
}
private void multisigContractPropogated(Sha256Hash contractHash) {
lock.lock();
try {
if (!connectionOpen || channelSettling)
return;
state.storeChannelInWallet(PaymentChannelServer.this);
conn.sendToClient(Protos.TwoWayChannelMessage.newBuilder()
.setType(Protos.TwoWayChannelMessage.MessageType.CHANNEL_OPEN)
.build());
step = InitStep.CHANNEL_OPEN;
conn.channelOpen(contractHash);
} finally {
lock.unlock();
}
}
@GuardedBy("lock")
private void receiveContractMessage(Protos.TwoWayChannelMessage msg) throws VerificationException {
checkState(step == InitStep.WAITING_ON_CONTRACT && msg.hasProvideContract());
log.info("Got contract, broadcasting and responding with CHANNEL_OPEN");
Protos.ProvideContract providedContract = msg.getProvideContract();
//TODO notify connection handler that timeout should be significantly extended as we wait for network propagation?
final Transaction multisigContract = new Transaction(wallet.getParams(), providedContract.getTx().toByteArray());
step = InitStep.WAITING_ON_MULTISIG_ACCEPTANCE;
state.provideMultiSigContract(multisigContract)
.addListener(new Runnable() {
@Override
public void run() {
multisigContractPropogated(multisigContract.getHash());
}
}, Threading.SAME_THREAD);
}
@GuardedBy("lock")
private void receiveUpdatePaymentMessage(Protos.TwoWayChannelMessage msg) throws VerificationException, ValueOutOfRangeException {
checkState(step == InitStep.CHANNEL_OPEN && msg.hasUpdatePayment());
log.info("Got a payment update");
Protos.UpdatePayment updatePayment = msg.getUpdatePayment();
BigInteger lastBestPayment = state.getBestValueToMe();
final BigInteger refundSize = BigInteger.valueOf(updatePayment.getClientChangeValue());
boolean stillUsable = state.incrementPayment(refundSize, updatePayment.getSignature().toByteArray());
BigInteger bestPaymentChange = state.getBestValueToMe().subtract(lastBestPayment);
if (bestPaymentChange.compareTo(BigInteger.ZERO) > 0)
conn.paymentIncrease(bestPaymentChange, state.getBestValueToMe());
Protos.TwoWayChannelMessage.Builder ack = Protos.TwoWayChannelMessage.newBuilder();
ack.setType(Protos.TwoWayChannelMessage.MessageType.PAYMENT_ACK);
conn.sendToClient(ack.build());
if (!stillUsable) {
log.info("Channel is now fully exhausted, closing/initiating settlement");
settlePayment(CloseReason.CHANNEL_EXHAUSTED);
}
}
/**
* Called when a message is received from the client. Processes the given message and generates events based on its
* content.
*/
public void receiveMessage(Protos.TwoWayChannelMessage msg) {
lock.lock();
try {
checkState(connectionOpen);
if (channelSettling)
return;
// If we generate an error, we set errorBuilder and closeReason and break, otherwise we return
Protos.Error.Builder errorBuilder;
CloseReason closeReason;
try {
switch (msg.getType()) {
case CLIENT_VERSION:
checkState(step == InitStep.WAITING_ON_CLIENT_VERSION && msg.hasClientVersion());
if (msg.getClientVersion().getMajor() != 0) {
errorBuilder = Protos.Error.newBuilder()
.setCode(Protos.Error.ErrorCode.NO_ACCEPTABLE_VERSION);
closeReason = CloseReason.NO_ACCEPTABLE_VERSION;
break;
}
receiveVersionMessage(msg);
return;
case PROVIDE_REFUND:
receiveRefundMessage(msg);
return;
case PROVIDE_CONTRACT:
receiveContractMessage(msg);
return;
case UPDATE_PAYMENT:
receiveUpdatePaymentMessage(msg);
return;
case CLOSE:
receiveCloseMessage();
return;
case ERROR:
checkState(msg.hasError());
log.error("Client sent ERROR {} with explanation {}", msg.getError().getCode().name(),
msg.getError().hasExplanation() ? msg.getError().getExplanation() : "");
conn.destroyConnection(CloseReason.REMOTE_SENT_ERROR);
return;
default:
log.error("Got unknown message type or type that doesn't apply to servers.");
errorBuilder = Protos.Error.newBuilder()
.setCode(Protos.Error.ErrorCode.SYNTAX_ERROR);
closeReason = CloseReason.REMOTE_SENT_INVALID_MESSAGE;
break;
}
} catch (VerificationException e) {
log.error("Caught verification exception handling message from client", e);
errorBuilder = Protos.Error.newBuilder()
.setCode(Protos.Error.ErrorCode.BAD_TRANSACTION)
.setExplanation(e.getMessage());
closeReason = CloseReason.REMOTE_SENT_INVALID_MESSAGE;
} catch (ValueOutOfRangeException e) {
log.error("Caught value out of range exception handling message from client", e);
errorBuilder = Protos.Error.newBuilder()
.setCode(Protos.Error.ErrorCode.BAD_TRANSACTION)
.setExplanation(e.getMessage());
closeReason = CloseReason.REMOTE_SENT_INVALID_MESSAGE;
} catch (IllegalStateException e) {
log.error("Caught illegal state exception handling message from client", e);
errorBuilder = Protos.Error.newBuilder()
.setCode(Protos.Error.ErrorCode.SYNTAX_ERROR);
closeReason = CloseReason.REMOTE_SENT_INVALID_MESSAGE;
}
conn.sendToClient(Protos.TwoWayChannelMessage.newBuilder()
.setError(errorBuilder)
.setType(Protos.TwoWayChannelMessage.MessageType.ERROR)
.build());
conn.destroyConnection(closeReason);
} finally {
lock.unlock();
}
}
@GuardedBy("lock")
private void receiveCloseMessage() throws ValueOutOfRangeException {
log.info("Got CLOSE message, closing channel");
if (state != null) {
settlePayment(CloseReason.CLIENT_REQUESTED_CLOSE);
} else {
conn.destroyConnection(CloseReason.CLIENT_REQUESTED_CLOSE);
}
}
@GuardedBy("lock")
private void settlePayment(final CloseReason clientRequestedClose) throws ValueOutOfRangeException {
// Setting channelSettling here prevents us from sending another CLOSE when state.close() calls
// close() on us here below via the stored channel state.
// TODO: Strongly separate the lifecycle of the payment channel from the TCP connection in these classes.
channelSettling = true;
Futures.addCallback(state.close(), new FutureCallback<Transaction>() {
@Override
public void onSuccess(Transaction result) {
// Send the successfully accepted transaction back to the client.
final Protos.TwoWayChannelMessage.Builder msg = Protos.TwoWayChannelMessage.newBuilder();
msg.setType(Protos.TwoWayChannelMessage.MessageType.CLOSE);
if (result != null) {
// Result can be null on various error paths, like if we never actually opened
// properly and so on.
msg.getSettlementBuilder().setTx(ByteString.copyFrom(result.bitcoinSerialize()));
log.info("Sending CLOSE back with broadcast settlement tx.");
} else {
log.info("Sending CLOSE back without broadcast settlement tx.");
}
conn.sendToClient(msg.build());
}
@Override
public void onFailure(Throwable t) {
log.error("Failed to broadcast settlement tx", t);
conn.destroyConnection(clientRequestedClose);
}
});
}
/**
* <p>Called when the connection terminates. Notifies the {@link StoredServerChannel} object that we can attempt to
* resume this channel in the future and stops generating messages for the client.</p>
*
* <p>Note that this <b>MUST</b> still be called even after either
* {@link ServerConnection#destroyConnection(CloseReason)} or
* {@link PaymentChannelServer#close()} is called to actually handle the connection close logic.</p>
*/
public void connectionClosed() {
lock.lock();
try {
log.info("Server channel closed.");
connectionOpen = false;
try {
if (state != null && state.getMultisigContract() != null) {
StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates)
wallet.getExtensions().get(StoredPaymentChannelServerStates.EXTENSION_ID);
if (channels != null) {
StoredServerChannel storedServerChannel = channels.getChannel(state.getMultisigContract().getHash());
if (storedServerChannel != null) {
storedServerChannel.clearConnectedHandler();
}
}
}
} catch (IllegalStateException e) {
// Expected when we call getMultisigContract() sometimes
}
} finally {
lock.unlock();
}
}
/**
* Called to indicate the connection has been opened and messages can now be generated for the client.
*/
public void connectionOpen() {
lock.lock();
try {
log.info("New server channel active.");
connectionOpen = true;
} finally {
lock.unlock();
}
}
/**
* <p>Closes the connection by generating a settle message for the client and calls
* {@link ServerConnection#destroyConnection(CloseReason)}. Note that this does not broadcast
* the payment transaction and the client may still resume the same channel if they reconnect</p>
*
* <p>Note that {@link PaymentChannelServer#connectionClosed()} must still be called after the connection fully
* closes.</p>
*/
public void close() {
lock.lock();
try {
if (connectionOpen && !channelSettling) {
final Protos.TwoWayChannelMessage.Builder msg = Protos.TwoWayChannelMessage.newBuilder();
msg.setType(Protos.TwoWayChannelMessage.MessageType.CLOSE);
conn.sendToClient(msg.build());
conn.destroyConnection(CloseReason.SERVER_REQUESTED_CLOSE);
}
} finally {
lock.unlock();
}
}
}
|
sserrano44/bitcoinj-watcher-service
|
core/src/main/java/com/google/bitcoin/protocols/channels/PaymentChannelServer.java
|
Java
|
apache-2.0
| 23,823
|
/*
* Copyright 2013 Gunnar Kappei.
*
* 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 net.opengis.gml;
/**
* A document containing one topoVolumeProperty(@http://www.opengis.net/gml) element.
*
* This is a complex type.
*/
public interface TopoVolumePropertyDocument extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(TopoVolumePropertyDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s6E28D279B6C224D74769DB8B98AF1665").resolveHandle("topovolumeproperty14e2doctype");
/**
* Gets the "topoVolumeProperty" element
*/
net.opengis.gml.TopoVolumePropertyType getTopoVolumeProperty();
/**
* Sets the "topoVolumeProperty" element
*/
void setTopoVolumeProperty(net.opengis.gml.TopoVolumePropertyType topoVolumeProperty);
/**
* Appends and returns a new empty "topoVolumeProperty" element
*/
net.opengis.gml.TopoVolumePropertyType addNewTopoVolumeProperty();
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static net.opengis.gml.TopoVolumePropertyDocument newInstance() {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static net.opengis.gml.TopoVolumePropertyDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
@Deprecated
public static net.opengis.gml.TopoVolumePropertyDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
@Deprecated
public static net.opengis.gml.TopoVolumePropertyDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (net.opengis.gml.TopoVolumePropertyDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
@Deprecated
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
@Deprecated
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
|
moosbusch/xbLIDO
|
src/net/opengis/gml/TopoVolumePropertyDocument.java
|
Java
|
apache-2.0
| 8,962
|
package io.github.greyp9.arwo.core.jdbc.op;
import io.github.greyp9.arwo.core.cache.ResourceCache;
import io.github.greyp9.arwo.core.charset.UTF8Codec;
import io.github.greyp9.arwo.core.file.meta.MetaFile;
import io.github.greyp9.arwo.core.glyph.UTF16;
import io.github.greyp9.arwo.core.hash.CRCU;
import io.github.greyp9.arwo.core.http.Http;
import io.github.greyp9.arwo.core.io.ReaderU;
import io.github.greyp9.arwo.core.io.StreamU;
import io.github.greyp9.arwo.core.number.NumberScale;
import io.github.greyp9.arwo.core.result.op.Results;
import io.github.greyp9.arwo.core.table.cell.TableViewLink;
import io.github.greyp9.arwo.core.table.insert.InsertRow;
import io.github.greyp9.arwo.core.table.metadata.ColumnMetaData;
import io.github.greyp9.arwo.core.table.metadata.RowSetMetaData;
import io.github.greyp9.arwo.core.table.row.RowSet;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.Date;
public class JDBCQuery {
private final Connection connection;
private final Results results;
private final ResourceCache cacheBlob;
public JDBCQuery(final Connection connection, final Results results, final ResourceCache cacheBlob) {
this.connection = connection;
this.results = results;
this.cacheBlob = cacheBlob;
}
public final Results execute(final String sql) throws SQLException, IOException {
final Statement statement = connection.createStatement();
try {
results.getInterval().setDateStart(new Date());
return execute(statement, sql);
} finally {
results.getInterval().setDateFinish(new Date());
statement.close();
}
}
private Results execute(final Statement statement, final String sql) throws SQLException, IOException {
boolean moreResults = true;
boolean isResultSet = statement.execute(sql);
while (moreResults) {
moreResults = (isResultSet ? getResultSet(statement) : getUpdateCount(statement));
isResultSet = (moreResults && statement.getMoreResults());
}
return results;
}
@SuppressWarnings({ "PMD.CloseResource" })
private boolean getResultSet(final Statement statement) throws SQLException, IOException {
final ResultSet resultSet = statement.getResultSet();
final ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
final int columnCount = resultSetMetaData.getColumnCount();
final RowSetMetaData metaData = getMetaData(resultSet);
final RowSet rowSet = new RowSet(metaData, null, null);
while (resultSet.next()) {
final InsertRow insertRow = InsertRow.create(rowSet);
for (int i = 1; (i <= columnCount); ++i) {
final Object object = resultSet.getObject(i);
final int type = resultSetMetaData.getColumnType(i);
//String columnName = resultSetMetaData.getColumnName(i);
//String columnLabel = resultSetMetaData.getColumnLabel(i);
if (object == null) {
insertRow.setNextColumn(null);
} else if (type == Types.CLOB) {
insertRow.setNextColumn(doClob((Clob) object));
} else if (type == Types.BLOB) {
insertRow.setNextColumn(doBlob((Blob) object));
} else if (type == Types.VARBINARY) {
insertRow.setNextColumn(doVarBinary((byte[]) object));
} else {
insertRow.setNextColumn(object);
}
}
rowSet.add(insertRow.getRow());
}
results.add(Const.ID_RESULT_SET, null, rowSet);
return true;
}
private boolean getUpdateCount(final Statement statement) throws SQLException {
final int updateCount = statement.getUpdateCount();
final boolean isUpdateCount = (updateCount != -1);
if (isUpdateCount) {
results.add(Const.UPDATE_COUNT_TYPE, null, Integer.toString(updateCount));
}
return isUpdateCount;
}
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
private RowSetMetaData getMetaData(final ResultSet resultSet) throws SQLException {
final ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
final int columnCount = resultSetMetaData.getColumnCount();
final ColumnMetaData[] columns = new ColumnMetaData[columnCount];
for (int i = 1; (i <= columnCount); ++i) {
final String name = resultSetMetaData.getColumnName(i);
final int type = resultSetMetaData.getColumnType(i);
columns[i - 1] = new ColumnMetaData(name, type);
}
return new RowSetMetaData(Const.RESULT_SET_TYPE, columns);
}
private Object doClob(final Clob clob) throws SQLException, IOException {
final String string = ReaderU.read(clob.getCharacterStream());
return doBytes(UTF8Codec.toBytes(string), Const.CLOB);
}
private Object doBlob(final Blob blob) throws SQLException, IOException {
final byte[] bytes = StreamU.read(blob.getBinaryStream()); // pull blob back from server
return doBytes(bytes, Const.BLOB);
}
private Object doVarBinary(final byte[] bytes) throws SQLException, IOException {
return doBytes(bytes, Const.VARBINARY);
}
private Object doBytes(final byte[] bytes, final String sqlType) throws SQLException, IOException {
// cache blob locally
final String resource = Http.Token.SLASH + Long.toHexString(CRCU.crc32(bytes));
cacheBlob.putFile(resource, new MetaFile(null, null, new ByteArrayInputStream(bytes)));
// insert link into result set
final String title = String.format("%s [%sB]", sqlType, NumberScale.toString(bytes.length));
final String href = cacheBlob.getEndpoint() + resource;
return new TableViewLink(UTF16.DOCUMENT_BRACKETS, title, href);
}
private static class Const {
private static final String ID_RESULT_SET = "resultSet"; // i18n internal
private static final String RESULT_SET_TYPE = "jdbcResultSetType"; // i18n internal
private static final String UPDATE_COUNT_TYPE = "jdbcUpdateCountType"; // i18n internal
private static final String BLOB = "BLOB"; // i18n internal
private static final String CLOB = "CLOB"; // i18n internal
private static final String VARBINARY = "VARBINARY"; // i18n internal
}
}
|
greyp9/arwo
|
src/main/core/java/io/github/greyp9/arwo/core/jdbc/op/JDBCQuery.java
|
Java
|
apache-2.0
| 6,742
|
package ru.job4j.tasksortdeparament;
import java.util.Comparator;
public class ComporatorLengtch implements Comparator<String> {
public int compare(String o1, String o2) {
int res;
if (o1.length() > o2.length()) {
res = 1;
} else if (o1.length() == o2.length()) {
res = 0;
} else {
res = -1;
}
return res;
}
}
|
ogneyar79/Sirotkin_M
|
chapter_002/src/main/java/ru/job4j/tasksortdeparament/ComporatorLengtch.java
|
Java
|
apache-2.0
| 410
|
#include <aplicacion/include/GestorRelaciones.h>
// aplicacion
#include <aplicacion/include/IAdministradorAplicacion.h>
using namespace visualizador::aplicacion;
using namespace visualizador;
GestorRelaciones::GestorRelaciones()
{
this->admin_app = IAdministradorAplicacion::getInstanciaAdminEntidades();
}
GestorRelaciones::~GestorRelaciones()
{
}
// VINCULACIONES
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesConcepto * relaciones_concepto, herramientas::utiles::ID * id_concepto)
{
std::vector<herramientas::utiles::ID*> ids_terminos = relaciones_concepto->getRelacionConTerminos()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_terminos.begin(); it != ids_terminos.end(); it++)
{
modelo::relaciones::RelacionesTermino relaciones_termino((*it)->copia());
if (this->admin_app->recuperar(&relaciones_termino))
{
relaciones_termino.agregarRelacionConConcepto(id_concepto);
this->admin_app->modificar(&relaciones_termino);
}
}
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_concepto->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.agregarRelacionConConcepto(id_concepto);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesConsulta * relaciones_consulta, herramientas::utiles::ID * id_consulta)
{
std::vector<herramientas::utiles::ID*> ids_conceptos = relaciones_consulta->getRelacionConConceptos()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_conceptos.begin(); it != ids_conceptos.end(); it++)
{
modelo::relaciones::RelacionesConcepto relaciones_concepto((*it)->copia());
if (this->admin_app->recuperar(&relaciones_concepto))
{
relaciones_concepto.agregarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_concepto);
}
}
std::vector<herramientas::utiles::ID*> ids_medios_twitter = relaciones_consulta->getRelacionConMediosTwitter()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_medios_twitter.begin(); it != ids_medios_twitter.end(); it++)
{
modelo::relaciones::RelacionesMedio relaciones_medio((*it)->copia());
if (this->admin_app->recuperar(&relaciones_medio))
{
relaciones_medio.agregarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_medio);
}
}
std::vector<herramientas::utiles::ID*> ids_secciones = relaciones_consulta->getRelacionConSecciones()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_secciones.begin(); it != ids_secciones.end(); it++)
{
modelo::relaciones::RelacionesSeccion relaciones_seccion((*it)->copia());
if (this->admin_app->recuperar(&relaciones_seccion))
{
relaciones_seccion.agregarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_seccion);
}
}
herramientas::utiles::ID id_reporte(relaciones_consulta->getRelacionConReporte());
modelo::relaciones::RelacionesReporte relaciones_reporte(id_reporte.copia());
if (this->admin_app->recuperar(&relaciones_reporte))
{
relaciones_reporte.agregarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_reporte);
}
herramientas::utiles::ID id_periodo(relaciones_consulta->getRelacionConPeriodo());
modelo::relaciones::RelacionesPeriodo relaciones_periodo(id_periodo.copia());
if (this->admin_app->recuperar(&relaciones_periodo))
{
relaciones_periodo.agregarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_periodo);
}
return true;
}
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesPeriodo * relaciones_periodo, herramientas::utiles::ID * id_periodo)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_periodo->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.setRelacionConPeriodo(id_periodo->numero());
this->admin_app->modificar(&relaciones_consulta);
}
}
herramientas::utiles::ID id_fecha_desde(relaciones_periodo->getRelacionConFechaDesde());
modelo::relaciones::RelacionesFecha relaciones_fecha_desde(id_fecha_desde.copia());
if (this->admin_app->recuperar(&relaciones_fecha_desde))
{
relaciones_fecha_desde.agregarRelacionConPeriodo(id_periodo);
this->admin_app->modificar(&relaciones_fecha_desde);
}
herramientas::utiles::ID id_fecha_hasta(relaciones_periodo->getRelacionConFechaHasta());
modelo::relaciones::RelacionesFecha relaciones_fecha_hasta(id_fecha_hasta.copia());
if (this->admin_app->recuperar(&relaciones_fecha_hasta))
{
relaciones_fecha_hasta.agregarRelacionConPeriodo(id_periodo);
this->admin_app->modificar(&relaciones_fecha_hasta);
}
return true;
}
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesFecha * relaciones_fecha, herramientas::utiles::ID * id_fecha)
{
return true;
}
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesReporte * relaciones_reporte, herramientas::utiles::ID * id_reporte)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_reporte->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.setRelacionConReporte(id_reporte->numero());
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesSeccion * relaciones_seccion, herramientas::utiles::ID * id_seccion)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_seccion->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.agregarRelacionConSeccion(id_seccion);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::vincular(modelo::relaciones::RelacionesTermino * relaciones_termino, herramientas::utiles::ID * id_termino)
{
std::vector<herramientas::utiles::ID*> ids_conceptos = relaciones_termino->getRelacionConConceptos()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_conceptos.begin(); it != ids_conceptos.end(); it++)
{
modelo::relaciones::RelacionesConcepto relaciones_concepto((*it)->copia());
if (this->admin_app->recuperar(&relaciones_concepto))
{
relaciones_concepto.agregarRelacionConTermino(id_termino);
this->admin_app->modificar(&relaciones_concepto);
}
}
return true;
}
bool GestorRelaciones::vincularMedioTwitter(modelo::relaciones::RelacionesMedio * relaciones_medio, herramientas::utiles::ID * id_medio)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_medio->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.agregarRelacionConMedioTwitter(id_medio);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::vincularMedioFacebook(modelo::relaciones::RelacionesMedio * relaciones_medio, herramientas::utiles::ID * id_medio)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_medio->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.agregarRelacionConMedioFacebook(id_medio);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::vincularMedioPortalNoticias(modelo::relaciones::RelacionesMedio * relaciones_medio, herramientas::utiles::ID * id_medio)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_medio->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.agregarRelacionConMedioPortalNoticias(id_medio);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
// DESVINCULACIONES
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesConcepto * relaciones_concepto, herramientas::utiles::ID * id_concepto)
{
std::vector<herramientas::utiles::ID*> ids_terminos = relaciones_concepto->getRelacionConTerminos()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_terminos.begin(); it != ids_terminos.end(); it++)
{
modelo::relaciones::RelacionesTermino relaciones_termino((*it)->copia());
if (this->admin_app->recuperar(&relaciones_termino))
{
relaciones_termino.eliminarRelacionConConcepto(id_concepto);
this->admin_app->modificar(&relaciones_termino);
}
}
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_concepto->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.eliminarRelacionConConcepto(id_concepto);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesConsulta * relaciones_consulta, herramientas::utiles::ID * id_consulta)
{
std::vector<herramientas::utiles::ID*> ids_conceptos = relaciones_consulta->getRelacionConConceptos()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_conceptos.begin(); it != ids_conceptos.end(); it++)
{
modelo::relaciones::RelacionesConcepto relaciones_concepto((*it)->copia());
if (this->admin_app->recuperar(&relaciones_concepto))
{
relaciones_concepto.eliminarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_concepto);
}
}
std::vector<herramientas::utiles::ID*> ids_medios = relaciones_consulta->getRelacionConMediosTwitter()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_medios.begin(); it != ids_medios.end(); it++)
{
modelo::relaciones::RelacionesMedio relaciones_medio((*it)->copia());
if (this->admin_app->recuperar(&relaciones_medio))
{
relaciones_medio.eliminarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_medio);
}
}
std::vector<herramientas::utiles::ID*> ids_secciones = relaciones_consulta->getRelacionConSecciones()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_secciones.begin(); it != ids_secciones.end(); it++)
{
modelo::relaciones::RelacionesSeccion relaciones_seccion((*it)->copia());
if (this->admin_app->recuperar(&relaciones_seccion))
{
relaciones_seccion.eliminarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_seccion);
}
}
herramientas::utiles::ID id_reporte(relaciones_consulta->getRelacionConReporte());
modelo::relaciones::RelacionesReporte relaciones_reporte(id_reporte.copia());
if (this->admin_app->recuperar(&relaciones_reporte))
{
relaciones_reporte.eliminarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_reporte);
}
herramientas::utiles::ID id_periodo(relaciones_consulta->getRelacionConPeriodo());
modelo::relaciones::RelacionesPeriodo relaciones_periodo(id_periodo.copia());
if (this->admin_app->recuperar(&relaciones_periodo))
{
relaciones_periodo.eliminarRelacionConConsulta(id_consulta);
this->admin_app->modificar(&relaciones_periodo);
}
return true;
}
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesFecha * relaciones_fecha, herramientas::utiles::ID * id_fecha)
{
return false;
}
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesPeriodo * relaciones_periodo, herramientas::utiles::ID * id_periodo)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_periodo->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.setRelacionConPeriodo(0);
this->admin_app->modificar(&relaciones_consulta);
}
}
herramientas::utiles::ID id_fecha_desde(relaciones_periodo->getRelacionConFechaDesde());
modelo::relaciones::RelacionesFecha relaciones_fecha_desde(id_fecha_desde.copia());
if (this->admin_app->recuperar(&relaciones_fecha_desde))
{
relaciones_fecha_desde.eliminarRelacionConPeriodo(id_periodo);
this->admin_app->modificar(&relaciones_fecha_desde);
}
herramientas::utiles::ID id_fecha_hasta(relaciones_periodo->getRelacionConFechaHasta());
modelo::relaciones::RelacionesFecha relaciones_fecha_hasta(id_fecha_hasta.copia());
if (this->admin_app->recuperar(&relaciones_fecha_hasta))
{
relaciones_fecha_hasta.eliminarRelacionConPeriodo(id_periodo);
this->admin_app->modificar(&relaciones_fecha_hasta);
}
return true;
}
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesReporte * relaciones_reporte, herramientas::utiles::ID * id_reporte)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_reporte->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.setRelacionConReporte(0);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesSeccion * relaciones_seccion, herramientas::utiles::ID * id_seccion)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_seccion->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.eliminarRelacionConSeccion(id_seccion);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::desvincular(modelo::relaciones::RelacionesTermino * relaciones_termino, herramientas::utiles::ID * id_termino)
{
std::vector<herramientas::utiles::ID*> ids_conceptos = relaciones_termino->getRelacionConConceptos()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_conceptos.begin(); it != ids_conceptos.end(); it++)
{
modelo::relaciones::RelacionesConcepto relaciones_concepto((*it)->copia());
if (this->admin_app->recuperar(&relaciones_concepto))
{
relaciones_concepto.eliminarRelacionConTermino(id_termino);
this->admin_app->modificar(&relaciones_concepto);
}
}
return true;
}
bool GestorRelaciones::desvincularMedioTwitter(modelo::relaciones::RelacionesMedio * relaciones_medio, herramientas::utiles::ID * id_medio)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_medio->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.eliminarRelacionConMedioTwitter(id_medio);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::desvincularMedioFacebook(modelo::relaciones::RelacionesMedio * relaciones_medio, herramientas::utiles::ID * id_medio)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_medio->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.eliminarRelacionConMedioFacebook(id_medio);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
bool GestorRelaciones::desvincularMedioPortalNoticias(modelo::relaciones::RelacionesMedio * relaciones_medio, herramientas::utiles::ID * id_medio)
{
std::vector<herramientas::utiles::ID*> ids_consultas = relaciones_medio->getRelacionConConsultas()->getIdsGrupo();
for (std::vector<herramientas::utiles::ID*>::iterator it = ids_consultas.begin(); it != ids_consultas.end(); it++)
{
modelo::relaciones::RelacionesConsulta relaciones_consulta((*it)->copia());
if (this->admin_app->recuperar(&relaciones_consulta))
{
relaciones_consulta.eliminarRelacionConMedioPortalNoticias(id_medio);
this->admin_app->modificar(&relaciones_consulta);
}
}
return true;
}
|
miglesias91/visualizador-de-contextos
|
aplicacion/source/GestorRelaciones.cpp
|
C++
|
apache-2.0
| 20,309
|
public class Subject {
private String name;
private int unit;
private int score;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getUnit() {
return unit;
}
public void setUnit(int unit) {
this.unit = unit;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
}
|
frank29259/java
|
Object/GPA_AUTO/src/Subject.java
|
Java
|
apache-2.0
| 479
|
/***************************************************************************//**
* @file
* @brief EFM32LG_TIMER register and bit field definitions
*******************************************************************************
* # License
* <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/
#if defined(__ICCARM__)
#pragma system_include /* Treat file as system include file. */
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header /* Treat file as system include file. */
#endif
/***************************************************************************//**
* @addtogroup Parts
* @{
******************************************************************************/
/***************************************************************************//**
* @defgroup EFM32LG_TIMER
* @{
* @brief EFM32LG_TIMER Register Declaration
******************************************************************************/
typedef struct {
__IOM uint32_t CTRL; /**< Control Register */
__IOM uint32_t CMD; /**< Command Register */
__IM uint32_t STATUS; /**< Status Register */
__IOM uint32_t IEN; /**< Interrupt Enable Register */
__IM uint32_t IF; /**< Interrupt Flag Register */
__IOM uint32_t IFS; /**< Interrupt Flag Set Register */
__IOM uint32_t IFC; /**< Interrupt Flag Clear Register */
__IOM uint32_t TOP; /**< Counter Top Value Register */
__IOM uint32_t TOPB; /**< Counter Top Value Buffer Register */
__IOM uint32_t CNT; /**< Counter Value Register */
__IOM uint32_t ROUTE; /**< I/O Routing Register */
uint32_t RESERVED0[1U]; /**< Reserved registers */
TIMER_CC_TypeDef CC[3U]; /**< Compare/Capture Channel */
uint32_t RESERVED1[4U]; /**< Reserved for future use **/
__IOM uint32_t DTCTRL; /**< DTI Control Register */
__IOM uint32_t DTTIME; /**< DTI Time Control Register */
__IOM uint32_t DTFC; /**< DTI Fault Configuration Register */
__IOM uint32_t DTOGEN; /**< DTI Output Generation Enable Register */
__IM uint32_t DTFAULT; /**< DTI Fault Register */
__OM uint32_t DTFAULTC; /**< DTI Fault Clear Register */
__IOM uint32_t DTLOCK; /**< DTI Configuration Lock Register */
} TIMER_TypeDef; /**< TIMER Register Declaration *//** @} */
/***************************************************************************//**
* @defgroup EFM32LG_TIMER_BitFields
* @{
******************************************************************************/
/* Bit fields for TIMER CTRL */
#define _TIMER_CTRL_RESETVALUE 0x00000000UL /**< Default value for TIMER_CTRL */
#define _TIMER_CTRL_MASK 0x3F032FFBUL /**< Mask for TIMER_CTRL */
#define _TIMER_CTRL_MODE_SHIFT 0 /**< Shift value for TIMER_MODE */
#define _TIMER_CTRL_MODE_MASK 0x3UL /**< Bit mask for TIMER_MODE */
#define _TIMER_CTRL_MODE_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_MODE_UP 0x00000000UL /**< Mode UP for TIMER_CTRL */
#define _TIMER_CTRL_MODE_DOWN 0x00000001UL /**< Mode DOWN for TIMER_CTRL */
#define _TIMER_CTRL_MODE_UPDOWN 0x00000002UL /**< Mode UPDOWN for TIMER_CTRL */
#define _TIMER_CTRL_MODE_QDEC 0x00000003UL /**< Mode QDEC for TIMER_CTRL */
#define TIMER_CTRL_MODE_DEFAULT (_TIMER_CTRL_MODE_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_MODE_UP (_TIMER_CTRL_MODE_UP << 0) /**< Shifted mode UP for TIMER_CTRL */
#define TIMER_CTRL_MODE_DOWN (_TIMER_CTRL_MODE_DOWN << 0) /**< Shifted mode DOWN for TIMER_CTRL */
#define TIMER_CTRL_MODE_UPDOWN (_TIMER_CTRL_MODE_UPDOWN << 0) /**< Shifted mode UPDOWN for TIMER_CTRL */
#define TIMER_CTRL_MODE_QDEC (_TIMER_CTRL_MODE_QDEC << 0) /**< Shifted mode QDEC for TIMER_CTRL */
#define TIMER_CTRL_SYNC (0x1UL << 3) /**< Timer Start/Stop/Reload Synchronization */
#define _TIMER_CTRL_SYNC_SHIFT 3 /**< Shift value for TIMER_SYNC */
#define _TIMER_CTRL_SYNC_MASK 0x8UL /**< Bit mask for TIMER_SYNC */
#define _TIMER_CTRL_SYNC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_SYNC_DEFAULT (_TIMER_CTRL_SYNC_DEFAULT << 3) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_OSMEN (0x1UL << 4) /**< One-shot Mode Enable */
#define _TIMER_CTRL_OSMEN_SHIFT 4 /**< Shift value for TIMER_OSMEN */
#define _TIMER_CTRL_OSMEN_MASK 0x10UL /**< Bit mask for TIMER_OSMEN */
#define _TIMER_CTRL_OSMEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_OSMEN_DEFAULT (_TIMER_CTRL_OSMEN_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_QDM (0x1UL << 5) /**< Quadrature Decoder Mode Selection */
#define _TIMER_CTRL_QDM_SHIFT 5 /**< Shift value for TIMER_QDM */
#define _TIMER_CTRL_QDM_MASK 0x20UL /**< Bit mask for TIMER_QDM */
#define _TIMER_CTRL_QDM_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_QDM_X2 0x00000000UL /**< Mode X2 for TIMER_CTRL */
#define _TIMER_CTRL_QDM_X4 0x00000001UL /**< Mode X4 for TIMER_CTRL */
#define TIMER_CTRL_QDM_DEFAULT (_TIMER_CTRL_QDM_DEFAULT << 5) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_QDM_X2 (_TIMER_CTRL_QDM_X2 << 5) /**< Shifted mode X2 for TIMER_CTRL */
#define TIMER_CTRL_QDM_X4 (_TIMER_CTRL_QDM_X4 << 5) /**< Shifted mode X4 for TIMER_CTRL */
#define TIMER_CTRL_DEBUGRUN (0x1UL << 6) /**< Debug Mode Run Enable */
#define _TIMER_CTRL_DEBUGRUN_SHIFT 6 /**< Shift value for TIMER_DEBUGRUN */
#define _TIMER_CTRL_DEBUGRUN_MASK 0x40UL /**< Bit mask for TIMER_DEBUGRUN */
#define _TIMER_CTRL_DEBUGRUN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_DEBUGRUN_DEFAULT (_TIMER_CTRL_DEBUGRUN_DEFAULT << 6) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_DMACLRACT (0x1UL << 7) /**< DMA Request Clear on Active */
#define _TIMER_CTRL_DMACLRACT_SHIFT 7 /**< Shift value for TIMER_DMACLRACT */
#define _TIMER_CTRL_DMACLRACT_MASK 0x80UL /**< Bit mask for TIMER_DMACLRACT */
#define _TIMER_CTRL_DMACLRACT_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_DMACLRACT_DEFAULT (_TIMER_CTRL_DMACLRACT_DEFAULT << 7) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_RISEA_SHIFT 8 /**< Shift value for TIMER_RISEA */
#define _TIMER_CTRL_RISEA_MASK 0x300UL /**< Bit mask for TIMER_RISEA */
#define _TIMER_CTRL_RISEA_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_RISEA_NONE 0x00000000UL /**< Mode NONE for TIMER_CTRL */
#define _TIMER_CTRL_RISEA_START 0x00000001UL /**< Mode START for TIMER_CTRL */
#define _TIMER_CTRL_RISEA_STOP 0x00000002UL /**< Mode STOP for TIMER_CTRL */
#define _TIMER_CTRL_RISEA_RELOADSTART 0x00000003UL /**< Mode RELOADSTART for TIMER_CTRL */
#define TIMER_CTRL_RISEA_DEFAULT (_TIMER_CTRL_RISEA_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_RISEA_NONE (_TIMER_CTRL_RISEA_NONE << 8) /**< Shifted mode NONE for TIMER_CTRL */
#define TIMER_CTRL_RISEA_START (_TIMER_CTRL_RISEA_START << 8) /**< Shifted mode START for TIMER_CTRL */
#define TIMER_CTRL_RISEA_STOP (_TIMER_CTRL_RISEA_STOP << 8) /**< Shifted mode STOP for TIMER_CTRL */
#define TIMER_CTRL_RISEA_RELOADSTART (_TIMER_CTRL_RISEA_RELOADSTART << 8) /**< Shifted mode RELOADSTART for TIMER_CTRL */
#define _TIMER_CTRL_FALLA_SHIFT 10 /**< Shift value for TIMER_FALLA */
#define _TIMER_CTRL_FALLA_MASK 0xC00UL /**< Bit mask for TIMER_FALLA */
#define _TIMER_CTRL_FALLA_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_FALLA_NONE 0x00000000UL /**< Mode NONE for TIMER_CTRL */
#define _TIMER_CTRL_FALLA_START 0x00000001UL /**< Mode START for TIMER_CTRL */
#define _TIMER_CTRL_FALLA_STOP 0x00000002UL /**< Mode STOP for TIMER_CTRL */
#define _TIMER_CTRL_FALLA_RELOADSTART 0x00000003UL /**< Mode RELOADSTART for TIMER_CTRL */
#define TIMER_CTRL_FALLA_DEFAULT (_TIMER_CTRL_FALLA_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_FALLA_NONE (_TIMER_CTRL_FALLA_NONE << 10) /**< Shifted mode NONE for TIMER_CTRL */
#define TIMER_CTRL_FALLA_START (_TIMER_CTRL_FALLA_START << 10) /**< Shifted mode START for TIMER_CTRL */
#define TIMER_CTRL_FALLA_STOP (_TIMER_CTRL_FALLA_STOP << 10) /**< Shifted mode STOP for TIMER_CTRL */
#define TIMER_CTRL_FALLA_RELOADSTART (_TIMER_CTRL_FALLA_RELOADSTART << 10) /**< Shifted mode RELOADSTART for TIMER_CTRL */
#define TIMER_CTRL_X2CNT (0x1UL << 13) /**< 2x Count Mode */
#define _TIMER_CTRL_X2CNT_SHIFT 13 /**< Shift value for TIMER_X2CNT */
#define _TIMER_CTRL_X2CNT_MASK 0x2000UL /**< Bit mask for TIMER_X2CNT */
#define _TIMER_CTRL_X2CNT_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_X2CNT_DEFAULT (_TIMER_CTRL_X2CNT_DEFAULT << 13) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_CLKSEL_SHIFT 16 /**< Shift value for TIMER_CLKSEL */
#define _TIMER_CTRL_CLKSEL_MASK 0x30000UL /**< Bit mask for TIMER_CLKSEL */
#define _TIMER_CTRL_CLKSEL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_CLKSEL_PRESCHFPERCLK 0x00000000UL /**< Mode PRESCHFPERCLK for TIMER_CTRL */
#define _TIMER_CTRL_CLKSEL_CC1 0x00000001UL /**< Mode CC1 for TIMER_CTRL */
#define _TIMER_CTRL_CLKSEL_TIMEROUF 0x00000002UL /**< Mode TIMEROUF for TIMER_CTRL */
#define TIMER_CTRL_CLKSEL_DEFAULT (_TIMER_CTRL_CLKSEL_DEFAULT << 16) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_CLKSEL_PRESCHFPERCLK (_TIMER_CTRL_CLKSEL_PRESCHFPERCLK << 16) /**< Shifted mode PRESCHFPERCLK for TIMER_CTRL */
#define TIMER_CTRL_CLKSEL_CC1 (_TIMER_CTRL_CLKSEL_CC1 << 16) /**< Shifted mode CC1 for TIMER_CTRL */
#define TIMER_CTRL_CLKSEL_TIMEROUF (_TIMER_CTRL_CLKSEL_TIMEROUF << 16) /**< Shifted mode TIMEROUF for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_SHIFT 24 /**< Shift value for TIMER_PRESC */
#define _TIMER_CTRL_PRESC_MASK 0xF000000UL /**< Bit mask for TIMER_PRESC */
#define _TIMER_CTRL_PRESC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV1 0x00000000UL /**< Mode DIV1 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV2 0x00000001UL /**< Mode DIV2 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV4 0x00000002UL /**< Mode DIV4 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV8 0x00000003UL /**< Mode DIV8 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV16 0x00000004UL /**< Mode DIV16 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV32 0x00000005UL /**< Mode DIV32 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV64 0x00000006UL /**< Mode DIV64 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV128 0x00000007UL /**< Mode DIV128 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV256 0x00000008UL /**< Mode DIV256 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV512 0x00000009UL /**< Mode DIV512 for TIMER_CTRL */
#define _TIMER_CTRL_PRESC_DIV1024 0x0000000AUL /**< Mode DIV1024 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DEFAULT (_TIMER_CTRL_PRESC_DEFAULT << 24) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV1 (_TIMER_CTRL_PRESC_DIV1 << 24) /**< Shifted mode DIV1 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV2 (_TIMER_CTRL_PRESC_DIV2 << 24) /**< Shifted mode DIV2 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV4 (_TIMER_CTRL_PRESC_DIV4 << 24) /**< Shifted mode DIV4 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV8 (_TIMER_CTRL_PRESC_DIV8 << 24) /**< Shifted mode DIV8 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV16 (_TIMER_CTRL_PRESC_DIV16 << 24) /**< Shifted mode DIV16 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV32 (_TIMER_CTRL_PRESC_DIV32 << 24) /**< Shifted mode DIV32 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV64 (_TIMER_CTRL_PRESC_DIV64 << 24) /**< Shifted mode DIV64 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV128 (_TIMER_CTRL_PRESC_DIV128 << 24) /**< Shifted mode DIV128 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV256 (_TIMER_CTRL_PRESC_DIV256 << 24) /**< Shifted mode DIV256 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV512 (_TIMER_CTRL_PRESC_DIV512 << 24) /**< Shifted mode DIV512 for TIMER_CTRL */
#define TIMER_CTRL_PRESC_DIV1024 (_TIMER_CTRL_PRESC_DIV1024 << 24) /**< Shifted mode DIV1024 for TIMER_CTRL */
#define TIMER_CTRL_ATI (0x1UL << 28) /**< Always Track Inputs */
#define _TIMER_CTRL_ATI_SHIFT 28 /**< Shift value for TIMER_ATI */
#define _TIMER_CTRL_ATI_MASK 0x10000000UL /**< Bit mask for TIMER_ATI */
#define _TIMER_CTRL_ATI_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_ATI_DEFAULT (_TIMER_CTRL_ATI_DEFAULT << 28) /**< Shifted mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_RSSCOIST (0x1UL << 29) /**< Reload-Start Sets Compare Output initial State */
#define _TIMER_CTRL_RSSCOIST_SHIFT 29 /**< Shift value for TIMER_RSSCOIST */
#define _TIMER_CTRL_RSSCOIST_MASK 0x20000000UL /**< Bit mask for TIMER_RSSCOIST */
#define _TIMER_CTRL_RSSCOIST_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CTRL */
#define TIMER_CTRL_RSSCOIST_DEFAULT (_TIMER_CTRL_RSSCOIST_DEFAULT << 29) /**< Shifted mode DEFAULT for TIMER_CTRL */
/* Bit fields for TIMER CMD */
#define _TIMER_CMD_RESETVALUE 0x00000000UL /**< Default value for TIMER_CMD */
#define _TIMER_CMD_MASK 0x00000003UL /**< Mask for TIMER_CMD */
#define TIMER_CMD_START (0x1UL << 0) /**< Start Timer */
#define _TIMER_CMD_START_SHIFT 0 /**< Shift value for TIMER_START */
#define _TIMER_CMD_START_MASK 0x1UL /**< Bit mask for TIMER_START */
#define _TIMER_CMD_START_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CMD */
#define TIMER_CMD_START_DEFAULT (_TIMER_CMD_START_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CMD */
#define TIMER_CMD_STOP (0x1UL << 1) /**< Stop Timer */
#define _TIMER_CMD_STOP_SHIFT 1 /**< Shift value for TIMER_STOP */
#define _TIMER_CMD_STOP_MASK 0x2UL /**< Bit mask for TIMER_STOP */
#define _TIMER_CMD_STOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CMD */
#define TIMER_CMD_STOP_DEFAULT (_TIMER_CMD_STOP_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_CMD */
/* Bit fields for TIMER STATUS */
#define _TIMER_STATUS_RESETVALUE 0x00000000UL /**< Default value for TIMER_STATUS */
#define _TIMER_STATUS_MASK 0x07070707UL /**< Mask for TIMER_STATUS */
#define TIMER_STATUS_RUNNING (0x1UL << 0) /**< Running */
#define _TIMER_STATUS_RUNNING_SHIFT 0 /**< Shift value for TIMER_RUNNING */
#define _TIMER_STATUS_RUNNING_MASK 0x1UL /**< Bit mask for TIMER_RUNNING */
#define _TIMER_STATUS_RUNNING_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_RUNNING_DEFAULT (_TIMER_STATUS_RUNNING_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_DIR (0x1UL << 1) /**< Direction */
#define _TIMER_STATUS_DIR_SHIFT 1 /**< Shift value for TIMER_DIR */
#define _TIMER_STATUS_DIR_MASK 0x2UL /**< Bit mask for TIMER_DIR */
#define _TIMER_STATUS_DIR_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define _TIMER_STATUS_DIR_UP 0x00000000UL /**< Mode UP for TIMER_STATUS */
#define _TIMER_STATUS_DIR_DOWN 0x00000001UL /**< Mode DOWN for TIMER_STATUS */
#define TIMER_STATUS_DIR_DEFAULT (_TIMER_STATUS_DIR_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_DIR_UP (_TIMER_STATUS_DIR_UP << 1) /**< Shifted mode UP for TIMER_STATUS */
#define TIMER_STATUS_DIR_DOWN (_TIMER_STATUS_DIR_DOWN << 1) /**< Shifted mode DOWN for TIMER_STATUS */
#define TIMER_STATUS_TOPBV (0x1UL << 2) /**< TOPB Valid */
#define _TIMER_STATUS_TOPBV_SHIFT 2 /**< Shift value for TIMER_TOPBV */
#define _TIMER_STATUS_TOPBV_MASK 0x4UL /**< Bit mask for TIMER_TOPBV */
#define _TIMER_STATUS_TOPBV_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_TOPBV_DEFAULT (_TIMER_STATUS_TOPBV_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCVBV0 (0x1UL << 8) /**< CC0 CCVB Valid */
#define _TIMER_STATUS_CCVBV0_SHIFT 8 /**< Shift value for TIMER_CCVBV0 */
#define _TIMER_STATUS_CCVBV0_MASK 0x100UL /**< Bit mask for TIMER_CCVBV0 */
#define _TIMER_STATUS_CCVBV0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCVBV0_DEFAULT (_TIMER_STATUS_CCVBV0_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCVBV1 (0x1UL << 9) /**< CC1 CCVB Valid */
#define _TIMER_STATUS_CCVBV1_SHIFT 9 /**< Shift value for TIMER_CCVBV1 */
#define _TIMER_STATUS_CCVBV1_MASK 0x200UL /**< Bit mask for TIMER_CCVBV1 */
#define _TIMER_STATUS_CCVBV1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCVBV1_DEFAULT (_TIMER_STATUS_CCVBV1_DEFAULT << 9) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCVBV2 (0x1UL << 10) /**< CC2 CCVB Valid */
#define _TIMER_STATUS_CCVBV2_SHIFT 10 /**< Shift value for TIMER_CCVBV2 */
#define _TIMER_STATUS_CCVBV2_MASK 0x400UL /**< Bit mask for TIMER_CCVBV2 */
#define _TIMER_STATUS_CCVBV2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCVBV2_DEFAULT (_TIMER_STATUS_CCVBV2_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_ICV0 (0x1UL << 16) /**< CC0 Input Capture Valid */
#define _TIMER_STATUS_ICV0_SHIFT 16 /**< Shift value for TIMER_ICV0 */
#define _TIMER_STATUS_ICV0_MASK 0x10000UL /**< Bit mask for TIMER_ICV0 */
#define _TIMER_STATUS_ICV0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_ICV0_DEFAULT (_TIMER_STATUS_ICV0_DEFAULT << 16) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_ICV1 (0x1UL << 17) /**< CC1 Input Capture Valid */
#define _TIMER_STATUS_ICV1_SHIFT 17 /**< Shift value for TIMER_ICV1 */
#define _TIMER_STATUS_ICV1_MASK 0x20000UL /**< Bit mask for TIMER_ICV1 */
#define _TIMER_STATUS_ICV1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_ICV1_DEFAULT (_TIMER_STATUS_ICV1_DEFAULT << 17) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_ICV2 (0x1UL << 18) /**< CC2 Input Capture Valid */
#define _TIMER_STATUS_ICV2_SHIFT 18 /**< Shift value for TIMER_ICV2 */
#define _TIMER_STATUS_ICV2_MASK 0x40000UL /**< Bit mask for TIMER_ICV2 */
#define _TIMER_STATUS_ICV2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_ICV2_DEFAULT (_TIMER_STATUS_ICV2_DEFAULT << 18) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCPOL0 (0x1UL << 24) /**< CC0 Polarity */
#define _TIMER_STATUS_CCPOL0_SHIFT 24 /**< Shift value for TIMER_CCPOL0 */
#define _TIMER_STATUS_CCPOL0_MASK 0x1000000UL /**< Bit mask for TIMER_CCPOL0 */
#define _TIMER_STATUS_CCPOL0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define _TIMER_STATUS_CCPOL0_LOWRISE 0x00000000UL /**< Mode LOWRISE for TIMER_STATUS */
#define _TIMER_STATUS_CCPOL0_HIGHFALL 0x00000001UL /**< Mode HIGHFALL for TIMER_STATUS */
#define TIMER_STATUS_CCPOL0_DEFAULT (_TIMER_STATUS_CCPOL0_DEFAULT << 24) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCPOL0_LOWRISE (_TIMER_STATUS_CCPOL0_LOWRISE << 24) /**< Shifted mode LOWRISE for TIMER_STATUS */
#define TIMER_STATUS_CCPOL0_HIGHFALL (_TIMER_STATUS_CCPOL0_HIGHFALL << 24) /**< Shifted mode HIGHFALL for TIMER_STATUS */
#define TIMER_STATUS_CCPOL1 (0x1UL << 25) /**< CC1 Polarity */
#define _TIMER_STATUS_CCPOL1_SHIFT 25 /**< Shift value for TIMER_CCPOL1 */
#define _TIMER_STATUS_CCPOL1_MASK 0x2000000UL /**< Bit mask for TIMER_CCPOL1 */
#define _TIMER_STATUS_CCPOL1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define _TIMER_STATUS_CCPOL1_LOWRISE 0x00000000UL /**< Mode LOWRISE for TIMER_STATUS */
#define _TIMER_STATUS_CCPOL1_HIGHFALL 0x00000001UL /**< Mode HIGHFALL for TIMER_STATUS */
#define TIMER_STATUS_CCPOL1_DEFAULT (_TIMER_STATUS_CCPOL1_DEFAULT << 25) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCPOL1_LOWRISE (_TIMER_STATUS_CCPOL1_LOWRISE << 25) /**< Shifted mode LOWRISE for TIMER_STATUS */
#define TIMER_STATUS_CCPOL1_HIGHFALL (_TIMER_STATUS_CCPOL1_HIGHFALL << 25) /**< Shifted mode HIGHFALL for TIMER_STATUS */
#define TIMER_STATUS_CCPOL2 (0x1UL << 26) /**< CC2 Polarity */
#define _TIMER_STATUS_CCPOL2_SHIFT 26 /**< Shift value for TIMER_CCPOL2 */
#define _TIMER_STATUS_CCPOL2_MASK 0x4000000UL /**< Bit mask for TIMER_CCPOL2 */
#define _TIMER_STATUS_CCPOL2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_STATUS */
#define _TIMER_STATUS_CCPOL2_LOWRISE 0x00000000UL /**< Mode LOWRISE for TIMER_STATUS */
#define _TIMER_STATUS_CCPOL2_HIGHFALL 0x00000001UL /**< Mode HIGHFALL for TIMER_STATUS */
#define TIMER_STATUS_CCPOL2_DEFAULT (_TIMER_STATUS_CCPOL2_DEFAULT << 26) /**< Shifted mode DEFAULT for TIMER_STATUS */
#define TIMER_STATUS_CCPOL2_LOWRISE (_TIMER_STATUS_CCPOL2_LOWRISE << 26) /**< Shifted mode LOWRISE for TIMER_STATUS */
#define TIMER_STATUS_CCPOL2_HIGHFALL (_TIMER_STATUS_CCPOL2_HIGHFALL << 26) /**< Shifted mode HIGHFALL for TIMER_STATUS */
/* Bit fields for TIMER IEN */
#define _TIMER_IEN_RESETVALUE 0x00000000UL /**< Default value for TIMER_IEN */
#define _TIMER_IEN_MASK 0x00000773UL /**< Mask for TIMER_IEN */
#define TIMER_IEN_OF (0x1UL << 0) /**< Overflow Interrupt Enable */
#define _TIMER_IEN_OF_SHIFT 0 /**< Shift value for TIMER_OF */
#define _TIMER_IEN_OF_MASK 0x1UL /**< Bit mask for TIMER_OF */
#define _TIMER_IEN_OF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_OF_DEFAULT (_TIMER_IEN_OF_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_UF (0x1UL << 1) /**< Underflow Interrupt Enable */
#define _TIMER_IEN_UF_SHIFT 1 /**< Shift value for TIMER_UF */
#define _TIMER_IEN_UF_MASK 0x2UL /**< Bit mask for TIMER_UF */
#define _TIMER_IEN_UF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_UF_DEFAULT (_TIMER_IEN_UF_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_CC0 (0x1UL << 4) /**< CC Channel 0 Interrupt Enable */
#define _TIMER_IEN_CC0_SHIFT 4 /**< Shift value for TIMER_CC0 */
#define _TIMER_IEN_CC0_MASK 0x10UL /**< Bit mask for TIMER_CC0 */
#define _TIMER_IEN_CC0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_CC0_DEFAULT (_TIMER_IEN_CC0_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_CC1 (0x1UL << 5) /**< CC Channel 1 Interrupt Enable */
#define _TIMER_IEN_CC1_SHIFT 5 /**< Shift value for TIMER_CC1 */
#define _TIMER_IEN_CC1_MASK 0x20UL /**< Bit mask for TIMER_CC1 */
#define _TIMER_IEN_CC1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_CC1_DEFAULT (_TIMER_IEN_CC1_DEFAULT << 5) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_CC2 (0x1UL << 6) /**< CC Channel 2 Interrupt Enable */
#define _TIMER_IEN_CC2_SHIFT 6 /**< Shift value for TIMER_CC2 */
#define _TIMER_IEN_CC2_MASK 0x40UL /**< Bit mask for TIMER_CC2 */
#define _TIMER_IEN_CC2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_CC2_DEFAULT (_TIMER_IEN_CC2_DEFAULT << 6) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_ICBOF0 (0x1UL << 8) /**< CC Channel 0 Input Capture Buffer Overflow Interrupt Enable */
#define _TIMER_IEN_ICBOF0_SHIFT 8 /**< Shift value for TIMER_ICBOF0 */
#define _TIMER_IEN_ICBOF0_MASK 0x100UL /**< Bit mask for TIMER_ICBOF0 */
#define _TIMER_IEN_ICBOF0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_ICBOF0_DEFAULT (_TIMER_IEN_ICBOF0_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_ICBOF1 (0x1UL << 9) /**< CC Channel 1 Input Capture Buffer Overflow Interrupt Enable */
#define _TIMER_IEN_ICBOF1_SHIFT 9 /**< Shift value for TIMER_ICBOF1 */
#define _TIMER_IEN_ICBOF1_MASK 0x200UL /**< Bit mask for TIMER_ICBOF1 */
#define _TIMER_IEN_ICBOF1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_ICBOF1_DEFAULT (_TIMER_IEN_ICBOF1_DEFAULT << 9) /**< Shifted mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_ICBOF2 (0x1UL << 10) /**< CC Channel 2 Input Capture Buffer Overflow Interrupt Enable */
#define _TIMER_IEN_ICBOF2_SHIFT 10 /**< Shift value for TIMER_ICBOF2 */
#define _TIMER_IEN_ICBOF2_MASK 0x400UL /**< Bit mask for TIMER_ICBOF2 */
#define _TIMER_IEN_ICBOF2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IEN */
#define TIMER_IEN_ICBOF2_DEFAULT (_TIMER_IEN_ICBOF2_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_IEN */
/* Bit fields for TIMER IF */
#define _TIMER_IF_RESETVALUE 0x00000000UL /**< Default value for TIMER_IF */
#define _TIMER_IF_MASK 0x00000773UL /**< Mask for TIMER_IF */
#define TIMER_IF_OF (0x1UL << 0) /**< Overflow Interrupt Flag */
#define _TIMER_IF_OF_SHIFT 0 /**< Shift value for TIMER_OF */
#define _TIMER_IF_OF_MASK 0x1UL /**< Bit mask for TIMER_OF */
#define _TIMER_IF_OF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_OF_DEFAULT (_TIMER_IF_OF_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_UF (0x1UL << 1) /**< Underflow Interrupt Flag */
#define _TIMER_IF_UF_SHIFT 1 /**< Shift value for TIMER_UF */
#define _TIMER_IF_UF_MASK 0x2UL /**< Bit mask for TIMER_UF */
#define _TIMER_IF_UF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_UF_DEFAULT (_TIMER_IF_UF_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_CC0 (0x1UL << 4) /**< CC Channel 0 Interrupt Flag */
#define _TIMER_IF_CC0_SHIFT 4 /**< Shift value for TIMER_CC0 */
#define _TIMER_IF_CC0_MASK 0x10UL /**< Bit mask for TIMER_CC0 */
#define _TIMER_IF_CC0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_CC0_DEFAULT (_TIMER_IF_CC0_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_CC1 (0x1UL << 5) /**< CC Channel 1 Interrupt Flag */
#define _TIMER_IF_CC1_SHIFT 5 /**< Shift value for TIMER_CC1 */
#define _TIMER_IF_CC1_MASK 0x20UL /**< Bit mask for TIMER_CC1 */
#define _TIMER_IF_CC1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_CC1_DEFAULT (_TIMER_IF_CC1_DEFAULT << 5) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_CC2 (0x1UL << 6) /**< CC Channel 2 Interrupt Flag */
#define _TIMER_IF_CC2_SHIFT 6 /**< Shift value for TIMER_CC2 */
#define _TIMER_IF_CC2_MASK 0x40UL /**< Bit mask for TIMER_CC2 */
#define _TIMER_IF_CC2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_CC2_DEFAULT (_TIMER_IF_CC2_DEFAULT << 6) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_ICBOF0 (0x1UL << 8) /**< CC Channel 0 Input Capture Buffer Overflow Interrupt Flag */
#define _TIMER_IF_ICBOF0_SHIFT 8 /**< Shift value for TIMER_ICBOF0 */
#define _TIMER_IF_ICBOF0_MASK 0x100UL /**< Bit mask for TIMER_ICBOF0 */
#define _TIMER_IF_ICBOF0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_ICBOF0_DEFAULT (_TIMER_IF_ICBOF0_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_ICBOF1 (0x1UL << 9) /**< CC Channel 1 Input Capture Buffer Overflow Interrupt Flag */
#define _TIMER_IF_ICBOF1_SHIFT 9 /**< Shift value for TIMER_ICBOF1 */
#define _TIMER_IF_ICBOF1_MASK 0x200UL /**< Bit mask for TIMER_ICBOF1 */
#define _TIMER_IF_ICBOF1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_ICBOF1_DEFAULT (_TIMER_IF_ICBOF1_DEFAULT << 9) /**< Shifted mode DEFAULT for TIMER_IF */
#define TIMER_IF_ICBOF2 (0x1UL << 10) /**< CC Channel 2 Input Capture Buffer Overflow Interrupt Flag */
#define _TIMER_IF_ICBOF2_SHIFT 10 /**< Shift value for TIMER_ICBOF2 */
#define _TIMER_IF_ICBOF2_MASK 0x400UL /**< Bit mask for TIMER_ICBOF2 */
#define _TIMER_IF_ICBOF2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IF */
#define TIMER_IF_ICBOF2_DEFAULT (_TIMER_IF_ICBOF2_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_IF */
/* Bit fields for TIMER IFS */
#define _TIMER_IFS_RESETVALUE 0x00000000UL /**< Default value for TIMER_IFS */
#define _TIMER_IFS_MASK 0x00000773UL /**< Mask for TIMER_IFS */
#define TIMER_IFS_OF (0x1UL << 0) /**< Overflow Interrupt Flag Set */
#define _TIMER_IFS_OF_SHIFT 0 /**< Shift value for TIMER_OF */
#define _TIMER_IFS_OF_MASK 0x1UL /**< Bit mask for TIMER_OF */
#define _TIMER_IFS_OF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_OF_DEFAULT (_TIMER_IFS_OF_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_UF (0x1UL << 1) /**< Underflow Interrupt Flag Set */
#define _TIMER_IFS_UF_SHIFT 1 /**< Shift value for TIMER_UF */
#define _TIMER_IFS_UF_MASK 0x2UL /**< Bit mask for TIMER_UF */
#define _TIMER_IFS_UF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_UF_DEFAULT (_TIMER_IFS_UF_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_CC0 (0x1UL << 4) /**< CC Channel 0 Interrupt Flag Set */
#define _TIMER_IFS_CC0_SHIFT 4 /**< Shift value for TIMER_CC0 */
#define _TIMER_IFS_CC0_MASK 0x10UL /**< Bit mask for TIMER_CC0 */
#define _TIMER_IFS_CC0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_CC0_DEFAULT (_TIMER_IFS_CC0_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_CC1 (0x1UL << 5) /**< CC Channel 1 Interrupt Flag Set */
#define _TIMER_IFS_CC1_SHIFT 5 /**< Shift value for TIMER_CC1 */
#define _TIMER_IFS_CC1_MASK 0x20UL /**< Bit mask for TIMER_CC1 */
#define _TIMER_IFS_CC1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_CC1_DEFAULT (_TIMER_IFS_CC1_DEFAULT << 5) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_CC2 (0x1UL << 6) /**< CC Channel 2 Interrupt Flag Set */
#define _TIMER_IFS_CC2_SHIFT 6 /**< Shift value for TIMER_CC2 */
#define _TIMER_IFS_CC2_MASK 0x40UL /**< Bit mask for TIMER_CC2 */
#define _TIMER_IFS_CC2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_CC2_DEFAULT (_TIMER_IFS_CC2_DEFAULT << 6) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_ICBOF0 (0x1UL << 8) /**< CC Channel 0 Input Capture Buffer Overflow Interrupt Flag Set */
#define _TIMER_IFS_ICBOF0_SHIFT 8 /**< Shift value for TIMER_ICBOF0 */
#define _TIMER_IFS_ICBOF0_MASK 0x100UL /**< Bit mask for TIMER_ICBOF0 */
#define _TIMER_IFS_ICBOF0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_ICBOF0_DEFAULT (_TIMER_IFS_ICBOF0_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_ICBOF1 (0x1UL << 9) /**< CC Channel 1 Input Capture Buffer Overflow Interrupt Flag Set */
#define _TIMER_IFS_ICBOF1_SHIFT 9 /**< Shift value for TIMER_ICBOF1 */
#define _TIMER_IFS_ICBOF1_MASK 0x200UL /**< Bit mask for TIMER_ICBOF1 */
#define _TIMER_IFS_ICBOF1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_ICBOF1_DEFAULT (_TIMER_IFS_ICBOF1_DEFAULT << 9) /**< Shifted mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_ICBOF2 (0x1UL << 10) /**< CC Channel 2 Input Capture Buffer Overflow Interrupt Flag Set */
#define _TIMER_IFS_ICBOF2_SHIFT 10 /**< Shift value for TIMER_ICBOF2 */
#define _TIMER_IFS_ICBOF2_MASK 0x400UL /**< Bit mask for TIMER_ICBOF2 */
#define _TIMER_IFS_ICBOF2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFS */
#define TIMER_IFS_ICBOF2_DEFAULT (_TIMER_IFS_ICBOF2_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_IFS */
/* Bit fields for TIMER IFC */
#define _TIMER_IFC_RESETVALUE 0x00000000UL /**< Default value for TIMER_IFC */
#define _TIMER_IFC_MASK 0x00000773UL /**< Mask for TIMER_IFC */
#define TIMER_IFC_OF (0x1UL << 0) /**< Overflow Interrupt Flag Clear */
#define _TIMER_IFC_OF_SHIFT 0 /**< Shift value for TIMER_OF */
#define _TIMER_IFC_OF_MASK 0x1UL /**< Bit mask for TIMER_OF */
#define _TIMER_IFC_OF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_OF_DEFAULT (_TIMER_IFC_OF_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_UF (0x1UL << 1) /**< Underflow Interrupt Flag Clear */
#define _TIMER_IFC_UF_SHIFT 1 /**< Shift value for TIMER_UF */
#define _TIMER_IFC_UF_MASK 0x2UL /**< Bit mask for TIMER_UF */
#define _TIMER_IFC_UF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_UF_DEFAULT (_TIMER_IFC_UF_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_CC0 (0x1UL << 4) /**< CC Channel 0 Interrupt Flag Clear */
#define _TIMER_IFC_CC0_SHIFT 4 /**< Shift value for TIMER_CC0 */
#define _TIMER_IFC_CC0_MASK 0x10UL /**< Bit mask for TIMER_CC0 */
#define _TIMER_IFC_CC0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_CC0_DEFAULT (_TIMER_IFC_CC0_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_CC1 (0x1UL << 5) /**< CC Channel 1 Interrupt Flag Clear */
#define _TIMER_IFC_CC1_SHIFT 5 /**< Shift value for TIMER_CC1 */
#define _TIMER_IFC_CC1_MASK 0x20UL /**< Bit mask for TIMER_CC1 */
#define _TIMER_IFC_CC1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_CC1_DEFAULT (_TIMER_IFC_CC1_DEFAULT << 5) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_CC2 (0x1UL << 6) /**< CC Channel 2 Interrupt Flag Clear */
#define _TIMER_IFC_CC2_SHIFT 6 /**< Shift value for TIMER_CC2 */
#define _TIMER_IFC_CC2_MASK 0x40UL /**< Bit mask for TIMER_CC2 */
#define _TIMER_IFC_CC2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_CC2_DEFAULT (_TIMER_IFC_CC2_DEFAULT << 6) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_ICBOF0 (0x1UL << 8) /**< CC Channel 0 Input Capture Buffer Overflow Interrupt Flag Clear */
#define _TIMER_IFC_ICBOF0_SHIFT 8 /**< Shift value for TIMER_ICBOF0 */
#define _TIMER_IFC_ICBOF0_MASK 0x100UL /**< Bit mask for TIMER_ICBOF0 */
#define _TIMER_IFC_ICBOF0_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_ICBOF0_DEFAULT (_TIMER_IFC_ICBOF0_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_ICBOF1 (0x1UL << 9) /**< CC Channel 1 Input Capture Buffer Overflow Interrupt Flag Clear */
#define _TIMER_IFC_ICBOF1_SHIFT 9 /**< Shift value for TIMER_ICBOF1 */
#define _TIMER_IFC_ICBOF1_MASK 0x200UL /**< Bit mask for TIMER_ICBOF1 */
#define _TIMER_IFC_ICBOF1_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_ICBOF1_DEFAULT (_TIMER_IFC_ICBOF1_DEFAULT << 9) /**< Shifted mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_ICBOF2 (0x1UL << 10) /**< CC Channel 2 Input Capture Buffer Overflow Interrupt Flag Clear */
#define _TIMER_IFC_ICBOF2_SHIFT 10 /**< Shift value for TIMER_ICBOF2 */
#define _TIMER_IFC_ICBOF2_MASK 0x400UL /**< Bit mask for TIMER_ICBOF2 */
#define _TIMER_IFC_ICBOF2_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_IFC */
#define TIMER_IFC_ICBOF2_DEFAULT (_TIMER_IFC_ICBOF2_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_IFC */
/* Bit fields for TIMER TOP */
#define _TIMER_TOP_RESETVALUE 0x0000FFFFUL /**< Default value for TIMER_TOP */
#define _TIMER_TOP_MASK 0x0000FFFFUL /**< Mask for TIMER_TOP */
#define _TIMER_TOP_TOP_SHIFT 0 /**< Shift value for TIMER_TOP */
#define _TIMER_TOP_TOP_MASK 0xFFFFUL /**< Bit mask for TIMER_TOP */
#define _TIMER_TOP_TOP_DEFAULT 0x0000FFFFUL /**< Mode DEFAULT for TIMER_TOP */
#define TIMER_TOP_TOP_DEFAULT (_TIMER_TOP_TOP_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_TOP */
/* Bit fields for TIMER TOPB */
#define _TIMER_TOPB_RESETVALUE 0x00000000UL /**< Default value for TIMER_TOPB */
#define _TIMER_TOPB_MASK 0x0000FFFFUL /**< Mask for TIMER_TOPB */
#define _TIMER_TOPB_TOPB_SHIFT 0 /**< Shift value for TIMER_TOPB */
#define _TIMER_TOPB_TOPB_MASK 0xFFFFUL /**< Bit mask for TIMER_TOPB */
#define _TIMER_TOPB_TOPB_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_TOPB */
#define TIMER_TOPB_TOPB_DEFAULT (_TIMER_TOPB_TOPB_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_TOPB */
/* Bit fields for TIMER CNT */
#define _TIMER_CNT_RESETVALUE 0x00000000UL /**< Default value for TIMER_CNT */
#define _TIMER_CNT_MASK 0x0000FFFFUL /**< Mask for TIMER_CNT */
#define _TIMER_CNT_CNT_SHIFT 0 /**< Shift value for TIMER_CNT */
#define _TIMER_CNT_CNT_MASK 0xFFFFUL /**< Bit mask for TIMER_CNT */
#define _TIMER_CNT_CNT_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CNT */
#define TIMER_CNT_CNT_DEFAULT (_TIMER_CNT_CNT_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CNT */
/* Bit fields for TIMER ROUTE */
#define _TIMER_ROUTE_RESETVALUE 0x00000000UL /**< Default value for TIMER_ROUTE */
#define _TIMER_ROUTE_MASK 0x00070707UL /**< Mask for TIMER_ROUTE */
#define TIMER_ROUTE_CC0PEN (0x1UL << 0) /**< CC Channel 0 Pin Enable */
#define _TIMER_ROUTE_CC0PEN_SHIFT 0 /**< Shift value for TIMER_CC0PEN */
#define _TIMER_ROUTE_CC0PEN_MASK 0x1UL /**< Bit mask for TIMER_CC0PEN */
#define _TIMER_ROUTE_CC0PEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CC0PEN_DEFAULT (_TIMER_ROUTE_CC0PEN_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CC1PEN (0x1UL << 1) /**< CC Channel 1 Pin Enable */
#define _TIMER_ROUTE_CC1PEN_SHIFT 1 /**< Shift value for TIMER_CC1PEN */
#define _TIMER_ROUTE_CC1PEN_MASK 0x2UL /**< Bit mask for TIMER_CC1PEN */
#define _TIMER_ROUTE_CC1PEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CC1PEN_DEFAULT (_TIMER_ROUTE_CC1PEN_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CC2PEN (0x1UL << 2) /**< CC Channel 2 Pin Enable */
#define _TIMER_ROUTE_CC2PEN_SHIFT 2 /**< Shift value for TIMER_CC2PEN */
#define _TIMER_ROUTE_CC2PEN_MASK 0x4UL /**< Bit mask for TIMER_CC2PEN */
#define _TIMER_ROUTE_CC2PEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CC2PEN_DEFAULT (_TIMER_ROUTE_CC2PEN_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CDTI0PEN (0x1UL << 8) /**< CC Channel 0 Complementary Dead-Time Insertion Pin Enable */
#define _TIMER_ROUTE_CDTI0PEN_SHIFT 8 /**< Shift value for TIMER_CDTI0PEN */
#define _TIMER_ROUTE_CDTI0PEN_MASK 0x100UL /**< Bit mask for TIMER_CDTI0PEN */
#define _TIMER_ROUTE_CDTI0PEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CDTI0PEN_DEFAULT (_TIMER_ROUTE_CDTI0PEN_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CDTI1PEN (0x1UL << 9) /**< CC Channel 1 Complementary Dead-Time Insertion Pin Enable */
#define _TIMER_ROUTE_CDTI1PEN_SHIFT 9 /**< Shift value for TIMER_CDTI1PEN */
#define _TIMER_ROUTE_CDTI1PEN_MASK 0x200UL /**< Bit mask for TIMER_CDTI1PEN */
#define _TIMER_ROUTE_CDTI1PEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CDTI1PEN_DEFAULT (_TIMER_ROUTE_CDTI1PEN_DEFAULT << 9) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CDTI2PEN (0x1UL << 10) /**< CC Channel 2 Complementary Dead-Time Insertion Pin Enable */
#define _TIMER_ROUTE_CDTI2PEN_SHIFT 10 /**< Shift value for TIMER_CDTI2PEN */
#define _TIMER_ROUTE_CDTI2PEN_MASK 0x400UL /**< Bit mask for TIMER_CDTI2PEN */
#define _TIMER_ROUTE_CDTI2PEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_CDTI2PEN_DEFAULT (_TIMER_ROUTE_CDTI2PEN_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_SHIFT 16 /**< Shift value for TIMER_LOCATION */
#define _TIMER_ROUTE_LOCATION_MASK 0x70000UL /**< Bit mask for TIMER_LOCATION */
#define _TIMER_ROUTE_LOCATION_LOC0 0x00000000UL /**< Mode LOC0 for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_LOC1 0x00000001UL /**< Mode LOC1 for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_LOC2 0x00000002UL /**< Mode LOC2 for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_LOC3 0x00000003UL /**< Mode LOC3 for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_LOC4 0x00000004UL /**< Mode LOC4 for TIMER_ROUTE */
#define _TIMER_ROUTE_LOCATION_LOC5 0x00000005UL /**< Mode LOC5 for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_LOC0 (_TIMER_ROUTE_LOCATION_LOC0 << 16) /**< Shifted mode LOC0 for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_DEFAULT (_TIMER_ROUTE_LOCATION_DEFAULT << 16) /**< Shifted mode DEFAULT for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_LOC1 (_TIMER_ROUTE_LOCATION_LOC1 << 16) /**< Shifted mode LOC1 for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_LOC2 (_TIMER_ROUTE_LOCATION_LOC2 << 16) /**< Shifted mode LOC2 for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_LOC3 (_TIMER_ROUTE_LOCATION_LOC3 << 16) /**< Shifted mode LOC3 for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_LOC4 (_TIMER_ROUTE_LOCATION_LOC4 << 16) /**< Shifted mode LOC4 for TIMER_ROUTE */
#define TIMER_ROUTE_LOCATION_LOC5 (_TIMER_ROUTE_LOCATION_LOC5 << 16) /**< Shifted mode LOC5 for TIMER_ROUTE */
/* Bit fields for TIMER CC_CTRL */
#define _TIMER_CC_CTRL_RESETVALUE 0x00000000UL /**< Default value for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_MASK 0x0F3F3F17UL /**< Mask for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_MODE_SHIFT 0 /**< Shift value for TIMER_MODE */
#define _TIMER_CC_CTRL_MODE_MASK 0x3UL /**< Bit mask for TIMER_MODE */
#define _TIMER_CC_CTRL_MODE_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_MODE_OFF 0x00000000UL /**< Mode OFF for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_MODE_INPUTCAPTURE 0x00000001UL /**< Mode INPUTCAPTURE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_MODE_OUTPUTCOMPARE 0x00000002UL /**< Mode OUTPUTCOMPARE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_MODE_PWM 0x00000003UL /**< Mode PWM for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_MODE_DEFAULT (_TIMER_CC_CTRL_MODE_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_MODE_OFF (_TIMER_CC_CTRL_MODE_OFF << 0) /**< Shifted mode OFF for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_MODE_INPUTCAPTURE (_TIMER_CC_CTRL_MODE_INPUTCAPTURE << 0) /**< Shifted mode INPUTCAPTURE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_MODE_OUTPUTCOMPARE (_TIMER_CC_CTRL_MODE_OUTPUTCOMPARE << 0) /**< Shifted mode OUTPUTCOMPARE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_MODE_PWM (_TIMER_CC_CTRL_MODE_PWM << 0) /**< Shifted mode PWM for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_OUTINV (0x1UL << 2) /**< Output Invert */
#define _TIMER_CC_CTRL_OUTINV_SHIFT 2 /**< Shift value for TIMER_OUTINV */
#define _TIMER_CC_CTRL_OUTINV_MASK 0x4UL /**< Bit mask for TIMER_OUTINV */
#define _TIMER_CC_CTRL_OUTINV_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_OUTINV_DEFAULT (_TIMER_CC_CTRL_OUTINV_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COIST (0x1UL << 4) /**< Compare Output Initial State */
#define _TIMER_CC_CTRL_COIST_SHIFT 4 /**< Shift value for TIMER_COIST */
#define _TIMER_CC_CTRL_COIST_MASK 0x10UL /**< Bit mask for TIMER_COIST */
#define _TIMER_CC_CTRL_COIST_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COIST_DEFAULT (_TIMER_CC_CTRL_COIST_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CMOA_SHIFT 8 /**< Shift value for TIMER_CMOA */
#define _TIMER_CC_CTRL_CMOA_MASK 0x300UL /**< Bit mask for TIMER_CMOA */
#define _TIMER_CC_CTRL_CMOA_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CMOA_NONE 0x00000000UL /**< Mode NONE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CMOA_TOGGLE 0x00000001UL /**< Mode TOGGLE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CMOA_CLEAR 0x00000002UL /**< Mode CLEAR for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CMOA_SET 0x00000003UL /**< Mode SET for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CMOA_DEFAULT (_TIMER_CC_CTRL_CMOA_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CMOA_NONE (_TIMER_CC_CTRL_CMOA_NONE << 8) /**< Shifted mode NONE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CMOA_TOGGLE (_TIMER_CC_CTRL_CMOA_TOGGLE << 8) /**< Shifted mode TOGGLE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CMOA_CLEAR (_TIMER_CC_CTRL_CMOA_CLEAR << 8) /**< Shifted mode CLEAR for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CMOA_SET (_TIMER_CC_CTRL_CMOA_SET << 8) /**< Shifted mode SET for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_COFOA_SHIFT 10 /**< Shift value for TIMER_COFOA */
#define _TIMER_CC_CTRL_COFOA_MASK 0xC00UL /**< Bit mask for TIMER_COFOA */
#define _TIMER_CC_CTRL_COFOA_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_COFOA_NONE 0x00000000UL /**< Mode NONE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_COFOA_TOGGLE 0x00000001UL /**< Mode TOGGLE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_COFOA_CLEAR 0x00000002UL /**< Mode CLEAR for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_COFOA_SET 0x00000003UL /**< Mode SET for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COFOA_DEFAULT (_TIMER_CC_CTRL_COFOA_DEFAULT << 10) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COFOA_NONE (_TIMER_CC_CTRL_COFOA_NONE << 10) /**< Shifted mode NONE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COFOA_TOGGLE (_TIMER_CC_CTRL_COFOA_TOGGLE << 10) /**< Shifted mode TOGGLE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COFOA_CLEAR (_TIMER_CC_CTRL_COFOA_CLEAR << 10) /**< Shifted mode CLEAR for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_COFOA_SET (_TIMER_CC_CTRL_COFOA_SET << 10) /**< Shifted mode SET for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CUFOA_SHIFT 12 /**< Shift value for TIMER_CUFOA */
#define _TIMER_CC_CTRL_CUFOA_MASK 0x3000UL /**< Bit mask for TIMER_CUFOA */
#define _TIMER_CC_CTRL_CUFOA_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CUFOA_NONE 0x00000000UL /**< Mode NONE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CUFOA_TOGGLE 0x00000001UL /**< Mode TOGGLE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CUFOA_CLEAR 0x00000002UL /**< Mode CLEAR for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_CUFOA_SET 0x00000003UL /**< Mode SET for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CUFOA_DEFAULT (_TIMER_CC_CTRL_CUFOA_DEFAULT << 12) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CUFOA_NONE (_TIMER_CC_CTRL_CUFOA_NONE << 12) /**< Shifted mode NONE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CUFOA_TOGGLE (_TIMER_CC_CTRL_CUFOA_TOGGLE << 12) /**< Shifted mode TOGGLE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CUFOA_CLEAR (_TIMER_CC_CTRL_CUFOA_CLEAR << 12) /**< Shifted mode CLEAR for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_CUFOA_SET (_TIMER_CC_CTRL_CUFOA_SET << 12) /**< Shifted mode SET for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_SHIFT 16 /**< Shift value for TIMER_PRSSEL */
#define _TIMER_CC_CTRL_PRSSEL_MASK 0xF0000UL /**< Bit mask for TIMER_PRSSEL */
#define _TIMER_CC_CTRL_PRSSEL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH0 0x00000000UL /**< Mode PRSCH0 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH1 0x00000001UL /**< Mode PRSCH1 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH2 0x00000002UL /**< Mode PRSCH2 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH3 0x00000003UL /**< Mode PRSCH3 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH4 0x00000004UL /**< Mode PRSCH4 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH5 0x00000005UL /**< Mode PRSCH5 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH6 0x00000006UL /**< Mode PRSCH6 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH7 0x00000007UL /**< Mode PRSCH7 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH8 0x00000008UL /**< Mode PRSCH8 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH9 0x00000009UL /**< Mode PRSCH9 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH10 0x0000000AUL /**< Mode PRSCH10 for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_PRSSEL_PRSCH11 0x0000000BUL /**< Mode PRSCH11 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_DEFAULT (_TIMER_CC_CTRL_PRSSEL_DEFAULT << 16) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH0 (_TIMER_CC_CTRL_PRSSEL_PRSCH0 << 16) /**< Shifted mode PRSCH0 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH1 (_TIMER_CC_CTRL_PRSSEL_PRSCH1 << 16) /**< Shifted mode PRSCH1 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH2 (_TIMER_CC_CTRL_PRSSEL_PRSCH2 << 16) /**< Shifted mode PRSCH2 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH3 (_TIMER_CC_CTRL_PRSSEL_PRSCH3 << 16) /**< Shifted mode PRSCH3 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH4 (_TIMER_CC_CTRL_PRSSEL_PRSCH4 << 16) /**< Shifted mode PRSCH4 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH5 (_TIMER_CC_CTRL_PRSSEL_PRSCH5 << 16) /**< Shifted mode PRSCH5 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH6 (_TIMER_CC_CTRL_PRSSEL_PRSCH6 << 16) /**< Shifted mode PRSCH6 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH7 (_TIMER_CC_CTRL_PRSSEL_PRSCH7 << 16) /**< Shifted mode PRSCH7 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH8 (_TIMER_CC_CTRL_PRSSEL_PRSCH8 << 16) /**< Shifted mode PRSCH8 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH9 (_TIMER_CC_CTRL_PRSSEL_PRSCH9 << 16) /**< Shifted mode PRSCH9 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH10 (_TIMER_CC_CTRL_PRSSEL_PRSCH10 << 16) /**< Shifted mode PRSCH10 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_PRSSEL_PRSCH11 (_TIMER_CC_CTRL_PRSSEL_PRSCH11 << 16) /**< Shifted mode PRSCH11 for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_INSEL (0x1UL << 20) /**< Input Selection */
#define _TIMER_CC_CTRL_INSEL_SHIFT 20 /**< Shift value for TIMER_INSEL */
#define _TIMER_CC_CTRL_INSEL_MASK 0x100000UL /**< Bit mask for TIMER_INSEL */
#define _TIMER_CC_CTRL_INSEL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_INSEL_PIN 0x00000000UL /**< Mode PIN for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_INSEL_PRS 0x00000001UL /**< Mode PRS for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_INSEL_DEFAULT (_TIMER_CC_CTRL_INSEL_DEFAULT << 20) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_INSEL_PIN (_TIMER_CC_CTRL_INSEL_PIN << 20) /**< Shifted mode PIN for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_INSEL_PRS (_TIMER_CC_CTRL_INSEL_PRS << 20) /**< Shifted mode PRS for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_FILT (0x1UL << 21) /**< Digital Filter */
#define _TIMER_CC_CTRL_FILT_SHIFT 21 /**< Shift value for TIMER_FILT */
#define _TIMER_CC_CTRL_FILT_MASK 0x200000UL /**< Bit mask for TIMER_FILT */
#define _TIMER_CC_CTRL_FILT_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_FILT_DISABLE 0x00000000UL /**< Mode DISABLE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_FILT_ENABLE 0x00000001UL /**< Mode ENABLE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_FILT_DEFAULT (_TIMER_CC_CTRL_FILT_DEFAULT << 21) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_FILT_DISABLE (_TIMER_CC_CTRL_FILT_DISABLE << 21) /**< Shifted mode DISABLE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_FILT_ENABLE (_TIMER_CC_CTRL_FILT_ENABLE << 21) /**< Shifted mode ENABLE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEDGE_SHIFT 24 /**< Shift value for TIMER_ICEDGE */
#define _TIMER_CC_CTRL_ICEDGE_MASK 0x3000000UL /**< Bit mask for TIMER_ICEDGE */
#define _TIMER_CC_CTRL_ICEDGE_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEDGE_RISING 0x00000000UL /**< Mode RISING for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEDGE_FALLING 0x00000001UL /**< Mode FALLING for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEDGE_BOTH 0x00000002UL /**< Mode BOTH for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEDGE_NONE 0x00000003UL /**< Mode NONE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEDGE_DEFAULT (_TIMER_CC_CTRL_ICEDGE_DEFAULT << 24) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEDGE_RISING (_TIMER_CC_CTRL_ICEDGE_RISING << 24) /**< Shifted mode RISING for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEDGE_FALLING (_TIMER_CC_CTRL_ICEDGE_FALLING << 24) /**< Shifted mode FALLING for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEDGE_BOTH (_TIMER_CC_CTRL_ICEDGE_BOTH << 24) /**< Shifted mode BOTH for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEDGE_NONE (_TIMER_CC_CTRL_ICEDGE_NONE << 24) /**< Shifted mode NONE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_SHIFT 26 /**< Shift value for TIMER_ICEVCTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_MASK 0xC000000UL /**< Bit mask for TIMER_ICEVCTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_EVERYEDGE 0x00000000UL /**< Mode EVERYEDGE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_EVERYSECONDEDGE 0x00000001UL /**< Mode EVERYSECONDEDGE for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_RISING 0x00000002UL /**< Mode RISING for TIMER_CC_CTRL */
#define _TIMER_CC_CTRL_ICEVCTRL_FALLING 0x00000003UL /**< Mode FALLING for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEVCTRL_DEFAULT (_TIMER_CC_CTRL_ICEVCTRL_DEFAULT << 26) /**< Shifted mode DEFAULT for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEVCTRL_EVERYEDGE (_TIMER_CC_CTRL_ICEVCTRL_EVERYEDGE << 26) /**< Shifted mode EVERYEDGE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEVCTRL_EVERYSECONDEDGE (_TIMER_CC_CTRL_ICEVCTRL_EVERYSECONDEDGE << 26) /**< Shifted mode EVERYSECONDEDGE for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEVCTRL_RISING (_TIMER_CC_CTRL_ICEVCTRL_RISING << 26) /**< Shifted mode RISING for TIMER_CC_CTRL */
#define TIMER_CC_CTRL_ICEVCTRL_FALLING (_TIMER_CC_CTRL_ICEVCTRL_FALLING << 26) /**< Shifted mode FALLING for TIMER_CC_CTRL */
/* Bit fields for TIMER CC_CCV */
#define _TIMER_CC_CCV_RESETVALUE 0x00000000UL /**< Default value for TIMER_CC_CCV */
#define _TIMER_CC_CCV_MASK 0x0000FFFFUL /**< Mask for TIMER_CC_CCV */
#define _TIMER_CC_CCV_CCV_SHIFT 0 /**< Shift value for TIMER_CCV */
#define _TIMER_CC_CCV_CCV_MASK 0xFFFFUL /**< Bit mask for TIMER_CCV */
#define _TIMER_CC_CCV_CCV_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CCV */
#define TIMER_CC_CCV_CCV_DEFAULT (_TIMER_CC_CCV_CCV_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CC_CCV */
/* Bit fields for TIMER CC_CCVP */
#define _TIMER_CC_CCVP_RESETVALUE 0x00000000UL /**< Default value for TIMER_CC_CCVP */
#define _TIMER_CC_CCVP_MASK 0x0000FFFFUL /**< Mask for TIMER_CC_CCVP */
#define _TIMER_CC_CCVP_CCVP_SHIFT 0 /**< Shift value for TIMER_CCVP */
#define _TIMER_CC_CCVP_CCVP_MASK 0xFFFFUL /**< Bit mask for TIMER_CCVP */
#define _TIMER_CC_CCVP_CCVP_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CCVP */
#define TIMER_CC_CCVP_CCVP_DEFAULT (_TIMER_CC_CCVP_CCVP_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CC_CCVP */
/* Bit fields for TIMER CC_CCVB */
#define _TIMER_CC_CCVB_RESETVALUE 0x00000000UL /**< Default value for TIMER_CC_CCVB */
#define _TIMER_CC_CCVB_MASK 0x0000FFFFUL /**< Mask for TIMER_CC_CCVB */
#define _TIMER_CC_CCVB_CCVB_SHIFT 0 /**< Shift value for TIMER_CCVB */
#define _TIMER_CC_CCVB_CCVB_MASK 0xFFFFUL /**< Bit mask for TIMER_CCVB */
#define _TIMER_CC_CCVB_CCVB_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_CC_CCVB */
#define TIMER_CC_CCVB_CCVB_DEFAULT (_TIMER_CC_CCVB_CCVB_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_CC_CCVB */
/* Bit fields for TIMER DTCTRL */
#define _TIMER_DTCTRL_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTCTRL */
#define _TIMER_DTCTRL_MASK 0x010000FFUL /**< Mask for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTEN (0x1UL << 0) /**< DTI Enable */
#define _TIMER_DTCTRL_DTEN_SHIFT 0 /**< Shift value for TIMER_DTEN */
#define _TIMER_DTCTRL_DTEN_MASK 0x1UL /**< Bit mask for TIMER_DTEN */
#define _TIMER_DTCTRL_DTEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTEN_DEFAULT (_TIMER_DTCTRL_DTEN_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTDAS (0x1UL << 1) /**< DTI Automatic Start-up Functionality */
#define _TIMER_DTCTRL_DTDAS_SHIFT 1 /**< Shift value for TIMER_DTDAS */
#define _TIMER_DTCTRL_DTDAS_MASK 0x2UL /**< Bit mask for TIMER_DTDAS */
#define _TIMER_DTCTRL_DTDAS_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTDAS_NORESTART 0x00000000UL /**< Mode NORESTART for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTDAS_RESTART 0x00000001UL /**< Mode RESTART for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTDAS_DEFAULT (_TIMER_DTCTRL_DTDAS_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTDAS_NORESTART (_TIMER_DTCTRL_DTDAS_NORESTART << 1) /**< Shifted mode NORESTART for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTDAS_RESTART (_TIMER_DTCTRL_DTDAS_RESTART << 1) /**< Shifted mode RESTART for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTIPOL (0x1UL << 2) /**< DTI Inactive Polarity */
#define _TIMER_DTCTRL_DTIPOL_SHIFT 2 /**< Shift value for TIMER_DTIPOL */
#define _TIMER_DTCTRL_DTIPOL_MASK 0x4UL /**< Bit mask for TIMER_DTIPOL */
#define _TIMER_DTCTRL_DTIPOL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTIPOL_DEFAULT (_TIMER_DTCTRL_DTIPOL_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTCINV (0x1UL << 3) /**< DTI Complementary Output Invert. */
#define _TIMER_DTCTRL_DTCINV_SHIFT 3 /**< Shift value for TIMER_DTCINV */
#define _TIMER_DTCTRL_DTCINV_MASK 0x8UL /**< Bit mask for TIMER_DTCINV */
#define _TIMER_DTCTRL_DTCINV_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTCINV_DEFAULT (_TIMER_DTCTRL_DTCINV_DEFAULT << 3) /**< Shifted mode DEFAULT for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_SHIFT 4 /**< Shift value for TIMER_DTPRSSEL */
#define _TIMER_DTCTRL_DTPRSSEL_MASK 0xF0UL /**< Bit mask for TIMER_DTPRSSEL */
#define _TIMER_DTCTRL_DTPRSSEL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH0 0x00000000UL /**< Mode PRSCH0 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH1 0x00000001UL /**< Mode PRSCH1 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH2 0x00000002UL /**< Mode PRSCH2 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH3 0x00000003UL /**< Mode PRSCH3 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH4 0x00000004UL /**< Mode PRSCH4 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH5 0x00000005UL /**< Mode PRSCH5 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH6 0x00000006UL /**< Mode PRSCH6 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH7 0x00000007UL /**< Mode PRSCH7 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH8 0x00000008UL /**< Mode PRSCH8 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH9 0x00000009UL /**< Mode PRSCH9 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH10 0x0000000AUL /**< Mode PRSCH10 for TIMER_DTCTRL */
#define _TIMER_DTCTRL_DTPRSSEL_PRSCH11 0x0000000BUL /**< Mode PRSCH11 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_DEFAULT (_TIMER_DTCTRL_DTPRSSEL_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH0 (_TIMER_DTCTRL_DTPRSSEL_PRSCH0 << 4) /**< Shifted mode PRSCH0 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH1 (_TIMER_DTCTRL_DTPRSSEL_PRSCH1 << 4) /**< Shifted mode PRSCH1 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH2 (_TIMER_DTCTRL_DTPRSSEL_PRSCH2 << 4) /**< Shifted mode PRSCH2 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH3 (_TIMER_DTCTRL_DTPRSSEL_PRSCH3 << 4) /**< Shifted mode PRSCH3 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH4 (_TIMER_DTCTRL_DTPRSSEL_PRSCH4 << 4) /**< Shifted mode PRSCH4 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH5 (_TIMER_DTCTRL_DTPRSSEL_PRSCH5 << 4) /**< Shifted mode PRSCH5 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH6 (_TIMER_DTCTRL_DTPRSSEL_PRSCH6 << 4) /**< Shifted mode PRSCH6 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH7 (_TIMER_DTCTRL_DTPRSSEL_PRSCH7 << 4) /**< Shifted mode PRSCH7 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH8 (_TIMER_DTCTRL_DTPRSSEL_PRSCH8 << 4) /**< Shifted mode PRSCH8 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH9 (_TIMER_DTCTRL_DTPRSSEL_PRSCH9 << 4) /**< Shifted mode PRSCH9 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH10 (_TIMER_DTCTRL_DTPRSSEL_PRSCH10 << 4) /**< Shifted mode PRSCH10 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSSEL_PRSCH11 (_TIMER_DTCTRL_DTPRSSEL_PRSCH11 << 4) /**< Shifted mode PRSCH11 for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSEN (0x1UL << 24) /**< DTI PRS Source Enable */
#define _TIMER_DTCTRL_DTPRSEN_SHIFT 24 /**< Shift value for TIMER_DTPRSEN */
#define _TIMER_DTCTRL_DTPRSEN_MASK 0x1000000UL /**< Bit mask for TIMER_DTPRSEN */
#define _TIMER_DTCTRL_DTPRSEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTCTRL */
#define TIMER_DTCTRL_DTPRSEN_DEFAULT (_TIMER_DTCTRL_DTPRSEN_DEFAULT << 24) /**< Shifted mode DEFAULT for TIMER_DTCTRL */
/* Bit fields for TIMER DTTIME */
#define _TIMER_DTTIME_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTTIME */
#define _TIMER_DTTIME_MASK 0x003F3F0FUL /**< Mask for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_SHIFT 0 /**< Shift value for TIMER_DTPRESC */
#define _TIMER_DTTIME_DTPRESC_MASK 0xFUL /**< Bit mask for TIMER_DTPRESC */
#define _TIMER_DTTIME_DTPRESC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV1 0x00000000UL /**< Mode DIV1 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV2 0x00000001UL /**< Mode DIV2 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV4 0x00000002UL /**< Mode DIV4 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV8 0x00000003UL /**< Mode DIV8 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV16 0x00000004UL /**< Mode DIV16 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV32 0x00000005UL /**< Mode DIV32 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV64 0x00000006UL /**< Mode DIV64 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV128 0x00000007UL /**< Mode DIV128 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV256 0x00000008UL /**< Mode DIV256 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV512 0x00000009UL /**< Mode DIV512 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTPRESC_DIV1024 0x0000000AUL /**< Mode DIV1024 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DEFAULT (_TIMER_DTTIME_DTPRESC_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV1 (_TIMER_DTTIME_DTPRESC_DIV1 << 0) /**< Shifted mode DIV1 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV2 (_TIMER_DTTIME_DTPRESC_DIV2 << 0) /**< Shifted mode DIV2 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV4 (_TIMER_DTTIME_DTPRESC_DIV4 << 0) /**< Shifted mode DIV4 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV8 (_TIMER_DTTIME_DTPRESC_DIV8 << 0) /**< Shifted mode DIV8 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV16 (_TIMER_DTTIME_DTPRESC_DIV16 << 0) /**< Shifted mode DIV16 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV32 (_TIMER_DTTIME_DTPRESC_DIV32 << 0) /**< Shifted mode DIV32 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV64 (_TIMER_DTTIME_DTPRESC_DIV64 << 0) /**< Shifted mode DIV64 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV128 (_TIMER_DTTIME_DTPRESC_DIV128 << 0) /**< Shifted mode DIV128 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV256 (_TIMER_DTTIME_DTPRESC_DIV256 << 0) /**< Shifted mode DIV256 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV512 (_TIMER_DTTIME_DTPRESC_DIV512 << 0) /**< Shifted mode DIV512 for TIMER_DTTIME */
#define TIMER_DTTIME_DTPRESC_DIV1024 (_TIMER_DTTIME_DTPRESC_DIV1024 << 0) /**< Shifted mode DIV1024 for TIMER_DTTIME */
#define _TIMER_DTTIME_DTRISET_SHIFT 8 /**< Shift value for TIMER_DTRISET */
#define _TIMER_DTTIME_DTRISET_MASK 0x3F00UL /**< Bit mask for TIMER_DTRISET */
#define _TIMER_DTTIME_DTRISET_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTTIME */
#define TIMER_DTTIME_DTRISET_DEFAULT (_TIMER_DTTIME_DTRISET_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_DTTIME */
#define _TIMER_DTTIME_DTFALLT_SHIFT 16 /**< Shift value for TIMER_DTFALLT */
#define _TIMER_DTTIME_DTFALLT_MASK 0x3F0000UL /**< Bit mask for TIMER_DTFALLT */
#define _TIMER_DTTIME_DTFALLT_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTTIME */
#define TIMER_DTTIME_DTFALLT_DEFAULT (_TIMER_DTTIME_DTFALLT_DEFAULT << 16) /**< Shifted mode DEFAULT for TIMER_DTTIME */
/* Bit fields for TIMER DTFC */
#define _TIMER_DTFC_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTFC */
#define _TIMER_DTFC_MASK 0x0F030707UL /**< Mask for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_SHIFT 0 /**< Shift value for TIMER_DTPRS0FSEL */
#define _TIMER_DTFC_DTPRS0FSEL_MASK 0x7UL /**< Bit mask for TIMER_DTPRS0FSEL */
#define _TIMER_DTFC_DTPRS0FSEL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH0 0x00000000UL /**< Mode PRSCH0 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH1 0x00000001UL /**< Mode PRSCH1 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH2 0x00000002UL /**< Mode PRSCH2 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH3 0x00000003UL /**< Mode PRSCH3 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH4 0x00000004UL /**< Mode PRSCH4 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH5 0x00000005UL /**< Mode PRSCH5 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH6 0x00000006UL /**< Mode PRSCH6 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS0FSEL_PRSCH7 0x00000007UL /**< Mode PRSCH7 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_DEFAULT (_TIMER_DTFC_DTPRS0FSEL_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH0 (_TIMER_DTFC_DTPRS0FSEL_PRSCH0 << 0) /**< Shifted mode PRSCH0 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH1 (_TIMER_DTFC_DTPRS0FSEL_PRSCH1 << 0) /**< Shifted mode PRSCH1 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH2 (_TIMER_DTFC_DTPRS0FSEL_PRSCH2 << 0) /**< Shifted mode PRSCH2 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH3 (_TIMER_DTFC_DTPRS0FSEL_PRSCH3 << 0) /**< Shifted mode PRSCH3 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH4 (_TIMER_DTFC_DTPRS0FSEL_PRSCH4 << 0) /**< Shifted mode PRSCH4 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH5 (_TIMER_DTFC_DTPRS0FSEL_PRSCH5 << 0) /**< Shifted mode PRSCH5 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH6 (_TIMER_DTFC_DTPRS0FSEL_PRSCH6 << 0) /**< Shifted mode PRSCH6 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FSEL_PRSCH7 (_TIMER_DTFC_DTPRS0FSEL_PRSCH7 << 0) /**< Shifted mode PRSCH7 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_SHIFT 8 /**< Shift value for TIMER_DTPRS1FSEL */
#define _TIMER_DTFC_DTPRS1FSEL_MASK 0x700UL /**< Bit mask for TIMER_DTPRS1FSEL */
#define _TIMER_DTFC_DTPRS1FSEL_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH0 0x00000000UL /**< Mode PRSCH0 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH1 0x00000001UL /**< Mode PRSCH1 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH2 0x00000002UL /**< Mode PRSCH2 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH3 0x00000003UL /**< Mode PRSCH3 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH4 0x00000004UL /**< Mode PRSCH4 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH5 0x00000005UL /**< Mode PRSCH5 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH6 0x00000006UL /**< Mode PRSCH6 for TIMER_DTFC */
#define _TIMER_DTFC_DTPRS1FSEL_PRSCH7 0x00000007UL /**< Mode PRSCH7 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_DEFAULT (_TIMER_DTFC_DTPRS1FSEL_DEFAULT << 8) /**< Shifted mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH0 (_TIMER_DTFC_DTPRS1FSEL_PRSCH0 << 8) /**< Shifted mode PRSCH0 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH1 (_TIMER_DTFC_DTPRS1FSEL_PRSCH1 << 8) /**< Shifted mode PRSCH1 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH2 (_TIMER_DTFC_DTPRS1FSEL_PRSCH2 << 8) /**< Shifted mode PRSCH2 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH3 (_TIMER_DTFC_DTPRS1FSEL_PRSCH3 << 8) /**< Shifted mode PRSCH3 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH4 (_TIMER_DTFC_DTPRS1FSEL_PRSCH4 << 8) /**< Shifted mode PRSCH4 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH5 (_TIMER_DTFC_DTPRS1FSEL_PRSCH5 << 8) /**< Shifted mode PRSCH5 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH6 (_TIMER_DTFC_DTPRS1FSEL_PRSCH6 << 8) /**< Shifted mode PRSCH6 for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FSEL_PRSCH7 (_TIMER_DTFC_DTPRS1FSEL_PRSCH7 << 8) /**< Shifted mode PRSCH7 for TIMER_DTFC */
#define _TIMER_DTFC_DTFA_SHIFT 16 /**< Shift value for TIMER_DTFA */
#define _TIMER_DTFC_DTFA_MASK 0x30000UL /**< Bit mask for TIMER_DTFA */
#define _TIMER_DTFC_DTFA_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define _TIMER_DTFC_DTFA_NONE 0x00000000UL /**< Mode NONE for TIMER_DTFC */
#define _TIMER_DTFC_DTFA_INACTIVE 0x00000001UL /**< Mode INACTIVE for TIMER_DTFC */
#define _TIMER_DTFC_DTFA_CLEAR 0x00000002UL /**< Mode CLEAR for TIMER_DTFC */
#define _TIMER_DTFC_DTFA_TRISTATE 0x00000003UL /**< Mode TRISTATE for TIMER_DTFC */
#define TIMER_DTFC_DTFA_DEFAULT (_TIMER_DTFC_DTFA_DEFAULT << 16) /**< Shifted mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTFA_NONE (_TIMER_DTFC_DTFA_NONE << 16) /**< Shifted mode NONE for TIMER_DTFC */
#define TIMER_DTFC_DTFA_INACTIVE (_TIMER_DTFC_DTFA_INACTIVE << 16) /**< Shifted mode INACTIVE for TIMER_DTFC */
#define TIMER_DTFC_DTFA_CLEAR (_TIMER_DTFC_DTFA_CLEAR << 16) /**< Shifted mode CLEAR for TIMER_DTFC */
#define TIMER_DTFC_DTFA_TRISTATE (_TIMER_DTFC_DTFA_TRISTATE << 16) /**< Shifted mode TRISTATE for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FEN (0x1UL << 24) /**< DTI PRS 0 Fault Enable */
#define _TIMER_DTFC_DTPRS0FEN_SHIFT 24 /**< Shift value for TIMER_DTPRS0FEN */
#define _TIMER_DTFC_DTPRS0FEN_MASK 0x1000000UL /**< Bit mask for TIMER_DTPRS0FEN */
#define _TIMER_DTFC_DTPRS0FEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTPRS0FEN_DEFAULT (_TIMER_DTFC_DTPRS0FEN_DEFAULT << 24) /**< Shifted mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FEN (0x1UL << 25) /**< DTI PRS 1 Fault Enable */
#define _TIMER_DTFC_DTPRS1FEN_SHIFT 25 /**< Shift value for TIMER_DTPRS1FEN */
#define _TIMER_DTFC_DTPRS1FEN_MASK 0x2000000UL /**< Bit mask for TIMER_DTPRS1FEN */
#define _TIMER_DTFC_DTPRS1FEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTPRS1FEN_DEFAULT (_TIMER_DTFC_DTPRS1FEN_DEFAULT << 25) /**< Shifted mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTDBGFEN (0x1UL << 26) /**< DTI Debugger Fault Enable */
#define _TIMER_DTFC_DTDBGFEN_SHIFT 26 /**< Shift value for TIMER_DTDBGFEN */
#define _TIMER_DTFC_DTDBGFEN_MASK 0x4000000UL /**< Bit mask for TIMER_DTDBGFEN */
#define _TIMER_DTFC_DTDBGFEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTDBGFEN_DEFAULT (_TIMER_DTFC_DTDBGFEN_DEFAULT << 26) /**< Shifted mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTLOCKUPFEN (0x1UL << 27) /**< DTI Lockup Fault Enable */
#define _TIMER_DTFC_DTLOCKUPFEN_SHIFT 27 /**< Shift value for TIMER_DTLOCKUPFEN */
#define _TIMER_DTFC_DTLOCKUPFEN_MASK 0x8000000UL /**< Bit mask for TIMER_DTLOCKUPFEN */
#define _TIMER_DTFC_DTLOCKUPFEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFC */
#define TIMER_DTFC_DTLOCKUPFEN_DEFAULT (_TIMER_DTFC_DTLOCKUPFEN_DEFAULT << 27) /**< Shifted mode DEFAULT for TIMER_DTFC */
/* Bit fields for TIMER DTOGEN */
#define _TIMER_DTOGEN_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTOGEN */
#define _TIMER_DTOGEN_MASK 0x0000003FUL /**< Mask for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCC0EN (0x1UL << 0) /**< DTI CC0 Output Generation Enable */
#define _TIMER_DTOGEN_DTOGCC0EN_SHIFT 0 /**< Shift value for TIMER_DTOGCC0EN */
#define _TIMER_DTOGEN_DTOGCC0EN_MASK 0x1UL /**< Bit mask for TIMER_DTOGCC0EN */
#define _TIMER_DTOGEN_DTOGCC0EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCC0EN_DEFAULT (_TIMER_DTOGEN_DTOGCC0EN_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCC1EN (0x1UL << 1) /**< DTI CC1 Output Generation Enable */
#define _TIMER_DTOGEN_DTOGCC1EN_SHIFT 1 /**< Shift value for TIMER_DTOGCC1EN */
#define _TIMER_DTOGEN_DTOGCC1EN_MASK 0x2UL /**< Bit mask for TIMER_DTOGCC1EN */
#define _TIMER_DTOGEN_DTOGCC1EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCC1EN_DEFAULT (_TIMER_DTOGEN_DTOGCC1EN_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCC2EN (0x1UL << 2) /**< DTI CC2 Output Generation Enable */
#define _TIMER_DTOGEN_DTOGCC2EN_SHIFT 2 /**< Shift value for TIMER_DTOGCC2EN */
#define _TIMER_DTOGEN_DTOGCC2EN_MASK 0x4UL /**< Bit mask for TIMER_DTOGCC2EN */
#define _TIMER_DTOGEN_DTOGCC2EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCC2EN_DEFAULT (_TIMER_DTOGEN_DTOGCC2EN_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCDTI0EN (0x1UL << 3) /**< DTI CDTI0 Output Generation Enable */
#define _TIMER_DTOGEN_DTOGCDTI0EN_SHIFT 3 /**< Shift value for TIMER_DTOGCDTI0EN */
#define _TIMER_DTOGEN_DTOGCDTI0EN_MASK 0x8UL /**< Bit mask for TIMER_DTOGCDTI0EN */
#define _TIMER_DTOGEN_DTOGCDTI0EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCDTI0EN_DEFAULT (_TIMER_DTOGEN_DTOGCDTI0EN_DEFAULT << 3) /**< Shifted mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCDTI1EN (0x1UL << 4) /**< DTI CDTI1 Output Generation Enable */
#define _TIMER_DTOGEN_DTOGCDTI1EN_SHIFT 4 /**< Shift value for TIMER_DTOGCDTI1EN */
#define _TIMER_DTOGEN_DTOGCDTI1EN_MASK 0x10UL /**< Bit mask for TIMER_DTOGCDTI1EN */
#define _TIMER_DTOGEN_DTOGCDTI1EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCDTI1EN_DEFAULT (_TIMER_DTOGEN_DTOGCDTI1EN_DEFAULT << 4) /**< Shifted mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCDTI2EN (0x1UL << 5) /**< DTI CDTI2 Output Generation Enable */
#define _TIMER_DTOGEN_DTOGCDTI2EN_SHIFT 5 /**< Shift value for TIMER_DTOGCDTI2EN */
#define _TIMER_DTOGEN_DTOGCDTI2EN_MASK 0x20UL /**< Bit mask for TIMER_DTOGCDTI2EN */
#define _TIMER_DTOGEN_DTOGCDTI2EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTOGEN */
#define TIMER_DTOGEN_DTOGCDTI2EN_DEFAULT (_TIMER_DTOGEN_DTOGCDTI2EN_DEFAULT << 5) /**< Shifted mode DEFAULT for TIMER_DTOGEN */
/* Bit fields for TIMER DTFAULT */
#define _TIMER_DTFAULT_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTFAULT */
#define _TIMER_DTFAULT_MASK 0x0000000FUL /**< Mask for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTPRS0F (0x1UL << 0) /**< DTI PRS 0 Fault */
#define _TIMER_DTFAULT_DTPRS0F_SHIFT 0 /**< Shift value for TIMER_DTPRS0F */
#define _TIMER_DTFAULT_DTPRS0F_MASK 0x1UL /**< Bit mask for TIMER_DTPRS0F */
#define _TIMER_DTFAULT_DTPRS0F_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTPRS0F_DEFAULT (_TIMER_DTFAULT_DTPRS0F_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTPRS1F (0x1UL << 1) /**< DTI PRS 1 Fault */
#define _TIMER_DTFAULT_DTPRS1F_SHIFT 1 /**< Shift value for TIMER_DTPRS1F */
#define _TIMER_DTFAULT_DTPRS1F_MASK 0x2UL /**< Bit mask for TIMER_DTPRS1F */
#define _TIMER_DTFAULT_DTPRS1F_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTPRS1F_DEFAULT (_TIMER_DTFAULT_DTPRS1F_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTDBGF (0x1UL << 2) /**< DTI Debugger Fault */
#define _TIMER_DTFAULT_DTDBGF_SHIFT 2 /**< Shift value for TIMER_DTDBGF */
#define _TIMER_DTFAULT_DTDBGF_MASK 0x4UL /**< Bit mask for TIMER_DTDBGF */
#define _TIMER_DTFAULT_DTDBGF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTDBGF_DEFAULT (_TIMER_DTFAULT_DTDBGF_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTLOCKUPF (0x1UL << 3) /**< DTI Lockup Fault */
#define _TIMER_DTFAULT_DTLOCKUPF_SHIFT 3 /**< Shift value for TIMER_DTLOCKUPF */
#define _TIMER_DTFAULT_DTLOCKUPF_MASK 0x8UL /**< Bit mask for TIMER_DTLOCKUPF */
#define _TIMER_DTFAULT_DTLOCKUPF_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULT */
#define TIMER_DTFAULT_DTLOCKUPF_DEFAULT (_TIMER_DTFAULT_DTLOCKUPF_DEFAULT << 3) /**< Shifted mode DEFAULT for TIMER_DTFAULT */
/* Bit fields for TIMER DTFAULTC */
#define _TIMER_DTFAULTC_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTFAULTC */
#define _TIMER_DTFAULTC_MASK 0x0000000FUL /**< Mask for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_DTPRS0FC (0x1UL << 0) /**< DTI PRS0 Fault Clear */
#define _TIMER_DTFAULTC_DTPRS0FC_SHIFT 0 /**< Shift value for TIMER_DTPRS0FC */
#define _TIMER_DTFAULTC_DTPRS0FC_MASK 0x1UL /**< Bit mask for TIMER_DTPRS0FC */
#define _TIMER_DTFAULTC_DTPRS0FC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_DTPRS0FC_DEFAULT (_TIMER_DTFAULTC_DTPRS0FC_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_DTPRS1FC (0x1UL << 1) /**< DTI PRS1 Fault Clear */
#define _TIMER_DTFAULTC_DTPRS1FC_SHIFT 1 /**< Shift value for TIMER_DTPRS1FC */
#define _TIMER_DTFAULTC_DTPRS1FC_MASK 0x2UL /**< Bit mask for TIMER_DTPRS1FC */
#define _TIMER_DTFAULTC_DTPRS1FC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_DTPRS1FC_DEFAULT (_TIMER_DTFAULTC_DTPRS1FC_DEFAULT << 1) /**< Shifted mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_DTDBGFC (0x1UL << 2) /**< DTI Debugger Fault Clear */
#define _TIMER_DTFAULTC_DTDBGFC_SHIFT 2 /**< Shift value for TIMER_DTDBGFC */
#define _TIMER_DTFAULTC_DTDBGFC_MASK 0x4UL /**< Bit mask for TIMER_DTDBGFC */
#define _TIMER_DTFAULTC_DTDBGFC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_DTDBGFC_DEFAULT (_TIMER_DTFAULTC_DTDBGFC_DEFAULT << 2) /**< Shifted mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_TLOCKUPFC (0x1UL << 3) /**< DTI Lockup Fault Clear */
#define _TIMER_DTFAULTC_TLOCKUPFC_SHIFT 3 /**< Shift value for TIMER_TLOCKUPFC */
#define _TIMER_DTFAULTC_TLOCKUPFC_MASK 0x8UL /**< Bit mask for TIMER_TLOCKUPFC */
#define _TIMER_DTFAULTC_TLOCKUPFC_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTFAULTC */
#define TIMER_DTFAULTC_TLOCKUPFC_DEFAULT (_TIMER_DTFAULTC_TLOCKUPFC_DEFAULT << 3) /**< Shifted mode DEFAULT for TIMER_DTFAULTC */
/* Bit fields for TIMER DTLOCK */
#define _TIMER_DTLOCK_RESETVALUE 0x00000000UL /**< Default value for TIMER_DTLOCK */
#define _TIMER_DTLOCK_MASK 0x0000FFFFUL /**< Mask for TIMER_DTLOCK */
#define _TIMER_DTLOCK_LOCKKEY_SHIFT 0 /**< Shift value for TIMER_LOCKKEY */
#define _TIMER_DTLOCK_LOCKKEY_MASK 0xFFFFUL /**< Bit mask for TIMER_LOCKKEY */
#define _TIMER_DTLOCK_LOCKKEY_DEFAULT 0x00000000UL /**< Mode DEFAULT for TIMER_DTLOCK */
#define _TIMER_DTLOCK_LOCKKEY_LOCK 0x00000000UL /**< Mode LOCK for TIMER_DTLOCK */
#define _TIMER_DTLOCK_LOCKKEY_UNLOCKED 0x00000000UL /**< Mode UNLOCKED for TIMER_DTLOCK */
#define _TIMER_DTLOCK_LOCKKEY_LOCKED 0x00000001UL /**< Mode LOCKED for TIMER_DTLOCK */
#define _TIMER_DTLOCK_LOCKKEY_UNLOCK 0x0000CE80UL /**< Mode UNLOCK for TIMER_DTLOCK */
#define TIMER_DTLOCK_LOCKKEY_DEFAULT (_TIMER_DTLOCK_LOCKKEY_DEFAULT << 0) /**< Shifted mode DEFAULT for TIMER_DTLOCK */
#define TIMER_DTLOCK_LOCKKEY_LOCK (_TIMER_DTLOCK_LOCKKEY_LOCK << 0) /**< Shifted mode LOCK for TIMER_DTLOCK */
#define TIMER_DTLOCK_LOCKKEY_UNLOCKED (_TIMER_DTLOCK_LOCKKEY_UNLOCKED << 0) /**< Shifted mode UNLOCKED for TIMER_DTLOCK */
#define TIMER_DTLOCK_LOCKKEY_LOCKED (_TIMER_DTLOCK_LOCKKEY_LOCKED << 0) /**< Shifted mode LOCKED for TIMER_DTLOCK */
#define TIMER_DTLOCK_LOCKKEY_UNLOCK (_TIMER_DTLOCK_LOCKKEY_UNLOCK << 0) /**< Shifted mode UNLOCK for TIMER_DTLOCK */
/** @} End of group EFM32LG_TIMER */
/** @} End of group Parts */
|
kjbracey-arm/mbed
|
targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32LG/device/efm32lg_timer.h
|
C
|
apache-2.0
| 113,910
|
var data_cost = []; //Kosten
function createHistoryCostChart(){
var margin = {top: 60, right: 20, bottom: 120, left: 200},
width = 1160 - margin.right,
height = 500 - margin.top - margin.bottom;
var x,y,z,xAxis,yAxis,area_pos,area_neg,chart;
// chart Kosten
x = d3.scaleTime().range([0, width]);
y = d3.scaleLinear().range([height, 0]);
z = d3.scaleOrdinal(d3.schemeCategory10);
area_pos = d3.area()
.x(function(d) { return x(d.x); })
.y0(y(0))
.y1(function(d) { return y(d.y); });
area_neg = d3.area()
.x(function(d) { return x(d.x); })
.y1(y(0))
.y0(function(d) { return y(d.y); });
chart = d3.select("#cost").append("p").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
xAxis = chart.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(x.axis = d3.axisBottom(x).tickFormat(multiFormat));
yAxis = chart.append("g")
.attr("class", "y axis")
.call(y.axis = d3.axisLeft(y));
var svg = chart.select(function() {
return this.parentNode;
});
svg.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 150)
.attr("x",-210)
.style("text-anchor", "middle")
.text("ct");
if(building_id&&start_date&&end_date) requestCostData(building_id,start_date,end_date,x,y,z,xAxis,yAxis,area_pos,area_neg,chart);
}
function sortByDateAscending(a, b) {
return a.x - b.x;
}
function requestCostData(building, start_time, end_time, x, y, z, xAxis, yAxis, area_pos, area_neg, chart) {
$.getJSON(rest_url+"/rest/getdata/"+building+"/"+start_time+"/"+end_time, function(result) {
data_cost = [];
for (var i = 0; i < result.length; i++) {
var dataJSON = JSON.parse(result[i]);
var currentTime = new Date(dataJSON.currentTime.date.year, dataJSON.currentTime.date.month - 1,
dataJSON.currentTime.date.day, dataJSON.currentTime.time.hour, dataJSON.currentTime.time.minute,
dataJSON.currentTime.time.second, 0);
var cost = 0;
var production_el = 0;
// producers
for (var p1 in dataJSON.producers) {
if (!dataJSON.producers.hasOwnProperty(p1)) continue;
var obj_p = dataJSON.producers[p1];
production_el += obj_p.power_el;
cost += obj_p.cost;
}
for (var s in dataJSON.storages) {
if (!dataJSON.storages.hasOwnProperty(s)) continue;
var obj_s = dataJSON.storages[s];
if (obj_s.name === "Batterie") {
production_el += obj_s.p_out;
}
}
// Strom aus dem Netz / in das Netz
cost += 30*(1/(60*60))*(dataJSON.consumption.electrical - production_el);
data_cost.push({x: currentTime, y: cost*(-1)});
}
data_cost = data_cost.sort(sortByDateAscending);
var data_pos = [];
var data_neg = [];
// copy array
for (var j = 0; j < data_cost.length ; j++) {
data_pos[j] = {};
data_neg[j] = {};
for (var prop in data_cost[j]) {
if (!data_cost[j].hasOwnProperty(prop)) continue;
data_pos[j][prop] = data_cost[j][prop];
data_neg[j][prop] = data_cost[j][prop];
}
}
data_pos.forEach(function(currentValue, index) {
if (currentValue.y < 0) {
data_pos[index].y = 0;
}
});
data_neg.forEach(function(currentValue, index) {
if (currentValue.y > 0) {
data_neg[index].y = 0;
}
});
var min_y = d3.min(data_cost, function(d) { return d.y })*1.3 > 0 ? 0 : d3.min(data_cost, function(d) { return d.y })*1.3;
var max_y = d3.max(data_cost, function(d) { return d.y })*1.3 < 0 ? 0 : d3.max(data_cost, function(d) { return d.y })*1.3;
y.domain([min_y, max_y]);
x.domain(d3.extent(data_cost, function(d) { return d.x; }));
chart.append("path")
.datum(data_pos)
.attr("class", "area")
.attr("opacity", 1)
.style("fill", 'green')
.style("stroke", 'green')
.attr("d", area_pos.y0(y(0)));
chart.append("path")
.datum(data_neg)
.attr("class", "area")
.attr("opacity", 1)
.style("fill", 'red')
.style("stroke", 'red')
.attr("d", area_neg.y1(y(0)));
xAxis.call(x.axis);
yAxis.call(y.axis);
var svg = chart.select(function() {
return this.parentNode;
});
var mean = svg.append('g')
.attr('class', 'mean')
.attr('transform', 'translate(' + (1160/2 + 150) + ',450)');
var mean_cost = d3.format(".2f")(d3.sum(data_cost, function (d) { return d.y; })/100);
var text_color = mean_cost >= 0 ? 'green' : 'red';
mean.append('text')
.style("text-anchor", "middle")
.text("Gesamtkosten:");
mean.append('text')
.attr('y', 30)
.style("text-anchor", "middle")
.style("stroke", text_color)
.style("fill", text_color)
.text(mean_cost + "€");
});
}
|
SES-fortiss/SmartGridCoSimulation
|
javascript/memapScenarioFortiss/memap_d3/js/charts/history_cost_chart.js
|
JavaScript
|
apache-2.0
| 5,644
|
import os
from jenkins_jobs import cmd
from tests.base import mock
from tests.cmd.test_cmd import CmdTestsBase
@mock.patch('jenkins_jobs.builder.Jenkins.get_plugins_info', mock.MagicMock)
class DeleteTests(CmdTestsBase):
@mock.patch('jenkins_jobs.cmd.Builder.delete_job')
def test_delete_single_job(self, delete_job_mock):
"""
Test handling the deletion of a single Jenkins job.
"""
args = self.parser.parse_args(['delete', 'test_job'])
cmd.execute(args, self.config) # passes if executed without error
@mock.patch('jenkins_jobs.cmd.Builder.delete_job')
def test_delete_multiple_jobs(self, delete_job_mock):
"""
Test handling the deletion of multiple Jenkins jobs.
"""
args = self.parser.parse_args(['delete', 'test_job1', 'test_job2'])
cmd.execute(args, self.config) # passes if executed without error
@mock.patch('jenkins_jobs.builder.Jenkins.delete_job')
def test_delete_using_glob_params(self, delete_job_mock):
"""
Test handling the deletion of multiple Jenkins jobs using the glob
parameters feature.
"""
args = self.parser.parse_args(['delete',
'--path',
os.path.join(self.fixtures_path,
'cmd-002.yaml'),
'*bar*'])
cmd.execute(args, self.config)
calls = [mock.call('bar001'), mock.call('bar002')]
delete_job_mock.assert_has_calls(calls, any_order=True)
self.assertEqual(delete_job_mock.call_count, len(calls),
"Jenkins.delete_job() was called '%s' times when "
"expected '%s'" % (delete_job_mock.call_count,
len(calls)))
|
lukas-bednar/jenkins-job-builder
|
tests/cmd/subcommands/test_delete.py
|
Python
|
apache-2.0
| 1,878
|
// Copyright 2017 Esri.
//
// 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.
using Esri.ArcGISRuntime.Mapping;
using System;
namespace ArcGISRuntime.WPF.Samples.SceneLayerUrl
{
public partial class SceneLayerUrl
{
public SceneLayerUrl()
{
InitializeComponent();
// Execute initialization
Initialize();
}
private void Initialize()
{
// Create new Scene
Scene myScene = new Scene();
// Set Scene's base map property
myScene.Basemap = Basemap.CreateImagery();
// Create uri to the scene layer
var serviceUri = new Uri(
"https://scene.arcgis.com/arcgis/rest/services/Hosted/Buildings_Brest/SceneServer/0");
// Create new scene layer from the url
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(serviceUri);
// Add created layer to the operational layers collection
myScene.OperationalLayers.Add(sceneLayer);
// Create a camera with coordinates showing layer data
Camera camera = new Camera(48.378, -4.494, 200, 345, 65, 0);
// Assign the Scene to the SceneView
MySceneView.Scene = myScene;
// Set view point of scene view using camera
MySceneView.SetViewpointCameraAsync(camera);
}
}
}
|
Arc3D/arcgis-runtime-samples-dotnet
|
src/WPF/ArcGISRuntime.WPF.Samples/Samples/Layers/SceneLayerUrl/SceneLayerUrl.xaml.cs
|
C#
|
apache-2.0
| 1,895
|
#include <iostream>
int main()
{
std::cout << "Hello World 1 !\n";
std::cout << "Hello World 2 !\n";
return 0;
}
|
csulisti/HelloWorld
|
hello.cpp
|
C++
|
apache-2.0
| 117
|
#
# 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 os
import mock
from pecan.testing import load_test_app
from tuskar.db.sqlalchemy import models as db_models
from tuskar.tests import base
URL_ROLES = '/v1/overcloud_roles'
class OvercloudRolesTests(base.TestCase):
def setUp(self):
super(OvercloudRolesTests, self).setUp()
config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'..', '..', '..', '..', 'api', 'config.py')
self.app = load_test_app(config_file)
@mock.patch('tuskar.db.sqlalchemy.api.Connection.get_overcloud_roles')
def test_get_all(self, mock_db_get):
# Setup
fake_results = [db_models.OvercloudRole(name='foo')]
mock_db_get.return_value = fake_results
# Test
response = self.app.get(URL_ROLES)
result = response.json
# Verify
self.assertEqual(response.status_int, 200)
self.assertTrue(isinstance(result, list))
self.assertEqual(1, len(result))
self.assertEqual(result[0]['name'], 'foo')
mock_db_get.assert_called_once()
@mock.patch('tuskar.db.sqlalchemy.api.'
'Connection.get_overcloud_role_by_id')
def test_get_one(self, mock_db_get):
# Setup
fake_result = db_models.OvercloudRole(name='foo')
mock_db_get.return_value = fake_result
# Test
url = URL_ROLES + '/' + '12345'
response = self.app.get(url)
result = response.json
# Verify
self.assertEqual(response.status_int, 200)
self.assertEqual(result['name'], 'foo')
mock_db_get.assert_called_once_with(12345)
@mock.patch('tuskar.db.sqlalchemy.api.Connection.create_overcloud_role')
def test_post(self, mock_db_create):
# Setup
create_me = {'name': 'new'}
fake_created = db_models.OvercloudRole(name='created')
mock_db_create.return_value = fake_created
# Test
response = self.app.post_json(URL_ROLES, params=create_me)
result = response.json
# Verify
self.assertEqual(response.status_int, 201)
self.assertEqual(result['name'], fake_created.name)
self.assertEqual(1, mock_db_create.call_count)
db_create_model = mock_db_create.call_args[0][0]
self.assertTrue(isinstance(db_create_model,
db_models.OvercloudRole))
self.assertEqual(db_create_model.name, create_me['name'])
@mock.patch('tuskar.db.sqlalchemy.api.Connection.update_overcloud_role')
def test_put(self, mock_db_update):
# Setup
changes = {'name': 'updated'}
fake_updated = db_models.OvercloudRole(name='after-update')
mock_db_update.return_value = fake_updated
# Test
url = URL_ROLES + '/' + '12345'
response = self.app.put_json(url, params=changes)
result = response.json
# Verify
self.assertEqual(response.status_int, 200)
self.assertEqual(result['name'], fake_updated.name)
self.assertEqual(1, mock_db_update.call_count)
db_update_model = mock_db_update.call_args[0][0]
self.assertTrue(isinstance(db_update_model,
db_models.OvercloudRole))
self.assertEqual(db_update_model.id, 12345)
self.assertEqual(db_update_model.name, changes['name'])
@mock.patch('tuskar.db.sqlalchemy.api.'
'Connection.delete_overcloud_role_by_id')
def test_delete(self, mock_db_delete):
# Test
url = URL_ROLES + '/' + '12345'
response = self.app.delete(url)
# Verify
self.assertEqual(response.status_int, 204)
mock_db_delete.assert_called_once_with(12345)
|
rdo-management/tuskar
|
tuskar/tests/api/controllers/v1/test_overcloud_roles.py
|
Python
|
apache-2.0
| 4,280
|
// Copyright 2019 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
//
// 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 cmd
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"github.com/GoogleCloudPlatform/config-validator/pkg/api/validator"
"github.com/GoogleCloudPlatform/terraform-validator/converters/google"
"github.com/GoogleCloudPlatform/terraform-validator/tfgcv"
"github.com/golang/protobuf/jsonpb"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"go.uber.org/zap"
)
const validateDesc = `
Validate that a terraform plan conforms to a Constraint Framework
policy library written to expect Google CAI (Cloud Asset Inventory) data.
Unsupported terraform resources (see: "terraform-validate list-supported-resources")
are skipped.
Policy violations will result in an exit code of 2.
Example:
terraform-validator validate ./example/terraform.tfplan \
--project my-project \
--ancestry organization/my-org/folder/my-folder \
--policy-path ./path/to/my/gcv/policies
`
type validateOptions struct {
project string
ancestry string
offline bool
policyPath string
outputJSON bool
dryRun bool
rootOptions *rootOptions
readPlannedAssets tfgcv.ReadPlannedAssetsFunc
validateAssets tfgcv.ValidateAssetsFunc
}
func newValidateCmd(rootOptions *rootOptions) *cobra.Command {
o := &validateOptions{
rootOptions: rootOptions,
readPlannedAssets: tfgcv.ReadPlannedAssets,
validateAssets: tfgcv.ValidateAssets,
}
cmd := &cobra.Command{
Use: "validate TFPLAN_JSON --policy-path=/path/to/policy/library",
Short: "Validate that a terraform plan conforms to Constraint Framework policies",
Long: validateDesc,
PreRunE: func(c *cobra.Command, args []string) error {
return o.validateArgs(args)
},
RunE: func(c *cobra.Command, args []string) error {
if o.dryRun {
return nil
}
return o.run(args[0])
},
}
cmd.Flags().StringVar(&o.policyPath, "policy-path", "", "Path to directory containing validation policies")
cmd.MarkFlagRequired("policy-path")
cmd.Flags().StringVar(&o.project, "project", "", "Provider project override (override the default project configuration assigned to the google terraform provider when validating resources)")
cmd.Flags().StringVar(&o.ancestry, "ancestry", "", "Override the ancestry location of the project when validating resources")
cmd.Flags().BoolVar(&o.offline, "offline", false, "Do not make network requests")
cmd.Flags().BoolVar(&o.outputJSON, "output-json", false, "Print violations as JSON")
cmd.Flags().BoolVar(&o.dryRun, "dry-run", false, "Only parse & validate args")
cmd.Flags().MarkHidden("dry-run")
return cmd
}
func (o *validateOptions) validateArgs(args []string) error {
if len(args) != 1 {
return errors.New("missing required argument TFPLAN_JSON")
}
if o.offline && o.ancestry == "" {
return errors.New("please set ancestry via --ancestry in offline mode")
}
return nil
}
func (o *validateOptions) run(plan string) error {
ctx := context.Background()
content, err := ioutil.ReadFile(plan)
if err != nil {
return fmt.Errorf("unable to read file %s", plan)
}
// if input file is not Asset, try convert
var assets []google.Asset
if err := json.Unmarshal(content, &assets); err != nil {
var err error
assets, err = o.readPlannedAssets(ctx, plan, o.project, o.ancestry, o.offline, false, o.rootOptions.errorLogger)
if err != nil {
if errors.Cause(err) == tfgcv.ErrParsingProviderProject {
return errors.New("unable to parse provider project, please use --project flag")
}
return errors.Wrap(err, "converting tfplan to CAI assets")
}
}
violations, err := o.validateAssets(ctx, assets, o.policyPath)
if err != nil {
return errors.Wrap(err, "validating")
}
if o.rootOptions.useStructuredLogging {
msg := "No violations found"
if len(violations) > 0 {
msg = "Violations found"
}
o.rootOptions.outputLogger.Info(
msg,
zap.Any("resource_body", violations),
)
if len(violations) > 0 {
return errViolations
}
return nil
}
// Legacy behavior
if len(violations) > 0 {
if o.outputJSON {
marshaller := &jsonpb.Marshaler{}
auditResult := &validator.AuditResponse{}
auditResult.Violations = violations
if err := marshaller.Marshal(os.Stdout, auditResult); err != nil {
return errors.Wrap(err, "marshalling violations to json")
}
} else {
fmt.Print("Found Violations:\n\n")
for _, v := range violations {
fmt.Printf("Constraint %v on resource %v: %v\n\n",
v.Constraint,
v.Resource,
v.Message,
)
}
}
return errViolations
}
if !o.outputJSON {
fmt.Println("No violations found.")
}
return nil
}
|
GoogleCloudPlatform/terraform-validator
|
cmd/validate.go
|
GO
|
apache-2.0
| 5,209
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/appflow/model/CustomAuthConfig.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Appflow
{
namespace Model
{
CustomAuthConfig::CustomAuthConfig() :
m_customAuthenticationTypeHasBeenSet(false),
m_authParametersHasBeenSet(false)
{
}
CustomAuthConfig::CustomAuthConfig(JsonView jsonValue) :
m_customAuthenticationTypeHasBeenSet(false),
m_authParametersHasBeenSet(false)
{
*this = jsonValue;
}
CustomAuthConfig& CustomAuthConfig::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("customAuthenticationType"))
{
m_customAuthenticationType = jsonValue.GetString("customAuthenticationType");
m_customAuthenticationTypeHasBeenSet = true;
}
if(jsonValue.ValueExists("authParameters"))
{
Array<JsonView> authParametersJsonList = jsonValue.GetArray("authParameters");
for(unsigned authParametersIndex = 0; authParametersIndex < authParametersJsonList.GetLength(); ++authParametersIndex)
{
m_authParameters.push_back(authParametersJsonList[authParametersIndex].AsObject());
}
m_authParametersHasBeenSet = true;
}
return *this;
}
JsonValue CustomAuthConfig::Jsonize() const
{
JsonValue payload;
if(m_customAuthenticationTypeHasBeenSet)
{
payload.WithString("customAuthenticationType", m_customAuthenticationType);
}
if(m_authParametersHasBeenSet)
{
Array<JsonValue> authParametersJsonList(m_authParameters.size());
for(unsigned authParametersIndex = 0; authParametersIndex < authParametersJsonList.GetLength(); ++authParametersIndex)
{
authParametersJsonList[authParametersIndex].AsObject(m_authParameters[authParametersIndex].Jsonize());
}
payload.WithArray("authParameters", std::move(authParametersJsonList));
}
return payload;
}
} // namespace Model
} // namespace Appflow
} // namespace Aws
|
aws/aws-sdk-cpp
|
aws-cpp-sdk-appflow/source/model/CustomAuthConfig.cpp
|
C++
|
apache-2.0
| 2,058
|
'use strict';
angular.module('fireUser', ['firebase','ui.router'])
.constant('FireUserDefault', {
redirectPath:'/',
dataLocation:'data',
userData:'user',
routing: false,
routeAccess: 'private',
routeRedirect: 'login'
})
.service('FireUserValues',['FireUserDefault','FireUserConfig',function (FireUserDefault,FireUserConfig) {
if(!FireUserConfig.url) throw "No config Url. Please Add your URL.";
FireUserConfig = angular.extend(FireUserDefault,FireUserConfig);
return FireUserConfig;
}])
.run(['$rootScope', '$location', '$fireUser', '$state','FireUserValues','waitForAuth',
function($rootScope, $location, $fireUser, $state, FireUserValues,waitForAuth) {
if(FireUserValues.routing){
var checked;
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
if(checked!=toState.name){
event.preventDefault();
waitForAuth.then(function() {
if(toState[FireUserValues.routeAccess] && !$rootScope[FireUserValues.dataLocation].userInfo){
$state.go(FireUserValues.routeRedirect)
}else{
checked = toState.name;
$state.go(toState.name,toParams)
};
});
} else {
// clear the flag and don't prevent the default if the state change
// was just triggered by this watch
checked = false;
}
})
};
}])
.service('$fireUser', ['$firebaseSimpleLogin', '$firebase', '$rootScope', 'FireUserValues','$log','waitForAuth',
function ($firebaseSimpleLogin, $firebase, $rootScope, FireUserValues, $log,waitforAuth) {
// create data scope
$rootScope[FireUserValues.dataLocation] = {};
$rootScope[FireUserValues.dataLocation].userLoggedIn = false;
// Possible events broadcasted by this service
this.USER_CREATED_EVENT = 'fireuser:user_created';
this.LOGIN_EVENT = 'fireuser:login';
this.LOGIN_ERROR_EVENT = 'fireuser:login_error';
this.LOGOUT_EVENT = 'fireuser:logout';
this.USER_DATA_CHANGED_EVENT = 'fireuser:data_changed';
this.USER_DATA_LOADED_EVENT = 'fireuser:data_loaded';
this.USER_CREATION_ERROR_EVENT = 'fireuser:user_creation_error';
// kickoff the authentication call (fires events $firebaseAuth:* events)
var auth = $firebaseSimpleLogin(new Firebase(FireUserValues.url), {'path': FireUserValues.redirectPath});
var self = this;
var unbind = null;
var _angularFireRef = null;
$rootScope.$on('$firebaseSimpleLogin:logout', function() {
$rootScope[FireUserValues.dataLocation].userLoggedIn = false;
$rootScope.$broadcast(self.LOGOUT_EVENT);
});
$rootScope.$on('$firebaseSimpleLogin:error', function(error) {
$rootScope.$broadcast(self.LOGIN_ERROR_EVENT,error);
$log.info('There was an error during authentication.', error);
});
$rootScope.$on('$firebaseSimpleLogin:login', function(evt, user) {
var FirebaseUrl = new Firebase(FireUserValues.url + FireUserValues.dataLocation + '/' + user.id);
var _angularFireRef = $firebase(FirebaseUrl).$asObject();
var userDataLocation = FireUserValues.dataLocation+'.'+FireUserValues.userData;
_angularFireRef.$bindTo($rootScope, userDataLocation).then(function(unb) {
unbind = unb;
});
$rootScope[FireUserValues.dataLocation].userInfo = user;
$rootScope[FireUserValues.dataLocation].userLoggedIn = true;
_angularFireRef.$loaded().then(function(data) {
$rootScope.$broadcast(self.USER_DATA_LOADED_EVENT, data);
});
_angularFireRef.$watch(function(data) {
$rootScope.$broadcast(self.USER_DATA_CHANGED_EVENT, data);
});
$rootScope.$broadcast(self.LOGIN_EVENT, user);
});
this.createUser = function createUser(user){
var createUser = auth.$createUser(user.email, user.password,false);
createUser.then(function (user) {
$rootScope.$broadcast(self.USER_CREATED_EVENT,user);
$log.info('User created - User Id: ' + user.id + ', Email: ' + user.email);
});
return createUser;
};
this.login = function(type,user) {
if(type === 'password'){
auth.$login('password',{
email: user.email,
password: user.password
}).then(function(user) {
console.log('Logged in as: ', user.uid);
}, function(error) {
console.error('Login failed: ', error);
});
} else {
auth.$login(type);
}
};
this.logout = function() {
$rootScope[FireUserValues.dataLocation].userLoggedIn = false;
unbind();
auth.$logout();
};
this.changepassword = function (email, oldPassword, newPassword,callback) {
auth.changePassword(email, oldPassword, newPassword, callback);
};
this.sendPasswordResetEmail =function ( email, callback ) {
auth.sendPasswordResetEmail(email,callback);
};
return this;
}
])
.service('waitForAuth', function($rootScope, $q, $timeout) {
function fn(err) {
if($rootScope.auth) {
$rootScope.auth.error = err instanceof Error? err.toString() : null;
}
for(var i=0; i < subs.length; i++) { subs[i](); }
$timeout(function() {
// force $scope.$apply to be re-run after login resolves
def.resolve();
});
}
var def = $q.defer(), subs = [];
subs.push($rootScope.$on('$firebaseSimpleLogin:login', fn));
subs.push($rootScope.$on('$firebaseSimpleLogin:logout', fn));
subs.push($rootScope.$on('$firebaseSimpleLogin:error', fn));
return def.promise;
})
.controller('fireuserloginCtrl',['$scope','$fireUser',function ($scope, $fireUser) {
$scope.login = function(type) {
$fireUser.login(type);
};
}])
.directive('fulogin', ['FireUserValues', function(FireUserValues) {
return {
scope:{
type:'@'
},
replace: true,
template: '<i ng-click="login(type)"></i>',
controller:'fireuserloginCtrl',
link: function ($scope,element,attr,ctrl) {
element.addClass('fa fa-'+attr.type);
},
restrict: 'AE'
};
}])
.controller('fireuserlogoutCtrl',['$scope','$fireUser',function ($scope, $fireUser) {
$scope.logout = $fireUser.logout;
}])
.directive('fulogout', [function() {
return {
scope:{
type:'@'
},
replace: true,
template: '<button ng-click="logout()">Выйти</button>',
controller:'fireuserlogoutCtrl',
restrict: 'AE'
};
}])
.controller('fireuserloginformCtrl',['$scope', '$fireUser', function ($scope, $fireUser) {
$scope.login = function () {
$fireUser.login('password',{ 'email': $scope.email, 'password': $scope.password });
};
}])
.directive('fuloginform', ['$compile', 'FireUserValues', function ($compile,FireUserValues) {
return {
scope:{
mtd:'='
},
restrict:'AE',
controller:'fireuserloginformCtrl',
link:function ($scope,element,attr,ctrl) {
element.html(
'<form id="loginForm" name="loginForm" ng-submit="login()">'+
'<input class="form-control" placeholder="e-mail" type="email" name="email" ng-model="email" required/>'+
'<input class="form-control" placeholder="пароль" type="password" name="password" ng-model="password" required/>'+
'<button id="submitBtn" class="auth-button" type="submit">»</button>'+
'<button class="auth-button" ng-click="mtd.logging=false">×</button>'+
'</form>'
);
$compile(element.contents())($scope);
}
};
}])
.controller('fireusersignupformCtrl',['$scope', '$fireUser', function ($scope, $fireUser) {
$scope.used=$scope.mtd.getPersonalUsed();
$scope.genders=[
{
title:'M',
gender:'male'
},
{
title:'Ж',
gender:'female'
}
];
$scope.mtd.userGender='male';
$scope.createUser = function () {
$fireUser.createUser({ email: $scope.email, password: $scope.password });
};
}])
.directive('fusignupform', ['$compile', 'FireUserValues', function ($compile,FireUserValues) {
return {
scope:{
mtd:'='
},
restrict:'AE',
controller:'fireusersignupformCtrl',
template:'<label ng-if="!mtd.userLetters" class="choose-color">Выберите <span ng-if="!mtd.showLetters">цвет</span><span ng-if="mtd.showLetters">буквы</span>: </label>' +
'<div letter-grid used="used" mtd="mtd" result="mtd.userLetters" class="letter-grid"></div>'+
'<form name="signupForm" ng-submit="createUser()">' +
'<input class="form-control" placeholder="Представься" type="name" name="name" ng-model="mtd.userName" required/>' +
'<select class="form-control" ng-model="mtd.userGender" name="пол" required ng-options="gender.gender as gender.title for gender in genders"></select>'+
'<input class="form-control" placeholder="e-mail" type="email" name="email" ng-model="email" required/>'+
'<input class="form-control" type="password" placeholder="пароль" name="password" ng-model="password" required/>'+
' <button ng-if="mtd.userName && mtd.userLetters && email && password" type="submit" class="auth-button" value="creatUser">»</button>'+
' <span class="error" ng-show="error">{{error}}</span>' +
'<button class="auth-button" ng-click="mtd.creating=false">×</button>' +
'</form>'
};
}])
|
fondfrukt/Feeds
|
js/side/FireUser.js
|
JavaScript
|
apache-2.0
| 9,536
|
<!-- styles -->
<?php if (isset($doc->styles) and $doc->styles) {
foreach ($doc->styles as $st_id => $st_obj) {
if ($st_obj->class == 'path') {
?>
<Style id="<?=$st_id;?>">
<LineStyle>
<color>af<?=substr($st_obj->color, 2);?></color>
<width>3</width>
</LineStyle>
</Style>
<?php
} /* end if $st_obj->class == 'path' */
if ($st_obj->icon_href) {
?>
<StyleMap id="<?=$st_id;?>">
<Pair><key>normal</key><styleUrl>#<?=$st_id;?>_normal</styleUrl></Pair>
<Pair><key>highlight</key><styleUrl>#<?=$st_id;?>_highlight</styleUrl></Pair>
</StyleMap>
<Style id="<?=$st_id;?>_normal">
<IconStyle><color><?=$st_obj->color;?></color><scale>1.0</scale>
<Icon><href><?=$st_obj->icon_href;?></href></Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LabelStyle><color><?=$st_obj->color;?></color></LabelStyle>
</Style>
<Style id="<?=$st_id;?>_highlight">
<IconStyle><color><?=$st_obj->color;?></color><scale>1.2</scale>
<Icon><href><?=$st_obj->icon_href;?></href></Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<LabelStyle><color><?=$st_obj->color;?></color></LabelStyle>
</Style>
<?php
} /* end if $st_obj->icon_href */
} /* end foreach $doc-styles */
} /* end if $doc-styles */ ?>
<!-- /styles -->
|
millsd/gswx_site
|
ci_application/views/kml/styles.kml.php
|
PHP
|
apache-2.0
| 1,331
|
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Search_Lucene
* @subpackage Index
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* A Zend_Search_Lucene_Index_DocsFilter is used to filter documents while searching.
*
* It may or _may_not_ be used for actual filtering, so it's just a hint that upper query limits
* search result by specified list.
*
* @category Zend
* @package Zend_Search_Lucene
* @subpackage Index
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Search_Lucene_Index_DocsFilter
{
/**
* Set of segment filters:
* array( <segmentName> => array(<docId> => <undefined_value>,
* <docId> => <undefined_value>,
* <docId> => <undefined_value>,
* ... ),
* <segmentName> => array(<docId> => <undefined_value>,
* <docId> => <undefined_value>,
* <docId> => <undefined_value>,
* ... ),
* <segmentName> => array(<docId> => <undefined_value>,
* <docId> => <undefined_value>,
* <docId> => <undefined_value>,
* ... ),
* ...
* )
*
* @var array
*/
public $segmentFilters = array();
}
|
ankuradhey/dealtrip
|
library/Zend/Search/Lucene/Index/DocsFilter.php
|
PHP
|
apache-2.0
| 2,253
|
/*
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate 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.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/
package io.crate;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.inject.AbstractModule;
import org.elasticsearch.monitor.jvm.JvmInfo;
public class Version {
// The logic for ID is: XXYYZZAA, where XX is major version, YY is minor version, ZZ is revision, and AA is Beta/RC indicator
// AA values below 50 are beta builds, and below 99 are RC builds, with 99 indicating a release
// the (internal) format of the id is there so we can easily do after/before checks on the id
public static final boolean SNAPSHOT = true;
public static final Version CURRENT = new Version(510099, SNAPSHOT, org.elasticsearch.Version.V_1_5_2);
static {
// safe-guard that we don't release a version with DEBUG_MODE set to true
assert CURRENT.esVersion == org.elasticsearch.Version.CURRENT : "Version must be " +
"upgraded to [" + org.elasticsearch.Version.CURRENT + "] is still set to [" +
CURRENT.esVersion + "]";
}
public final int id;
public final byte major;
public final byte minor;
public final byte revision;
public final byte build;
public final Boolean snapshot;
public final org.elasticsearch.Version esVersion;
Version(int id, @Nullable Boolean snapshot, org.elasticsearch.Version esVersion) {
this.id = id;
this.major = (byte) ((id / 1000000) % 100);
this.minor = (byte) ((id / 10000) % 100);
this.revision = (byte) ((id / 100) % 100);
this.build = (byte) (id % 100);
this.snapshot = snapshot;
this.esVersion = esVersion;
}
public boolean snapshot() {
return snapshot != null && snapshot;
}
public boolean after(Version version) {
return version.id < id;
}
public boolean before(Version version) {
return version.id > id;
}
/**
* Just the version number (without -SNAPSHOT if snapshot).
*/
public String number() {
StringBuilder sb = new StringBuilder();
sb.append(major).append('.').append(minor).append('.').append(revision);
if (build < 50) {
sb.append(".Beta").append(build);
} else if (build < 99) {
sb.append(".RC").append(build - 50);
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println("Version: " + Version.CURRENT + ", Build: " +
Build.CURRENT.hashShort() + "/" + Build.CURRENT.timestamp() +
", ES: " + org.elasticsearch.Version.CURRENT +
", JVM: " + JvmInfo.jvmInfo().version() );
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(number());
if (snapshot()) {
sb.append("-SNAPSHOT");
}
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Version version = (Version) o;
if (id != version.id) return false;
return true;
}
@Override
public int hashCode() {
return id;
}
public static class Module extends AbstractModule {
private final Version version;
public Module(Version version) {
this.version = version;
}
@Override
protected void configure() {
bind(Version.class).toInstance(version);
}
}
}
|
husky-koglhof/crate
|
core/src/main/java/io/crate/Version.java
|
Java
|
apache-2.0
| 4,535
|
/**
* Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.engine.depgraph;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.opengamma.OpenGammaRuntimeException;
/**
* Utility class for profiling the number of active objects. For development/debug use only.
*/
/* package */final class InstanceCount {
private static final ConcurrentMap<Class<?>, AtomicInteger> INSTANCE_COUNT = new ConcurrentHashMap<>();
private final AtomicInteger _count;
static {
new Thread(new Runnable() {
@Override
public void run() {
do {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
throw new OpenGammaRuntimeException("interrupted", e);
}
for (final Map.Entry<Class<?>, AtomicInteger> instance : INSTANCE_COUNT.entrySet()) {
System.out.println(instance.getKey() + "\t" + instance.getValue());
}
} while (true);
}
}).start();
}
InstanceCount(final Object owner) {
AtomicInteger count = INSTANCE_COUNT.get(owner.getClass());
if (count == null) {
count = new AtomicInteger(1);
final AtomicInteger existing = INSTANCE_COUNT.putIfAbsent(owner.getClass(), count);
if (existing != null) {
existing.incrementAndGet();
count = existing;
}
} else {
count.incrementAndGet();
}
_count = count;
}
@Override
protected void finalize() throws Throwable {
super.finalize();
_count.decrementAndGet();
}
}
|
McLeodMoores/starling
|
projects/engine/src/main/java/com/opengamma/engine/depgraph/InstanceCount.java
|
Java
|
apache-2.0
| 1,743
|
/*
* Copyright 2010-2017 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.
*/
#include <aws/elasticbeanstalk/model/DescribeConfigurationOptionsResult.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <utility>
using namespace Aws::ElasticBeanstalk::Model;
using namespace Aws::Utils::Xml;
using namespace Aws::Utils::Logging;
using namespace Aws::Utils;
using namespace Aws;
DescribeConfigurationOptionsResult::DescribeConfigurationOptionsResult()
{
}
DescribeConfigurationOptionsResult::DescribeConfigurationOptionsResult(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
*this = result;
}
DescribeConfigurationOptionsResult& DescribeConfigurationOptionsResult::operator =(const Aws::AmazonWebServiceResult<XmlDocument>& result)
{
const XmlDocument& xmlDocument = result.GetPayload();
XmlNode rootNode = xmlDocument.GetRootElement();
XmlNode resultNode = rootNode;
if (!rootNode.IsNull() && (rootNode.GetName() != "DescribeConfigurationOptionsResult"))
{
resultNode = rootNode.FirstChild("DescribeConfigurationOptionsResult");
}
if(!resultNode.IsNull())
{
XmlNode solutionStackNameNode = resultNode.FirstChild("SolutionStackName");
if(!solutionStackNameNode.IsNull())
{
m_solutionStackName = Aws::Utils::Xml::DecodeEscapedXmlText(solutionStackNameNode.GetText());
}
XmlNode platformArnNode = resultNode.FirstChild("PlatformArn");
if(!platformArnNode.IsNull())
{
m_platformArn = Aws::Utils::Xml::DecodeEscapedXmlText(platformArnNode.GetText());
}
XmlNode optionsNode = resultNode.FirstChild("Options");
if(!optionsNode.IsNull())
{
XmlNode optionsMember = optionsNode.FirstChild("member");
while(!optionsMember.IsNull())
{
m_options.push_back(optionsMember);
optionsMember = optionsMember.NextNode("member");
}
}
}
if (!rootNode.IsNull()) {
XmlNode responseMetadataNode = rootNode.FirstChild("ResponseMetadata");
m_responseMetadata = responseMetadataNode;
AWS_LOGSTREAM_DEBUG("Aws::ElasticBeanstalk::Model::DescribeConfigurationOptionsResult", "x-amzn-request-id: " << m_responseMetadata.GetRequestId() );
}
return *this;
}
|
cedral/aws-sdk-cpp
|
aws-cpp-sdk-elasticbeanstalk/source/model/DescribeConfigurationOptionsResult.cpp
|
C++
|
apache-2.0
| 2,818
|
require 'spec_helper'
require './spec/api_docs/image_hack'
resource "Users" do
let(:user) { users(:admin) }
let(:other_user) { users(:the_collaborator) }
before do
log_in user
end
get "/users" do
pagination
example_request "Get a list of users" do
status.should == 200
end
end
post "/users" do
parameter :username, "Username"
parameter :password, "Password - required unless LDAP authentication is enabled on the server"
parameter :first_name, "First Name"
parameter :last_name, "Last Name"
parameter :email, "E-mail"
parameter :title, "Title"
parameter :dept, "Department"
parameter :notes, "Notes"
parameter :admin, "Make the user an admin. (Only allowed if the authenticated user is an admin)"
required_parameters :username, :first_name, :last_name, :email
let(:username) { "cookiemonster" }
let(:first_name) { "Cookie" }
let(:last_name) { "Monster" }
let(:email) { "cookie@monster.com" }
let(:password) { "secret" }
let(:title) { "Chief Cookie Officer" }
let(:dept) { "jar" }
let(:notes) { "great" }
example_request "Create a user" do
status.should == 201
end
end
get "/users/:id" do
parameter :id, "Id of a user"
required_parameters :id
let(:id) { other_user.id }
example_request "Get a user" do
status.should == 200
end
end
put "/users/:id" do
parameter :id, "Id of a user"
parameter :first_name, "First Name"
parameter :last_name, "Last Name"
parameter :email, "E-mail"
parameter :title, "Title"
parameter :dept, "Department"
parameter :notes, "Notes"
parameter :admin, "Make the user an admin. (Only allowed if the authenticated user is an admin)"
required_parameters :id, :first_name, :last_name, :email
let(:id) { other_user.id }
let(:first_name) { "Big" }
let(:last_name) { "Bird" }
let(:email) { "cookie@monster1.com" }
let(:title) { "Cookie manager1" }
let(:dept) { "jar1" }
let(:notes) { "great1" }
let(:admin) { "true" }
example_request "Update a user's details" do
status.should == 200
end
end
delete "/users/:id" do
parameter :id, "Id of a user"
required_parameters :id
let(:id) { other_user.id }
example_request "Delete a user" do
status.should == 200
end
end
get "/users/ldap" do
parameter :username, "Username"
required_parameters :username
let(:username) { other_user.username }
before do
stub(LdapClient).search.with_any_args { [other_user.attributes] }
end
example_request "Search for an LDAP user" do
explanation "This method only works if LDAP is enabled on the server"
status.should == 200
end
end
post "/users/:user_id/image" do
parameter :user_id, "Id of a user"
parameter :files, "Image file"
required_parameters :user_id
let(:user_id) { user.to_param }
let(:files) { [Rack::Test::UploadedFile.new(File.expand_path("spec/fixtures/small2.png", Rails.root), "image/png")] }
example_request "Update a user's profile image" do
status.should == 200
end
end
get "/users/:user_id/image" do
let(:user_id) { users(:owner).to_param }
parameter :user_id, "Id of a user"
parameter :style, "Size of image ( original, icon )"
required_parameters :user_id
example_request "Get a user's profile image" do
status.should == 200
end
end
end
|
mpushpav/chorus
|
spec/api_docs/users_spec.rb
|
Ruby
|
apache-2.0
| 3,475
|
package de.imc.mirror.sdk.android.filter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.jdom2.Element;
import de.imc.mirror.sdk.DataObject;
import de.imc.mirror.sdk.android.utils.DatatypeConverter;
/**
* Restricts the period in time the data object was published.
* @author simon.schwantzer(at)im-c.de
*/
public class PeriodFilter implements de.imc.mirror.sdk.filter.PeriodFilter {
private static final DateFormat ISO8061_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
private final Date from, to;
/**
* Creates a period filter.
* @param from Specifies the earliest point in time the object was published.
* @param to Specifies the latest point in time the object was published.
*/
public PeriodFilter(Date from, Date to) {
this.from = from;
this.to = to;
}
@Override
public Element getFilterAsXML(String queryNamespace) {
Element element = new Element("period", queryNamespace);
if (from != null) {
StringBuffer dateTimeBuffer = new StringBuffer(ISO8061_FORMAT.format(from));
// fix: timezone information is not encoded correctly (+0200 instead of +02:00)
dateTimeBuffer.insert(dateTimeBuffer.length() - 2, ":");
element.setAttribute("from", dateTimeBuffer.toString());
}
if (to != null) {
// fix: timezone information is not encoded correctly (+0200 instead of +02:00)
StringBuffer dateTimeBuffer = new StringBuffer(ISO8061_FORMAT.format(to));
dateTimeBuffer.insert(dateTimeBuffer.length() - 2, ":");
element.setAttribute("to", dateTimeBuffer.toString());
}
return element;
}
@Override
public boolean isDataObjectValid(DataObject dataObject) {
String timestampValue = dataObject.getElement().getAttributeValue("timestamp");
if (timestampValue == null) {
return false;
}
Date objectTimestamp;
try {
Calendar calendar = DatatypeConverter.parseDateTime(timestampValue);
objectTimestamp = calendar.getTime();
} catch (IllegalArgumentException e) {
// Failed to parse timestamp
return false;
}
if (from != null && objectTimestamp.before(from)) {
return false;
}
if (to != null && objectTimestamp.after(to)) {
return false;
}
return true;
}
@Override
public Date getFrom() {
return from;
}
@Override
public Date getTo() {
return to;
}
@Override
public int hashCode() {
int hc = 17;
int hashMultiplier = 59;
if (from != null) {
hc = hc * hashMultiplier + from.hashCode();
} else {
hc = hc * hashMultiplier + 1;
}
if (to != null) hc = hc * hashMultiplier + to.hashCode();
return hc;
}
@Override
public boolean equals(Object obj) {
if (obj == null || !(obj instanceof PeriodFilter)) return false;
PeriodFilter that = (PeriodFilter) obj;
if (this.from != null) {
if (!this.from.equals(that.from)) return false;
} else {
if (that.from != null) return false;
}
if (this.to != null) {
if (!this.to.equals(that.to)) return false;
} else {
if (that.to != null) return false;
}
return true;
}
}
|
MirrorIP/msf-spaces-sdk-android
|
src/de/imc/mirror/sdk/android/filter/PeriodFilter.java
|
Java
|
apache-2.0
| 3,093
|
import { IPromise } from 'angular';
import React from 'react';
import { AccountService } from './AccountService';
export interface IAccountTagProps {
account: string;
className?: string;
}
export interface IAccountTagState {
isProdAccount: boolean;
}
export class AccountTag extends React.Component<IAccountTagProps, IAccountTagState> {
private static cache: {
[account: string]: boolean | IPromise<boolean>;
} = {};
public state = { isProdAccount: false };
private mounted = true;
public componentWillUnmount(): void {
this.mounted = false;
}
public componentDidMount() {
this.updateAccount(this.props.account);
}
public componentWillReceiveProps(nextProps: IAccountTagProps): void {
this.updateAccount(nextProps.account);
}
private updateAccount(account: string) {
const { cache } = AccountTag;
if (!cache.hasOwnProperty(account)) {
cache[account] = AccountService.challengeDestructiveActions(account).then(result => (cache[account] = !!result));
}
const cachedVal: boolean | IPromise<boolean> = cache[account];
if (typeof cachedVal === 'boolean') {
this.setState({ isProdAccount: cachedVal });
} else {
cachedVal.then(isProdAccount => this.mounted && this.setState({ isProdAccount }));
}
}
public render() {
const { account, className } = this.props;
const { isProdAccount } = this.state;
return (
<span className={`account-tag account-tag-${isProdAccount ? 'prod' : 'notprod'} ${className || ''}`}>
{account}
</span>
);
}
}
|
duftler/deck
|
app/scripts/modules/core/src/account/AccountTag.tsx
|
TypeScript
|
apache-2.0
| 1,571
|
/*
* 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.
*/
/* $Id$ */
package org.apache.fop.render.print;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.render.AbstractRendererMaker;
import org.apache.fop.render.PrintRendererConfigurator;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.RendererConfigurator;
/**
* RendererMaker for the Print Renderer.
*/
public class PrintRendererMaker extends AbstractRendererMaker {
private static final String[] MIMES = new String[] {MimeConstants.MIME_FOP_PRINT};
/**{@inheritDoc} */
public Renderer makeRenderer(FOUserAgent userAgent) {
return new PrintRenderer(userAgent);
}
/** {@inheritDoc} */
public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
return new PrintRendererConfigurator(userAgent);
}
/** {@inheritDoc} */
public boolean needsOutputStream() {
return false;
}
/** {@inheritDoc} */
public String[] getSupportedMimeTypes() {
return MIMES;
}
}
|
Distrotech/fop
|
src/java/org/apache/fop/render/print/PrintRendererMaker.java
|
Java
|
apache-2.0
| 1,830
|
<?php
// function to check whether given key exist in database or not
/*
$key=Key against row has to bew readed
$key_col=column of key to matach
$table=table
*/
function read_db($key,$key_col,$table)
{
include '/dbms/dbms_imp.php';
include 'core.inc.php';
$check_query="SELECT * FROM '$table' WHERE `$key_col`='$key'";
$query_run=$connection->query($check_query);
if ($query_run)
{
$query_num_rows=$query_run->num_rows;
if ($num_rows==1)
{
return true;
}
else
{
return false;
}
}
else if (!$query_run && $debug)
{
return mysqli_error($connection);
}
else
{
return false;
}
}
?>
|
web-player/resolution
|
functions/read_db.function.php
|
PHP
|
apache-2.0
| 698
|
var User = require('./User')
class Parent extends User {
constructor(
id,
first_name,
last_name,
phone,
active,
ak_access_token,
ak_user_id,
ak_token_refresh_interval_sec,
ak_token_last_renewed_timestamp,
last_login_timestamp,
created_on_timestamp,
member_since_timestamp,
profilePhotoUrl,
neighborhood,
otherNeighborhood,
kids
) {
super(
id,
first_name,
last_name,
phone,
"Parent",
active,
ak_access_token,
ak_user_id,
ak_token_refresh_interval_sec,
ak_token_last_renewed_timestamp,
last_login_timestamp,
created_on_timestamp,
member_since_timestamp,
profilePhotoUrl
)
this.neighborhood = neighborhood;
this.otherNeighborhood = otherNeighborhood;
this.kids = kids;
}
toString() {
return `
Parent\n
${super.toString()}
neighborhood\t${this.neighborhood}\n
otherNeighborhood\t${this.otherNeighborhood}\n
kids\t${this.kids}\n
`
}
}
module.exports = Parent
|
floodfx/gma-village
|
data-model/src/Parent.js
|
JavaScript
|
apache-2.0
| 1,073
|
# Copyright 2017 Google 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.
"""Tests the Compute client."""
import mock
from tests.unittest_utils import ForsetiTestCase
from google.cloud.security.common.gcp_api import _base_client
from google.cloud.security.common.gcp_api import compute
from tests.common.gcp_api.test_data import fake_firewall_rules
class ComputeTest(ForsetiTestCase):
"""Test the Compute client."""
@mock.patch.object(_base_client.BaseClient, '__init__', autospec=True)
def setUp(self, mock_base_client):
"""Set up."""
self.client = compute.ComputeClient()
def test_get_firewall_rules(self):
self.client.service = mock.MagicMock()
self.client.rate_limiter = mock.MagicMock()
self.client._build_paged_result = mock.MagicMock()
self.client._build_paged_result.return_value = (
fake_firewall_rules.PAGED_RESULTS)
firewall_rules = self.client.get_firewall_rules('aaaaa')
self.assertTrue(self.client.service.firewalls.called)
self.assertTrue(
mock.call().list(project='aaaaa')
in self.client.service.firewalls.mock_calls)
self.assertEquals(fake_firewall_rules.EXPECTED_RESULTS,
firewall_rules)
if __name__ == '__main__':
unittest.main()
|
thenenadx/forseti-security
|
tests/common/gcp_api/compute_test.py
|
Python
|
apache-2.0
| 1,822
|
package server_test
import (
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/kopia/kopia/internal/apiclient"
"github.com/kopia/kopia/internal/repotesting"
"github.com/kopia/kopia/internal/serverapi"
)
func TestCLIAPI(t *testing.T) {
ctx, env := repotesting.NewEnvironment(t, repotesting.FormatNotImportant)
srvInfo := startServer(t, env, false)
cli, err := apiclient.NewKopiaAPIClient(apiclient.Options{
BaseURL: srvInfo.BaseURL,
TrustedServerCertificateFingerprint: srvInfo.TrustedServerCertificateFingerprint,
Username: testUIUsername,
Password: testUIPassword,
})
require.NoError(t, err)
require.NoError(t, cli.FetchCSRFTokenForTesting(ctx))
resp := &serverapi.CLIInfo{}
require.NoError(t, cli.Get(ctx, "cli", nil, resp))
exe, _ := os.Executable()
require.Equal(t, exe+" --config-file="+env.ConfigFile(), resp.Executable)
}
|
kopia/kopia
|
internal/server/api_cli_test.go
|
GO
|
apache-2.0
| 959
|
/**
* Command line interface for the WordSequenceAligner
*
* Apache 2 Licence
*
* N. Hernandez 20130222
**/
package com.pwnetics.metric;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.pwnetics.metric.WordSequenceAligner;
import fr.univnantes.lina.javautil.IOUtilities;
/**
*
* @author hernandez
*
*/
public class RunWordSequenceAligner {
public static void main(String[] args) {
boolean verbose = false;
int pos = 0;
String refTextPath = "";
//String refText = "";
// list of sentences composing the ref text
List<String> refText = new ArrayList<String>();
//String hypText = "";
//String hypTextPath = "";
List<String> hypTextPathList = new ArrayList<String>();
// list hyp text made of list of sentences
List<List<String>> hypTextList = new ArrayList<List<String>>();
String wordDelimiter = " ";
// String sentenceSeparator = "\n";
Boolean forceRefAndHypAsSingleLine = false;
/*
* Getting parameters
*/
while (pos < args.length) {
if(args[pos].equals("-v")) {
verbose = true;
++pos;
System.out.println("Mode verbose");
}
else if(args[pos].equals("-r")) {
++pos;
if(verbose) System.out.println("Reference text path: "+args[pos]);
refTextPath = args[pos];
++pos;
}
else if(args[pos].equals("-h")) {
++pos;
if(verbose) System.out.println("Hypothesized text path: "+args[pos]);
//hypTextPath = args[pos];
hypTextPathList.add(args[pos]);
++pos;
}
else if(args[pos].equals("-d")) {
++pos;
if(verbose) System.out.println("Word delimiter: >"+args[pos]+"<");
wordDelimiter = args[pos];
++pos;
}
else if(args[pos].equals("--force-single-line")) {
forceRefAndHypAsSingleLine = true;
++pos;
if(verbose) System.out.println("Consider the input stream as a single line");
}
else {
usage("Wrong parameters");
}
}
if (refTextPath.equalsIgnoreCase("") || hypTextPathList.size() ==0)
usage("A reference and a hypothesis text should at least be defined");
System.out.println("");
/*
* Loading files
*/
long debut = System.currentTimeMillis();
if (forceRefAndHypAsSingleLine) {
//refText = readTheWholeTextAsASingleLine(refTextPath);
String refTextString = IOUtilities.readTextFileAsString(refTextPath);
refTextString = refTextString.replaceAll(System.getProperty("line.separator"), " ").trim();
//System.out.println("Debug: path>"+refTextPath+"< text>"+refTextString+"<");
refText.add(refTextString);
}
else
// refText = readMultiLines(refTextPath);
refText = IOUtilities.readTextFileAsStringList(refTextPath) ;
String hypTextPath ="";
//try {
// if (parseSentences)
// else
Iterator<String> hypTextPathListIterator = hypTextPathList.iterator();
while (hypTextPathListIterator.hasNext()) {
hypTextPath = hypTextPathListIterator.next();
if (forceRefAndHypAsSingleLine) {
String hypTextString = IOUtilities.readTextFileAsString(hypTextPath);
hypTextString = hypTextString.replaceAll(System.getProperty("line.separator"), " ").trim();
//System.out.println("Debug: path>"+hypTextPath+"< text>"+hypTextString+"<");
List<String> tmpList = new ArrayList<String>();
tmpList.add(hypTextString);
//List<String> tmpList = readTheWholeTextAsASingleLine(hypTextPath);
hypTextList.add(tmpList);
//System.out.println("Debug: readHypText size:"+hypTextList.size()+" .get(0):"+ tmpList.get(0));
}
else
//hypTextList.add(readMultiLines(hypTextPath));
hypTextList.add(IOUtilities.readTextFileAsStringList(hypTextPath)) ;
if (hypTextList.get(hypTextList.size()-1).size() != refText.size())
usage("refText has a different size from hypText "+ hypTextPath+".\nThey should have the same number of lines; or use -nosent parameter");
}
/*} catch (IOException ioe) {
System.out.println("Wrong hypTextPath: "+hypTextPath);
ioe.printStackTrace();
}*/
long fin = System.currentTimeMillis();
if(verbose) System.out.println("Files loaded in: "+ ((fin-debut)/1000.0)+" s");
/*
* Alignment
*/
debut = System.currentTimeMillis();
Iterator<List<String>> hypTextListIterator = hypTextList.iterator();
// hypText index
int j = 0;
// for each hypText
while (hypTextListIterator.hasNext()) {
List<String> hypText = hypTextListIterator.next();
WordSequenceAligner werEval = new WordSequenceAligner();
// add all the lines to align
List<Alignment> alignments = new ArrayList<Alignment>();
System.out.println("Aligning "+refTextPath+" with "+hypTextPathList.get(j++));
// line index
int i = 0;
for (String hypLine : hypText) {
// Reference alignments and stats created with the NIST sclite tool, default settings
Alignment a = werEval.align(refText.get(i++).split(wordDelimiter), hypLine.split(wordDelimiter));
alignments.add(a);
if(verbose) System.out.println(a);
}
SummaryStatistics ss = new SummaryStatistics(alignments);
System.out.println("Statistics summary");
System.out.println(ss);
System.out.println("");
}
fin = System.currentTimeMillis();
if(verbose) System.out.println("Alignment processed in: "+ ((fin-debut)/1000.0)+" s");
}
/**
*
*/
private static void usage(String message) {
System.out.println();
System.out.println("Process stopped: "+message);
System.out.println("Usage: java -r RefFile -h HypFile [-h HypFile]... [--force-single-line] [-d wordDelimiter] [-v]");
System.out.println(" --force-single-line (If the reference and the hypothesis files do not have the same number of sentences lines or word perline, then force both to be processed as a single line; \\n is the line delimiter)");
System.out.println(" -d wordDelimiter (by default: whitespace character)");
System.out.println(" -v (verbose)");
System.exit(1);
}
/**
* http://stackoverflow.com/questions/326390/how-to-create-a-java-string-from-the-contents-of-a-file
* Alternative exists: faster but more memory consuming
*/
/*private static List<String> readMultiLines( String filePath ) throws IOException {
BufferedReader reader = new BufferedReader( new FileReader (filePath));
String line = null;
//StringBuilder stringBuilder = new StringBuilder();
//String ls = System.getProperty("line.separator");
List<String> lineList = new ArrayList<String>();
while( ( line = reader.readLine() ) != null ) {
//stringBuilder.append( line );
//stringBuilder.append( ls );
lineList.add(line);
}
return lineList;
//return stringBuilder.toString();
}*/
}
|
nicolashernandez/dev-star
|
third-party/sequence-recognition-metrics/src/main/java/com/pwnetics/metric/RunWordSequenceAligner.java
|
Java
|
apache-2.0
| 6,637
|
/*
* Copyright 2015 Torridity.
*
* 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.tor.tribes.ui.views;
import de.tor.tribes.control.GenericManagerListener;
import de.tor.tribes.types.ext.Tribe;
import de.tor.tribes.types.ext.Village;
import de.tor.tribes.ui.editors.BuildingLevelCellEditor;
import de.tor.tribes.ui.models.ChurchTableModel;
import de.tor.tribes.ui.panels.GenericTestPanel;
import de.tor.tribes.ui.renderer.BuildingLevelCellRenderer;
import de.tor.tribes.ui.renderer.ColorCellRenderer;
import de.tor.tribes.ui.renderer.DefaultTableHeaderRenderer;
import de.tor.tribes.ui.windows.AbstractDSWorkbenchFrame;
import de.tor.tribes.ui.windows.DSWorkbenchMainFrame;
import de.tor.tribes.util.*;
import de.tor.tribes.util.mark.MarkerManager;
import de.tor.tribes.util.translation.TranslationManager;
import de.tor.tribes.util.translation.Translator;
import de.tor.tribes.util.village.KnownVillage;
import de.tor.tribes.util.village.KnownVillageManager;
import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.*;
import java.awt.geom.GeneralPath;
import java.awt.image.BufferedImage;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.apache.commons.configuration2.Configuration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jdesktop.swingx.JXButton;
import org.jdesktop.swingx.JXTaskPane;
import org.jdesktop.swingx.decorator.CompoundHighlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.HighlighterFactory;
import org.jdesktop.swingx.decorator.PainterHighlighter;
import org.jdesktop.swingx.painter.AbstractLayoutPainter.HorizontalAlignment;
import org.jdesktop.swingx.painter.AbstractLayoutPainter.VerticalAlignment;
import org.jdesktop.swingx.painter.ImagePainter;
import org.jdesktop.swingx.painter.MattePainter;
/**
* @author Charon
*/
public class DSWorkbenchChurchFrame extends AbstractDSWorkbenchFrame implements GenericManagerListener, ListSelectionListener {
@Override
public void dataChangedEvent() {
dataChangedEvent(null);
}
@Override
public void dataChangedEvent(String pGroup) {
((ChurchTableModel) jChurchTable.getModel()).fireTableDataChanged();
}
private final static Logger logger = LogManager.getLogger("ChurchView");
private static DSWorkbenchChurchFrame SINGLETON = null;
private GenericTestPanel centerPanel = null;
private static Translator trans = TranslationManager.getTranslator("ui.models.DSWorkbenchChurchFrame");
public static synchronized DSWorkbenchChurchFrame getSingleton() {
if (SINGLETON == null) {
SINGLETON = new DSWorkbenchChurchFrame();
}
return SINGLETON;
}
/**
* Creates new form DSWorkbenchChurchFrame
*/
DSWorkbenchChurchFrame() {
initComponents();
centerPanel = new GenericTestPanel();
jChurchPanel.add(centerPanel, BorderLayout.CENTER);
centerPanel.setChildComponent(jXPanel1);
buildMenu();
KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false);
KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false);
ActionListener listener = (ActionEvent e) -> {
if ("Delete".equals(e.getActionCommand())) {
deleteSelection();
} else if ("BBCopy".equals(e.getActionCommand())) {
bbCopySelection();
}
};
capabilityInfoPanel1.addActionListener(listener);
jChurchTable.registerKeyboardAction(listener, "Delete", delete, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
jChurchTable.registerKeyboardAction(listener, "BBCopy", bbCopy, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
jChurchFrameAlwaysOnTop.setSelected(GlobalOptions.getProperties().getBoolean("church.frame.alwaysOnTop"));
setAlwaysOnTop(jChurchFrameAlwaysOnTop.isSelected());
jChurchTable.setModel(new ChurchTableModel());
// <editor-fold defaultstate="collapsed" desc=" Init HelpSystem ">
if (!Constants.DEBUG) {
GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.church_view", GlobalOptions.getHelpBroker().getHelpSet());
}
// </editor-fold>
jChurchTable.getSelectionModel().addListSelectionListener(DSWorkbenchChurchFrame.this);
pack();
}
@Override
public void toBack() {
jChurchFrameAlwaysOnTop.setSelected(false);
fireChurchFrameOnTopEvent(null);
super.toBack();
}
@Override
public void storeCustomProperties(Configuration pConfig) {
pConfig.setProperty(getPropertyPrefix() + ".menu.visible", centerPanel.isMenuVisible());
pConfig.setProperty(getPropertyPrefix() + ".alwaysOnTop", jChurchFrameAlwaysOnTop.isSelected());
PropertyHelper.storeTableProperties(jChurchTable, pConfig, getPropertyPrefix());
}
@Override
public void restoreCustomProperties(Configuration pConfig) {
centerPanel.setMenuVisible(pConfig.getBoolean(getPropertyPrefix() + ".menu.visible", true));
try {
jChurchFrameAlwaysOnTop.setSelected(pConfig.getBoolean(getPropertyPrefix() + ".alwaysOnTop"));
} catch (Exception ignored) {
}
setAlwaysOnTop(jChurchFrameAlwaysOnTop.isSelected());
PropertyHelper.restoreTableProperties(jChurchTable, pConfig, getPropertyPrefix());
}
@Override
public String getPropertyPrefix() {
return "church.view";
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jXPanel1 = new org.jdesktop.swingx.JXPanel();
infoPanel = new org.jdesktop.swingx.JXCollapsiblePane();
jXLabel1 = new org.jdesktop.swingx.JXLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jChurchPanel = new org.jdesktop.swingx.JXPanel();
jChurchFrameAlwaysOnTop = new javax.swing.JCheckBox();
capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel();
jXPanel1.setLayout(new java.awt.BorderLayout());
infoPanel.setCollapsed(true);
infoPanel.setInheritAlpha(false);
jXLabel1.setText(trans.get("KeineMeldung"));
jXLabel1.setOpaque(true);
jXLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(java.awt.event.MouseEvent evt) {
jXLabel1fireHideInfoEvent(evt);
}
});
infoPanel.add(jXLabel1, java.awt.BorderLayout.CENTER);
jXPanel1.add(infoPanel, java.awt.BorderLayout.SOUTH);
jChurchTable.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(jChurchTable);
jXPanel1.add(jScrollPane2, java.awt.BorderLayout.CENTER);
setTitle(trans.get("Kirchen"));
getContentPane().setLayout(new java.awt.GridBagLayout());
jChurchPanel.setBackground(new java.awt.Color(239, 235, 223));
jChurchPanel.setLayout(new java.awt.BorderLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.ipadx = 500;
gridBagConstraints.ipady = 300;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(jChurchPanel, gridBagConstraints);
jChurchFrameAlwaysOnTop.setText(trans.get("ImmerimVordergrund"));
jChurchFrameAlwaysOnTop.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
fireChurchFrameOnTopEvent(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
getContentPane().add(jChurchFrameAlwaysOnTop, gridBagConstraints);
capabilityInfoPanel1.setCopyable(false);
capabilityInfoPanel1.setPastable(false);
capabilityInfoPanel1.setSearchable(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
getContentPane().add(capabilityInfoPanel1, gridBagConstraints);
pack();
}// </editor-fold>//GEN-END:initComponents
private void fireChurchFrameOnTopEvent(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_fireChurchFrameOnTopEvent
setAlwaysOnTop(!isAlwaysOnTop());
}//GEN-LAST:event_fireChurchFrameOnTopEvent
private void jXLabel1fireHideInfoEvent(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jXLabel1fireHideInfoEvent
infoPanel.setCollapsed(true);
}//GEN-LAST:event_jXLabel1fireHideInfoEvent
private void buildMenu() {
JXTaskPane transferPane = new JXTaskPane();
transferPane.setTitle(trans.get("Uebertragen"));
JXButton transferVillageList = new JXButton(new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/ui/center_ingame.png")));
transferVillageList.setToolTipText(trans.get("ZentriertdasKirchendorfimSpiel"));
transferVillageList.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
centerChurchInGame();
}
});
transferPane.getContentPane().add(transferVillageList);
if (!GlobalOptions.isMinimal()) {
JXButton button = new JXButton(new ImageIcon(DSWorkbenchChurchFrame.class.getResource("/res/center_24x24.png")));
button.setToolTipText(trans.get("ZentriertdasKirchendorfHauptkarte"));
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
centerChurchVillage();
}
});
transferPane.getContentPane().add(button);
}
centerPanel.setupTaskPane(transferPane);
}
private KnownVillage getSelectedCurch() {
int row = jChurchTable.getSelectedRow();
if (row >= 0) {
try {
return (KnownVillage) jChurchTable.getModel().getValueAt(jChurchTable.convertRowIndexToModel(row), 1);
} catch (Exception ignored) {
}
}
return null;
}
private void centerChurchVillage() {
KnownVillage v = getSelectedCurch();
if (v != null) {
DSWorkbenchMainFrame.getSingleton().centerVillage(v.getVillage());
} else {
showInfo(trans.get("KeineKirchegewaehlt"));
}
}
private void centerChurchInGame() {
KnownVillage v = getSelectedCurch();
if (v != null) {
BrowserInterface.centerVillage(v.getVillage());
} else {
showInfo(trans.get("KeineKirchegewaehlt"));
}
}
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
int selectionCount = jChurchTable.getSelectedRowCount();
if (selectionCount != 0) {
showInfo(selectionCount + ((selectionCount == 1) ? trans.get("Kirchegewaehlt") : trans.get("Kirchegewaehlt")));
}
}
}
public void showInfo(String pMessage) {
infoPanel.setCollapsed(false);
jXLabel1.setBackgroundPainter(new MattePainter(getBackground()));
jXLabel1.setForeground(Color.BLACK);
jXLabel1.setText(pMessage);
}
public void showError(String pMessage) {
infoPanel.setCollapsed(false);
jXLabel1.setBackgroundPainter(new MattePainter(Color.RED));
jXLabel1.setForeground(Color.WHITE);
jXLabel1.setText(pMessage);
}
public void showSuccess(String pMessage) {
infoPanel.setCollapsed(false);
jXLabel1.setBackgroundPainter(new MattePainter(Color.GREEN));
jXLabel1.setForeground(Color.BLACK);
jXLabel1.setText(pMessage);
}
private void deleteSelection() {
int[] rows = jChurchTable.getSelectedRows();
if (rows.length == 0) {
return;
}
String message = ((rows.length == 1) ? trans.get("Kirchendorf") : (rows.length + trans.get("Kirchendoerfer"))) + trans.get("wirklichloeschen");
if (JOptionPaneHelper.showQuestionConfirmBox(this, message, trans.get("Loeschen"), trans.get("Nein"), trans.get("Ja")) == JOptionPane.YES_OPTION) {
//get markers to remove
List<Village> toRemove = new LinkedList<>();
jChurchTable.invalidate();
for (int i = rows.length - 1; i >= 0; i--) {
int row = jChurchTable.convertRowIndexToModel(rows[i]);
int col = jChurchTable.convertColumnIndexToModel(1);
Village v = ((KnownVillage) jChurchTable.getModel()
.getValueAt(row, col)).getVillage();
toRemove.add(v);
}
jChurchTable.revalidate();
//remove all selected markers and update the view once
KnownVillageManager.getSingleton().removeChurches(toRemove.toArray(new Village[]{}), true);
showSuccess(toRemove.size() + ((toRemove.size() == 1) ? trans.get("Kirchegeloescht") : trans.get("Kirchengeloescht")));
}
}
private void bbCopySelection() {
try {
int[] rows = jChurchTable.getSelectedRows();
if (rows.length == 0) {
return;
}
boolean extended = (JOptionPaneHelper.showQuestionConfirmBox(this, trans.get("ErweiterterBBCodeverwendet"), trans.get("ErweiterterBBCode"), trans.get("Nein"), trans.get("Ja")) == JOptionPane.YES_OPTION);
StringBuilder buffer = new StringBuilder();
if (extended) {
buffer.append(trans.get("BBKirchendoerfer"));
} else {
buffer.append(trans.get("BBKirche"));
}
buffer.append("[table]\n");
buffer.append(trans.get("BBPlayerVilRadi"));
for (int row1 : rows) {
int row = jChurchTable.convertRowIndexToModel(row1);
int tribeCol = jChurchTable.convertColumnIndexToModel(0);
int villageCol = jChurchTable.convertColumnIndexToModel(1);
int rangeCol = jChurchTable.convertColumnIndexToModel(2);
buffer.append("[*]").
append(((Tribe) jChurchTable.getModel().getValueAt(row, tribeCol)).toBBCode()).
append("[|]").
append(((Village) jChurchTable.getModel().getValueAt(row, villageCol)).toBBCode()).
append("[|]").
append(jChurchTable.getModel().getValueAt(row, rangeCol)).
append("\n");
}
buffer.append("[/table]");
if (extended) {
buffer.append(trans.get("Erstelltamsize"));
buffer.append(TimeManager.getSimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(new Date()));
buffer.append(trans.get("mitDSWorkbench"));
buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "[/size]\n");
} else {
buffer.append(trans.get("Erstelltam"));
buffer.append(TimeManager.getSimpleDateFormat("dd.MM.yy 'um' HH:mm:ss").format(new Date()));
buffer.append(trans.get("mitDSWorkbench"));
buffer.append(Constants.VERSION).append(Constants.VERSION_ADDITION + "\n");
}
String b = buffer.toString();
StringTokenizer t = new StringTokenizer(b, "[");
int cnt = t.countTokens();
if (cnt > 1000) {
if (JOptionPaneHelper.showQuestionConfirmBox(this, trans.get("tausendeBBCode"), trans.get("ZuvieleBBCodes"), trans.get("Nein"), trans.get("Ja")) == JOptionPane.NO_OPTION) {
return;
}
}
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(b), null);
String result = trans.get("DatenZwischenablage");
showSuccess(result);
} catch (Exception e) {
logger.error("Failed to copy data to clipboard", e);
String result = trans.get("FehlerbeimKopieren");
showError(result);
}
}
@Override
public void resetView() {
KnownVillageManager.getSingleton().addManagerListener(this);
MarkerManager.getSingleton().addManagerListener(this);
jChurchTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer());
UIHelper.initTableColums(jChurchTable,
trans.getRaw("ui.models.ChurchTableModel.Stufe"),
trans.getRaw("ui.models.ChurchTableModel.Farbe"));
((ChurchTableModel) jChurchTable.getModel()).fireTableDataChanged();
}
@Override
public void fireVillagesDraggedEvent(List<Village> pVillages, Point pDropLocation) {
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private de.tor.tribes.ui.components.CapabilityInfoPanel capabilityInfoPanel1;
private org.jdesktop.swingx.JXCollapsiblePane infoPanel;
private javax.swing.JCheckBox jChurchFrameAlwaysOnTop;
private org.jdesktop.swingx.JXPanel jChurchPanel;
private static final org.jdesktop.swingx.JXTable jChurchTable = new org.jdesktop.swingx.JXTable();
private javax.swing.JScrollPane jScrollPane2;
private org.jdesktop.swingx.JXLabel jXLabel1;
private org.jdesktop.swingx.JXPanel jXPanel1;
// End of variables declaration//GEN-END:variables
static {
HighlightPredicate.ColumnHighlightPredicate colu = new HighlightPredicate.ColumnHighlightPredicate(0, 1, 2);
jChurchTable.setHighlighters(new CompoundHighlighter(colu, HighlighterFactory.createAlternateStriping(Constants.DS_ROW_A, Constants.DS_ROW_B)));
jChurchTable.setColumnControlVisible(true);
jChurchTable.setDefaultRenderer(Color.class, new ColorCellRenderer());
jChurchTable.setDefaultRenderer(Integer.class, new BuildingLevelCellRenderer());
jChurchTable.setDefaultEditor(Integer.class, new BuildingLevelCellEditor());
BufferedImage back = ImageUtils.createCompatibleBufferedImage(5, 5, BufferedImage.BITMASK);
Graphics2D g = back.createGraphics();
GeneralPath p = new GeneralPath();
p.moveTo(0, 0);
p.lineTo(5, 0);
p.lineTo(5, 5);
p.closePath();
g.setColor(Color.GREEN.darker());
g.fill(p);
g.dispose();
jChurchTable.addHighlighter(new PainterHighlighter(HighlightPredicate.EDITABLE, new ImagePainter(back, HorizontalAlignment.RIGHT, VerticalAlignment.TOP)));
}
}
|
extremeCrazyCoder/dsworkbench
|
Core/src/main/java/de/tor/tribes/ui/views/DSWorkbenchChurchFrame.java
|
Java
|
apache-2.0
| 20,631
|
package com.example.mvp_practice01;
import android.content.Context;
import com.squareup.picasso.Picasso;
import dagger.Component;
/**
* Created by tzia on 17-May-17.
*/
@ApplicationScope // Add this to scope application, this will share objects within a scope
@Component(modules = {PicassoModule.class}) // Search for dependencies in these listed modules or components in some cases
public interface ApplicationContextComponent
{
Picasso getPicasso();
@AppContextQualifier Context getContext();
}
|
talhahasanzia/mvp-samples
|
Dagger2/app/src/main/java/com/example/mvp_practice01/ApplicationContextComponent.java
|
Java
|
apache-2.0
| 515
|
<!doctype html>
<!--
FHIR Drills
Copyright 2016 Australian Digital Health Agency. 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
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
-->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="FHIR Tutorials by the Australian Digital Health Agency to help you understand FHIR and its spec! No technical experience required.">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>ValueSet & CodeSystem | FHIR® tutorials</title>
<!-- Add to homescreen for Chrome on Android -->
<!-- <meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="images/android-desktop.png"> -->
<!-- Add to homescreen for Safari on iOS -->
<!-- <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Material Design Lite">
<link rel="apple-touch-icon-precomposed" href="images/ios-desktop.png"> -->
<!-- Tile icon for Win8 (144x144 + tile color) -->
<!-- <meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
<meta name="msapplication-TileColor" content="#3372DF"> -->
<link rel="shortcut icon" href="images/favicon.ico">
<!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
<!--
<link rel="canonical" href="http://www.example.com/">
-->
<!-- CodeMirror -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/codemirror.min.css"></link>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.deep_purple-pink.min.css">
<link rel="stylesheet" href="styles.css">
<style>
#view-source {
position: fixed;
display: block;
right: 0;
bottom: 0;
margin-right: 40px;
margin-bottom: 40px;
z-index: 900;
}
</style>
<link href="css/lightbox.min.css" rel="stylesheet">
<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-80290058-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body class="mdl-demo mdl-color--grey-100 mdl-color-text--grey-700 mdl-base">
<!-- The drawer is always open in large screens. The header is always shown,
even in small screens. -->
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-drawer
mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<div class="mdl-layout-spacer"></div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable
mdl-textfield--floating-label mdl-textfield--align-right">
<label class="mdl-button mdl-js-button mdl-button--icon"
for="fixed-header-drawer-exp">
<i class="material-icons">search</i>
</label>
<div class="mdl-textfield__expandable-holder">
<input class="mdl-textfield__input" type="text" name="sample"
id="fixed-header-drawer-exp">
</div>
</div>
</div>
</header>
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">FHIR<sup>®</sup> tutorials</span>
<nav class="mdl-navigation">
<a href="./index.html" class="mdl-navigation__link">Overview</a>
<a href="./simple-patient.html" id="simple-patient" class="mdl-navigation__link">Simple Patient</a>
<a href="./simple-search.html" id="simple-search" class="mdl-navigation__link">Simple Search</a>
<a href="./patient-with-references.html" id="patient-with-references" class="mdl-navigation__link">Patient with References</a>
<a href="./bundle.html" id="bundle" class="mdl-navigation__link">Bundle</a>
<a href="./operations.html" id="operations" class="mdl-navigation__link">Operations</a>
<a href="./ValueSet-And-CodeSystem.html" id="ValueSet-And-CodeSystem" class="mdl-navigation__link is-active-tab">ValueSet & CodeSystem</a>
<a href="./conceptmap.html" id="conceptmap" class="mdl-navigation__link">ConceptMap</a>
<a href="./fhir-api.html" id="conceptmap" class="mdl-navigation__link">FHIR APIs</a>
<a href="#" class="mdl-navigation__link"></a>
<a href="./exercises.html" class="mdl-navigation__link">FHIR exercises</a>
</nav>
</div>
<main class="mdl-layout__content">
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp">
<div class="mdl-card mdl-cell mdl-cell--12-col-desktop mdl-cell--6-col-tablet mdl-cell--4-col-phone">
<div class="mdl-card__supporting-text">
<h4>ValueSet and CodeSystem</h4>
<p>This tutorial will cover the basics of the ValueSet and CodeSystem resources which are two of the three key resources for working with terminology within FHIR, with the other one being <a href="./conceptmap.html">ConceptMap</a>.</p>
<ul class="toc">
<h4>Contents</h4>
<!-- pr prefix stands for 'patient references'-->
<a href="#vac-step1">Step 1: What are ValueSets and CodeSystems</a>
<a href="#vac-step2">Step 2: CodeSystem the FHIR Resources</a>
<a href="#vac-step3">Step 3: ValueSet the FHIR Resources</a>
<a href="#vac-step4">Step 4: Understanding how ValueSet codes are used</a>
<a href="#vac-step5">Step 5: Creating ValueSets using filters (Include, Exclude and Filter)</a>
<a href="#vac-step6">Step 6: Using the $expand operation</a>
</ul>
<h5 id="vac-step1">Step 1: What are ValueSets and CodeSystems</h5>
<p>In Healthcare, we use many codes from many different sets of codes. We have relatively simple ones like patient gender and more complex ones such as allergies and adverse reactions and more clerical ones like facility codes or billing codes. FHIR cannot define every required code and code set for every Healthcare system across the world. Instead, FHIR provides a mechanism to manage the codes and code sets and that mechanism is a CodeSystem and ValueSet resources. </p>
<p>FHIR's CodeSystems and ValueSets work hand in hand to manage terminology in FHIR. The two are so closely tied that in the early versions of FHIR they were actually one resource. Yet since the STU3 version of FHIR, they have been separated. Here we will first explain the concepts behind CodeSystem and ValueSet and later we will look at the FHIR resources that embody them.</p>
<p>It is best to start by explaining CodeSystem as it is the basis that ValueSets are then created from. You can think of a CodeSystem as being a master catalogue of a particular set of codes. It is the totality of all the codes in a system. That system may be SNOMED-CT or LOINC or even a system you create for yourself. Let's use an analogy to help explain.</p>
<p>I love Allen’s lollies. Let’s imagine that each different lolly is a code. We have RipeRaspberries, Pineapples, MilkBottles, Snakes and all of the other Allen’s lollies. If we listed the entire catalogue of Allen’s lollies with a description for each, the date the list was put together, the lists publisher details and more then this would be the CodeSystem.</p>
<img src="images/Lollies-Mix.jpg" width="30%">
<p>The CodeSystem does not get used by the consumers, it is just the reference catalogue for all Allen’s lollies, so if you want to find out more about the code 'RipeRaspberrie' then you would go to the CodeSystem. What a consumer uses is a ValueSet, because a ValueSet adds value to the consumer. In our lolly analogy, the ValueSet is the packet of lollies you buy, like the Party Mix or the bag of lollies you choose because they're your favourites. This is a ValueSet because it serves a purpose. It is a selection of codes from the CodeSystem to be used for a purpose.</p>
<img src="images/Lollies-BagOf.jpg" width="20%">
<p>A ValueSet is not limited to a single CodeSystem just as our bag of lollies is not limited to Allen's lollies. I'm also quite fond of Smarties, but only Red and Blue ones, from the Smarties CodeSystem, and also a few RedSkins from the Wonka CodeSystem. All of these can go into my same lolly bag which is a single ValueSet.</p>
<p>Next, we will look at the FHIR resources used for these concepts which are also named CodeSystem and ValueSet.</p>
<h5 id="vac-step2">Step 2: CodeSystem the FHIR Resource</h5>
<p>Let's take a closer look at the FHIR resource named CodeSystem, you will find the resource page in the FHIR specification here:</p>
<ul>
<li><b><a href="http://hl7.org/fhir/STU3/codesystem.html" rel="stylesheet">Resource CodeSystem</a></b></li>
</ul>
<p><b>Below is a simple example of a CodeSystem FHIR resource</b></p>
<p>The example below only contains two codes <b>'easy'</b> and <b>'hard'</b>. What is important for you at this stage is to grasp the basic structure of the resource. Notice that the top section (lines 8 to 20), like all FHIR resources, is a narrative HTML representation of the CodeSystem. The middle section (lines 21 to 37) is all the metadata about the CodeSystem, things like the version, a name and description for the CodeSystem, its status, whether it is experimental or not, who is the publisher and whether the codes are case sensitive. The last section (lines 38 to 45) are the actual codes each in their own <code><concept></code> element.</p>
<p>Don't forget, the CodeSystem is a catalogue of codes to be selected in ValueSets.</p>
<textarea id="codesystem-1" class="fhir-resource-xml">
<?xml version="1.0" encoding="UTF-8"?>
<CodeSystem xmlns="http://hl7.org/fhir">
<id value="1"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2016-06-27T13:50:00Z"/>
</meta>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>Code System for FHIR tutorial participants to rate the difficulty of understanding of the training material</p>
<p>Developed by: Australian Digital Health Agency Connectathon team (example)</p>
<p>Published for testing on 27-June 2016</p>
<table>
<tr><td><b>Code</b></td><td><b>Display</b></td></tr>
<tr><td>easy</td><td>I found the material easy to understand</td></tr>
<tr><td>hard</td><td>I found the material hard to understand</td></tr>
</table>
</div>
</text>
<url value="urn:uuid:c4a698d9-6749-4c2a-abd3-9d2eb9e8e0a1"/>
<version value="20162726"/>
<name value="FHIR tutorial difficulty levels"/>
<title value="FHIR tutorial difficulty levels"/>
<status value="draft"/>
<experimental value="true"/>
<publisher value="Australian Digital Health Agency"/>
<contact>
<name value="Angus Millar"/>
<telecom>
<system value="email"/>
<value value="angus.millar@digitalhealth.gov.au"/>
</telecom>
</contact>
<date value="2016-06-27"/>
<description value="Code System for FHIR tutorial participants to rate the difficulty of understanding of the training material"/>
<caseSensitive value="true"/>
<content value="complete"/>
<concept>
<code value="easy"/>
<display value="I found the material easy to understand"/>
</concept>
<concept>
<code value="hard"/>
<display value="I found the material hard to understand"/>
</concept>
</CodeSystem></textarea>
<p>This example does not show every property of a CodeSystem resource. I've only used the ones I thought were key while also trying to keep the example nice and short. Take a look at <a href="http://hl7.org/fhir/STU3/codesystem.html" rel="stylesheet">CodeSystem</a> in the FHIR specification to see all the properties available.</p>
<h5 id="vac-step3">Step 3: ValueSet the FHIR Resources</h5>
<p>Let's take a closer look at the FHIR resource named ValueSet, you will find the resource page in the FHIR specification here:</p>
<ul>
<li><b><a href="http://hl7.org/fhir/STU3/valueset.html" rel="stylesheet">Resource ValueSet</a></b></li>
</ul>
<p><b>Here is a simple example of a ValueSet FHIR resource</b></p>
<p>This ValueSet resource below selects codes from the CodeSystem example we looked at in <a href="#vac-step2">Step 2</a>. Notice that this ValueSet selects both the <b>'easy'</b> and <b>'hard'</b> codes from the CodeSystem.
<p>Please notice how the the CodeSystem is referenced in the ValueSet using the '<b><code>compose/include/system/@value</code></b>' which points to the GUID seen in the CodeSystem's '<b><code>url</code></b>' property. Take special note of this '<b><code>url</code></b>' property as it is not the resource id or the URL to the FHIR resource in the server. Rather, it is a property of the CodeSystem resource. This '<b><code>url</code></b>' is intended to be globally unique, so the same CodeSystem can be in any number of servers and can always be found by this '<b><code>url</code></b>', not by the resource id.</p>
<p>Remember the ValueSet is free to pick and choose whichever codes it requires from the CodeSystem, it could even select more codes from another CodeSystem if required.</p>
<textarea id="valuesystem-1" class="fhir-resource-xml"><?xml version="1.0" encoding="UTF-8"?>
<ValueSet xmlns="http://hl7.org/fhir">
<id value="1"/>
<meta>
<versionId value="1"/>
<lastUpdated value="2016-06-27T15:00:00Z"/>
</meta>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>ValueSet for FHIR tutorial participants to rate the difficulty of understanding of the training material</p>
<p>Developed by: Australian Digital Health Agency Connectathon team (example)</p>
<p>Published for testing on 28-June 2016</p>
<table>
<tr><td><b>Code</b></td><td><b>Display</b></td></tr>
<tr><td>easy</td><td>I found the material easy to understand</td></tr>
<tr><td>hard</td><td>I found the material hard to understand</td></tr>
</table>
</div>
</text>
<url value="urn:uuid:8ec3847e-789e-4994-a74b-7bbf55d88190"/>
<version value="20160530"/>
<name value="FHIR tutorial difficulty levels"/>
<title value="FHIR tutorial difficulty levels"/>
<status value="draft"/>
<experimental value="true"/>
<publisher value="Australian Digital Health Agency"/>
<contact>
<name value="Angus Millar"/>
<telecom>
<system value="email"/>
<value value="angus.millar@digitalhealth.gov.au"/>
</telecom>
</contact>
<date value="2016-06-27"/>
<description value="Codes for FHIR tutorial participants to rate the difficulty of understanding of the training material"/>
<compose>
<lockedDate value="2016-06-27"/>
<include>
<system value="urn:uuid:c4a698d9-6749-4c2a-abd3-9d2eb9e8e0a1"/>
<version value="20162726"/>
<concept>
<code value="easy"/>
</concept>
<concept>
<code value="hard"/>
</concept>
</include>
</compose>
</ValueSet></textarea>
<p>Remember, a ValueSet is a grouping of codes, codes are taken from CodeSystems, to be used for a purpose. ValueSet codes adds value to some use case, for example: a clinical systems drop down box to select an allergy.</p>
<p>Once again you should go to the FHIR specification page for <a href="http://hl7.org/fhir/STU3/valueset.html" rel="stylesheet">ValueSet</a> to see the full list of properties available.</p>
<p><b>Question:</b> If you had two copies of a ValueSet resource given to you, from different people, how would you determine that the two instances were actually the same ValueSet?</p>
<b>CSIRO's Snapper</b>
<p>Snapper is an online tool developed by the CSIRO team that created the ONTO FHIR Terminology server. The tool provides a friendly user interface for creating and editing FHIR CodeSystems, ValueSets and ConceptMaps rather than having you fiddle with XML or JSON. Your finished resource can then be downloaded locally or published directly into an FHIR server of you choosing. This free tool can be found here: <a href="http://ontoserver.csiro.au/snapper2-dev" rel="stylesheet">Snapper BETA</a></p>
<p><a href="images/ValueSetSnapperScreenshot.png" data-lightbox="ValueSetSnapperScreenshot"><img src="images/ValueSetSnapperScreenshot.png" width="60%" class="thumbnail"/></a></p>
<p><h5 id="vac-step4">Step 4: Understanding how ValueSet codes are stored</h5></p>
<p>It is easy to fall into the trap of thinking that the code information you list in a ValueSet will be exactly the same code information used when a ValueSet is called upon by a system. This isn't the case, however, as the codes stored in a ValueSet actually belong to a CodeSystem - a valueset instance only contains the 'links' to the actual codes in a codesystem. Thus when a codesystem's codes are updated, the valuesets containing these codes will contain the updated codes automatically. This is demonstrated well by one of the primary uses of a ValueSet: getting a list of codes to present to a user as specified by the links in the valueset, this is done with a special operation on the FHIR Terminology Server called <b>'<code>$expand</code>'</b>. This is known as ValueSet Expansion or ValueSet enumeration.</p>
<p>We are not going to go into how to perform an expansion now (see <a href="#vac-step6">step 6</a> for that), but you do need to know what happens in the FHIR Terminology Server when an expansion is performed as it is key to your understanding.</p>
<p>As seen in this first diagram (you can click to enlarge) a developer calls the <b>'<code>$expand</code>'</b> operation on a given ValueSet because they want the list of codes and descriptions to display to a user. As we have seen, the ValueSet has a list of codes and it knows the CodeSystems for each code.</p>
<p><a href="images/ValueSetExpansionRequestDiagram.png" data-lightbox="ValueSetExpansionResponseDiagram"><img src="images/ValueSetExpansionRequestDiagram.png" width="50%" class="thumbnail"/></a></p>
<p>The FHIR terminology server does not just return the codes in the ValueSet, what it does is reference the CodeSystems as listed for each code in the ValueSet and retrieves the information about the code from the CodeSystem resource in real-time and returns this back to the developer as an expanded ValueSet.</p>
<p><a href="images/ValueSetExpansionResponseDiagram.png" data-lightbox="ValueSetExpansionResponseDiagram"><img src="images/ValueSetExpansionResponseDiagram.png" width="50%" class="thumbnail"/></a></p>
<p>What this means is that the ValueSet is only a reference to the codes in the CodeSystem. A key point here is that if the code description was updated in the CodeSystem then a ValueSet expansion will pick up the new description even though the ValueSet was never modified. You can control this using the <b>'lockedDate'</b> property of a ValueSet. If a <b>lockedDate</b> is given in the ValueSet then only the CodeSystems as of this date will be used, any later version of the same CodeSystem will not be used when ValueSet Expansion is performed. For more information about <b>lockedDate</b> refer to the FHIR specification here: <a href="http://hl7.org/fhir/STU3/valueset-definitions.html#ValueSet.compose.lockedDate" rel="stylesheet"><b>lockedDate</b></a>.</p>
<h5 id="vac-step5">Step 5: Creating ValueSets using filters (Include, Exclude and Filter)</h5>
<p>In the previous '<a href="#vac-step4">Step 4: Understanding how ValueSet codes are used</a>' we learnt that ValueSets only select codes from CodeSystems. In our simple ValueSet example we selected, or rather 'Included', our codes by stating the actual code values '<b>easy</b>' and '<b>hard</b>' as they were seen in our CodeSystem. Yet, there is another way to select codes for inclusion in the ValueSet which is by using a filter.</p>
<p>We will avoid deep diving on filters but it is worth noting they exist and can be used. Typically a filter would be used when the code system being used has a hierarchical structure, meaning each code can have a parent or children codes such as the LOINC code system or even a poly-hierarchical system where codes can have many parents and many children codes such as SNOMED-CT.</p>
<p><a href="images/ValueSetToeNailSNOMEDCode.png" data-lightbox="ValueSetToeNailSNOMEDCode"><img src="images/ValueSetToeNailSNOMEDCode.png" width="80%" class="thumbnail"/></a></p>
<p>With hierarchical code systems, we can use a filter to say <i>"include all codes under this parent code"</i>. This way, as new codes are introduced under a parent code, in the code system, they will automatically be included in our ValueSet's selected codes. In the very same way we can include codes, we can also <b>exclude</b> codes either by stating the code to exclude or by using another filter.</p>
<p>The image below is taken from the <a href="http://hl7.org/fhir/STU3/valueset.html#resource" rel="stylesheet"><b>ValueSet tree structure in the FHIR specification</b></a> and highlights the sections that deals with the topic discussed in this step (Include, Exclude & Filter). </p>
<p><a href="images/ValueSetFilterTreeDiagram.png" data-lightbox="ValueSetFilterTreeDiagram"><img src="images/ValueSetFilterTreeDiagram.png" width="100%" class="thumbnail"/></a></p>
<h5 id="vac-step6">Step 6: Using the $expand operation</h5>
<p>As introduced in <a href="#vac-step4">step 4</a>, the $expand operation allows you to retrieve the full listing of codes available in a valueset, which makes sense if you consider the possible dynamic nature of valuesets given the filters introduced above in <a href="vac-step5">step 5</a>. Following on from the <a href="./operations.html">introduction to Operations</a>, upload the valueset with the 'easy' and 'hard' codes to a FHIR server:</p>
<p>
<center>
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" id="expand-operation-button">
Upload</button>
<br>
<div id="expand-operation-progress" class="mdl-progress mdl-js-progress" style="display: none;"></div>
</center>
</p>
<p>The resource will be available for viewing in Postman or your browser under this URL:</p>
<note class="expand-operation-location-full" id="vac-expand-valueset"><i>(press Upload to get a ValueSet)</i></note>
<p>As described in the <a href="./operations.html">Operations</a> tab, every resource has an 'Operations' tab, including <a href="http://hl7.org/fhir/STU3/valueset-operations.html">ValueSet</a>, which is where you'll find the <a href="http://hl7.org/fhir/STU3/valueset-operations.html#expand">$expand</a> operation. There are two ways you can use the operation - either on the ValueSet resource type:</p>
<code class="expand-operation-baseurl" id="vac-expand-valueset">[Service Root URL]</code><code>/ValueSet/$expand</code>
<p>in which case you'll need to provide the id of the valueset to expand as an 'identifier' parameter, or you can use the operation on a ValueSet instance, where the id of the resource is provided in the URL: </p>
<code class="expand-operation-location-full" id="vac-expand-valueset">[Service Root URL]/[Resource Type]/[Resource Id]</code><code>/$expand</code>
<p>Try entering <span class="expand-operation-location-full" id="vac-expand-valueset">[upload resource above first]</span><span>/$expand</span> into Postman - and you'll receive an expanded ValueSet resource:</p>
<a href="images/valueset-expantion.png" data-lightbox="valueset-expansion"><img src="images/valueset-expantion-thumbnail.png" class="thumbnail"/></a>
<p>There are two things of interest here:</p>
<p><li>The narrative of the resource, where you can clearly see that this is an expansion of a valueset, and</li> <li>The expansion of codes itself, where you can see that all the codes are listed under the 'expansion' element instead of the 'compose' element as you would when you're creating your valueset. </li> </p>
<p>While the 'compose' element can list both the filters or full list of codes that compose the valueset, the 'expansion' element will always list the full set of codes in the valueset.</p>
<p>The 'expansion' element in the spec allows for containment of the parameters that controlled the expansion, the expanded codes themselves, and some metadata such as the timestamp of the expansion and the offset where the expansion should start.</p>
<p>You can also control the expansion by applying parameters to it. The filter parameter, for example, allows you to filter the codes by text - if you try entering <span class="expand-operation-location-full" id="vac-expand-valueset">[upload resource above first]</span><span>/$expand?filter=easy</span> into Postman, you'll see that just one code is returned then, and that is the 'easy' one.</p>
</div>
</section>
<footer class="mdl-mega-footer">
<div class="mdl-mega-footer--middle-section">
<div class="mdl-mega-footer--drop-down-section">
<input class="mdl-mega-footer--heading-checkbox" type="checkbox" checked>
<h1 class="mdl-mega-footer--heading">The Agency</h1>
<ul class="mdl-mega-footer--link-list">
<li><a href="https://www.digitalhealth.gov.au/">digitalhealth.gov.au</a></li>
<li><a href="https://myhealthrecord.gov.au/internet/mhr/publishing.nsf/content/home" title="Australian national health record">My Health Record</a></li>
</ul>
</div>
<div class="mdl-mega-footer--drop-down-section">
<input class="mdl-mega-footer--heading-checkbox" type="checkbox" checked>
<h1 class="mdl-mega-footer--heading">FHIR</h1>
<ul class="mdl-mega-footer--link-list">
<li><a href="http://wiki.hl7.org/index.php?title=FHIR_Connectathon_15" title="Next FHIR get-together in Madrid in May 2017">Connectathon 15</a></li>
<li><a href="http://hl7.org/fhir/STU3" title="Latest release of FHIR, for use in Madrid Connectathon">FHIR STU3 Release</a></li>
<li><a href="http://build.fhir.org/" title="The latest FHIR as it is in development">FHIR Continuous Integration Build</a></li>
</ul>
</div>
</div>
</footer>
</main>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.13.4/mode/xml/xml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.14.2/mode/javascript/javascript.min.js"></script>
<script src="https://code.getmdl.io/1.1.3/material.min.js"></script>
<script src="js/lightbox-plus-jquery.min.js"></script>
<!-- lua.vm.js -->
<script src="js/lua.vm.js/dist/lua.vm.js"></script>
<!-- main javascript for this page-->
<script src="js/main.js"></script>
<!-- supporting javascript to actually do the uploading -->
<script src="js/post-resources.js"></script>
</body>
</html>
|
fhir-drills/fhir-drills.github.io
|
ValueSet-And-CodeSystem.html
|
HTML
|
apache-2.0
| 31,762
|
.sr-lattice-item {
user-select: none;
cursor: move;
border: solid 2px #777;
}
.sr-lattice-item.sr-item-selected {
background-color: blue;
border-color: blue;
}
.sr-lattice-item:hover, .sr-lattice-item.drag-over {
border-color: black;
}
.sr-lattice-item-holder.drag-enter .sr-lattice-item {
opacity: 0.7;
transition: margin 0.5s ease 0s;
}
.sr-lattice-item-holder.drag-enter .sr-move-left {
margin-left: -4em;
margin-right: 4em;
}
.sr-lattice-item-holder.drag-enter .sr-move-right {
margin-left: 4em;
margin-right: -4em;
}
.sr-lattice-item-holder .sr-lattice-item.drag-over {
opacity: 1.0;
margin-left: 0;
margin-right: 0;
}
.sr-lattice-item-holder {
text-align: center;
padding: 5px 0;
display: inline-block;
border: solid 5px white;
border-radius: 10px;
}
.sr-lattice-item-holder.drag-enter {
border: solid 5px lightgray;
}
.sr-lattice-close-icon {
font-size: 16px;
cursor: pointer;
color: #aaa;
visibility: hidden;
}
.sr-lattice-icon {
background-color: #222;
border-color: #222;
border-radius: 0;
}
.sr-lattice-icon-disabled {
background-color: #aaa;
border-color: #aaa;
}
div.sr-lattice-icon-disabled span {
cursor: not-allowed;
}
.sr-lattice-editor-panel {
overflow: auto;
}
.sr-editor-item-hover:hover .sr-lattice-close-icon {
visibility: visible;
}
.sr-editor-item-hover .sr-lattice-close-icon:hover {
color: #000;
}
.sr-selected-lattice-item {
fill: yellow !important;
stroke: black !important;
stroke-width: 0.01 !important;
}
.sr-lattice rect, .sr-lattice polygon, .sr-lattice line, .sr-lattice path, .sr-lattice ellipse, .sr-lattice circle {
cursor: pointer;
}
|
mrakitin/sirepo
|
sirepo/package_data/static/css/lattice.css
|
CSS
|
apache-2.0
| 1,662
|
package com.tcg.olga.managers;
import java.util.HashMap;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
import com.badlogic.gdx.math.Vector2;
import com.tcg.olga.Game;
import com.tcg.olga.managers.midi.Midi;
public class Content {
private HashMap<String, Music> music;
private HashMap<String, Sound> sound;
private HashMap<String, BitmapFont> font;
private HashMap<String, Midi> midi;
public Content() {
music = new HashMap<String, Music>();
sound = new HashMap<String, Sound>();
font = new HashMap<String, BitmapFont>();
midi = new HashMap<String, Midi>();
}
/*
* Music
*/
public void loadMusic(String folder, String path, String key, boolean looping) {
Music m = Gdx.audio.newMusic(Gdx.files.internal(folder + "/" + path));
m.setLooping(looping);
music.put(key, m);
}
public Music getMusic(String key) {
return music.get(key);
}
public void setVolumeAll(float vol) {
for(Object o : music.values()) {
Music music = (Music) o;
music.setVolume(vol);
}
for(Object o : midi.values()) {
Midi m = (Midi) o;
m.setVolume(vol);
}
}
/*
* Midi
*/
public void loadMidi(String folder, String path, String key, boolean looping) {
Midi m = new Midi();
m.open(folder + "/" + path);
m.setLooping(looping);
midi.put(key, m);
}
public Midi getMidi(String key) {
return midi.get(key);
}
/*
* Sound
*/
public void loadSound(String folder, String path, String key) {
Sound s = Gdx.audio.newSound(Gdx.files.internal(folder + "/" + path));
sound.put(key, s);
}
public Sound getSound(String key) {
return sound.get(key);
}
/*
* Bitmap Font
*/
@SuppressWarnings("deprecation")
public void loadBitmapFont(String folder, String path, String key, int size, Color color) {
FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal(folder + "/" + path));
BitmapFont bmf = gen.generateFont(size);
bmf.setColor(color);
font.put(key, bmf);
gen.dispose();
}
public BitmapFont getFont(String key) {
return font.get(key);
}
public float getWidth(String key, String s) {
return font.get(key).getBounds(s).width;
}
public float getHeight(String key, String s) {
return font.get(key).getBounds(s).height - font.get(key).getDescent();
}
public float centerX(String key, String s) {
return Game.CENTER.x - (getWidth(key, s) * .5f);
}
public float centerY(String key, String s) {
return Game.CENTER.y + (getHeight(key, s) * .5f);
}
public Vector2 center(String key, String s) {
return new Vector2(centerX(key, s), centerY(key, s));
}
/*
* Other
*/
public void removeAll() {
for(Object o : music.values()) {
Music m = (Music) o;
m.dispose();
}
for(Object o : sound.values()) {
Sound s = (Sound) o;
s.dispose();
}
for(Object o : font.values()) {
BitmapFont bmf = (BitmapFont) o;
bmf.dispose();
}
}
public void stopSound() {
for(Object o : sound.values()) {
Sound s = (Sound) o;
s.stop();
}
}
public void stopMusic() {
for(Object o : music.values()) {
Music m = (Music) o;
m.stop();
}
}
public void stopMidi() {
for(Object o : midi.values()) {
Midi m = (Midi) o;
m.stop();
}
}
public void stopAllSound() {
stopSound();
stopMusic();
stopMidi();
}
}
|
JoseRivas1998/olga
|
core/src/com/tcg/olga/managers/Content.java
|
Java
|
apache-2.0
| 3,496
|
# Copyright 2015 Google 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.
require 'addressable/uri'
require 'addressable/template'
require 'google/apis/version'
require 'google/apis/core/api_command'
require 'google/apis/core/batch'
require 'google/apis/core/upload'
require 'google/apis/core/download'
require 'google/apis/options'
require 'googleauth'
require 'httpclient'
module Google
module Apis
module Core
# Helper class for enumerating over a result set requiring multiple fetches
class PagedResults
include Enumerable
attr_reader :last_result
# @param [BaseService] service
# Current service instance
# @param [Fixnum] max
# Maximum number of items to iterate over. Nil if no limit
# @param [Boolean] cache
# True (default) if results should be cached so multiple iterations can be used.
# @param [Symbol] items
# Name of the field in the result containing the items. Defaults to :items
def initialize(service, max: nil, items: :items, cache: true, response_page_token: :next_page_token, &block)
@service = service
@block = block
@max = max
@items_field = items
@response_page_token_field = response_page_token
if cache
@result_cache = Hash.new do |h, k|
h[k] = @block.call(k, @service)
end
@fetch_proc = Proc.new { |token| @result_cache[token] }
else
@fetch_proc = Proc.new { |token| @block.call(token, @service) }
end
end
# Iterates over result set, fetching additional pages as needed
def each
page_token = nil
item_count = 0
loop do
@last_result = @fetch_proc.call(page_token)
items = @last_result.send(@items_field)
if items.kind_of?(Array)
for item in items
item_count = item_count + 1
break if @max && item_count > @max
yield item
end
elsif items.kind_of?(Hash)
items.each do |key, val|
item_count = item_count + 1
break if @max && item_count > @max
yield key, val
end
elsif items
# yield singular non-nil items (for genomics API)
yield items
end
break if @max && item_count >= @max
next_page_token = @last_result.send(@response_page_token_field)
break if next_page_token.nil? || next_page_token == page_token
page_token = next_page_token
end
end
end
# Base service for all APIs. Not to be used directly.
#
class BaseService
include Logging
# Root URL (host/port) for the API
# @return [Addressable::URI]
attr_accessor :root_url
# Additional path prefix for all API methods
# @return [Addressable::URI]
attr_accessor :base_path
# Alternate path prefix for media uploads
# @return [Addressable::URI]
attr_accessor :upload_path
# Alternate path prefix for all batch methods
# @return [Addressable::URI]
attr_accessor :batch_path
# HTTP client
# @return [HTTPClient]
attr_accessor :client
# General settings
# @return [Google::Apis::ClientOptions]
attr_accessor :client_options
# Default options for all requests
# @return [Google::Apis::RequestOptions]
attr_accessor :request_options
# @param [String,Addressable::URI] root_url
# Root URL for the API
# @param [String,Addressable::URI] base_path
# Additional path prefix for all API methods
# @api private
def initialize(root_url, base_path)
self.root_url = root_url
self.base_path = base_path
self.upload_path = "upload/#{base_path}"
self.batch_path = 'batch'
self.client_options = Google::Apis::ClientOptions.default.dup
self.request_options = Google::Apis::RequestOptions.default.dup
end
# @!attribute [rw] authorization
# @return [Signet::OAuth2::Client]
# OAuth2 credentials
def authorization=(authorization)
request_options.authorization = authorization
end
def authorization
request_options.authorization
end
# TODO: with(options) method
# Perform a batch request. Calls made within the block are sent in a single network
# request to the server.
#
# @example
# service.batch do |s|
# s.get_item(id1) do |res, err|
# # process response for 1st call
# end
# # ...
# s.get_item(idN) do |res, err|
# # process response for Nth call
# end
# end
#
# @param [Hash, Google::Apis::RequestOptions] options
# Request-specific options
# @yield [self]
# @return [void]
def batch(options = nil)
batch_command = BatchCommand.new(:post, Addressable::URI.parse(root_url + batch_path))
batch_command.options = request_options.merge(options)
apply_command_defaults(batch_command)
begin
start_batch(batch_command)
yield self
ensure
end_batch
end
batch_command.execute(client)
end
# Perform a batch upload request. Calls made within the block are sent in a single network
# request to the server. Batch uploads are useful for uploading multiple small files. For larger
# files, use single requests which use a resumable upload protocol.
#
# @example
# service.batch do |s|
# s.insert_item(upload_source: 'file1.txt') do |res, err|
# # process response for 1st call
# end
# # ...
# s.insert_item(upload_source: 'fileN.txt') do |res, err|
# # process response for Nth call
# end
# end
#
# @param [Hash, Google::Apis::RequestOptions] options
# Request-specific options
# @yield [self]
# @return [void]
def batch_upload(options = nil)
batch_command = BatchUploadCommand.new(:put, Addressable::URI.parse(root_url + upload_path))
batch_command.options = request_options.merge(options)
apply_command_defaults(batch_command)
begin
start_batch(batch_command)
yield self
ensure
end_batch
end
batch_command.execute(client)
end
# Get the current HTTP client
# @return [HTTPClient]
def client
@client ||= new_client
end
# Simple escape hatch for making API requests directly to a given
# URL. This is not intended to be used as a generic HTTP client
# and should be used only in cases where no service method exists
# (e.g. fetching an export link for a Google Drive file.)
#
# @param [Symbol] method
# HTTP method as symbol (e.g. :get, :post, :put, ...)
# @param [String] url
# URL to call
# @param [Hash<String,String>] params
# Optional hash of query parameters
# @param [#read] body
# Optional body for POST/PUT
# @param [IO, String] download_dest
# IO stream or filename to receive content download
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [String] HTTP response body
# @yieldparam err [StandardError] error object if request failed
#
# @return [String] HTTP response body
def http(method, url, params: nil, body: nil, download_dest: nil, options: nil, &block)
if download_dest
command = DownloadCommand.new(method, url, body: body)
else
command = HttpCommand.new(method, url, body: body)
end
command.options = request_options.merge(options)
apply_command_defaults(command)
command.query.merge(Hash(params))
execute_or_queue_command(command, &block)
end
# Executes a given query with paging, automatically retrieving
# additional pages as necessary. Requires a block that returns the
# result set of a page. The current page token is supplied as an argument
# to the block.
#
# Note: The returned enumerable also contains a `last_result` field
# containing the full result of the last query executed.
#
# @param [Fixnum] max
# Maximum number of items to iterate over. Defaults to nil -- no upper bound.
# @param [Symbol] items
# Name of the field in the result containing the items. Defaults to :items
# @param [Boolean] cache
# True (default) if results should be cached so multiple iterations can be used.
# @return [Enumerble]
# @yield [token, service]
# Current page token & service instance
# @yieldparam [String] token
# Current page token to be used in the query
# @yieldparm [service]
# Current service instance
# @since 0.9.4
#
# @example Retrieve all files,
# file_list = service.fetch_all { |token, s| s.list_files(page_token: token) }
# file_list.each { |f| ... }
def fetch_all(max: nil, items: :items, cache: true, response_page_token: :next_page_token, &block)
fail "fetch_all may not be used inside a batch" if batch?
return PagedResults.new(self, max: max, items: items, cache: cache, response_page_token: response_page_token, &block)
end
protected
# Create a new upload command.
#
# @param [symbol] method
# HTTP method for uploading (typically :put or :post)
# @param [String] path
# Additional path to upload endpoint, appended to API base path
# @param [Hash, Google::Apis::RequestOptions] options
# Request-specific options
# @return [Google::Apis::Core::UploadCommand]
def make_upload_command(method, path, options)
template = Addressable::Template.new(root_url + upload_path + path)
if batch?
command = MultipartUploadCommand.new(method, template)
else
command = ResumableUploadCommand.new(method, template)
end
command.options = request_options.merge(options)
apply_command_defaults(command)
command
end
# Create a new download command.
#
# @param [symbol] method
# HTTP method for uploading (typically :get)
# @param [String] path
# Additional path to download endpoint, appended to API base path
# @param [Hash, Google::Apis::RequestOptions] options
# Request-specific options
# @return [Google::Apis::Core::DownloadCommand]
def make_download_command(method, path, options)
template = Addressable::Template.new(root_url + base_path + path)
command = DownloadCommand.new(method, template)
command.options = request_options.merge(options)
command.query['alt'] = 'media'
apply_command_defaults(command)
command
end
# Create a new command.
#
# @param [symbol] method
# HTTP method (:get, :post, :delete, etc...)
# @param [String] path
# Additional path, appended to API base path
# @param [Hash, Google::Apis::RequestOptions] options
# Request-specific options
# @return [Google::Apis::Core::DownloadCommand]
def make_simple_command(method, path, options)
template = Addressable::Template.new(root_url + base_path + path)
command = ApiCommand.new(method, template)
command.options = request_options.merge(options)
apply_command_defaults(command)
command
end
# Execute the request. If a batch is in progress, the request is added to the batch instead.
#
# @param [Google::Apis::Core::HttpCommand] command
# Command to execute
# @return [Object] response object if command executed and no callback supplied
# @yield [result, err] Result & error if block supplied
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def execute_or_queue_command(command, &callback)
batch_command = current_batch
if batch_command
fail "Can not combine services in a batch" if Thread.current[:google_api_batch_service] != self
batch_command.add(command, &callback)
nil
else
command.execute(client, &callback)
end
end
# Update commands with service-specific options. To be implemented by subclasses
# @param [Google::Apis::Core::HttpCommand] _command
def apply_command_defaults(_command)
end
private
# Get the current batch context
#
# @return [Google:Apis::Core::BatchRequest]
def current_batch
Thread.current[:google_api_batch]
end
# Check if a batch is in progress
# @return [Boolean]
def batch?
!current_batch.nil?
end
# Start a new thread-local batch context
# @param [Google::Apis::Core::BatchCommand] cmd
def start_batch(cmd)
fail "Batch already in progress" if batch?
Thread.current[:google_api_batch] = cmd
Thread.current[:google_api_batch_service] = self
end
# Clear thread-local batch context
def end_batch
Thread.current[:google_api_batch] = nil
Thread.current[:google_api_batch_service] = nil
end
# Create a new HTTP client
# @return [HTTPClient]
def new_client
client = ::HTTPClient.new
client.transparent_gzip_decompression = true
client.proxy = client_options.proxy_url if client_options.proxy_url
if client_options.open_timeout_sec
client.connect_timeout = client_options.open_timeout_sec
end
if client_options.read_timeout_sec
client.receive_timeout = client_options.read_timeout_sec
end
if client_options.send_timeout_sec
client.send_timeout = client_options.send_timeout_sec
end
client.follow_redirect_count = 5
client.default_header = { 'User-Agent' => user_agent }
client.debug_dev = logger if client_options.log_http_requests
client
end
# Build the user agent header
# @return [String]
def user_agent
sprintf('%s/%s google-api-ruby-client/%s %s (gzip)',
client_options.application_name,
client_options.application_version,
Google::Apis::VERSION,
Google::Apis::OS_VERSION)
end
end
end
end
end
|
saicheems/google-api-ruby-client
|
lib/google/apis/core/base_service.rb
|
Ruby
|
apache-2.0
| 16,221
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<style type="text/css">
body {
color: #000000;
background-color: #FFFFFF;
}
del {
text-decoration: line-through;
color: #8B0040;
}
ins {
text-decoration: underline;
color: #005100;
}
p.example {
margin: 2em;
}
pre.example {
margin: 2em;
}
div.example {
margin: 2em;
}
code.extract {
background-color: #F5F6A2;
}
pre.extract {
margin: 2em;
background-color: #F5F6A2;
border: 1px solid #E1E28E;
}
p.function {
}
p.attribute {
text-indent: 3em;
}
blockquote.std {
color: #000000;
background-color: #F1F1F1;
border: 1px solid #D1D1D1;
padding: 0.5em;
}
blockquote.stddel {
text-decoration: line-through;
color: #000000;
background-color: #FFEBFF;
border: 1px solid #ECD7EC;
padding: 0.5em;
}
blockquote.stdins {
text-decoration: underline;
color: #000000;
background-color: #C8FFC8;
border: 1px solid #B3EBB3;
padding: 0.5em;
}
table {
border: 1px solid black;
border-spacing: 0px;
margin-left: auto;
margin-right: auto;
}
th {
text-align: left;
vertical-align: top;
padding: 0.2em;
border: none;
}
td {
text-align: left;
vertical-align: top;
padding: 0.2em;
border: none;
}
</style>
<title>C++ Latches and Barriers</title>
</head>
<body>
<h1>C++ Latches and Barriers</h1>
<p>
ISO/IEC JTC1 SC22 WG21 N3666 (revised) - 2013-06-27
</p>
<p>
Alasdair Mackintosh, alasdair@google.com, alasdair.mackintosh@gmail.com
</p>
<p>
<a href="#Introduction">Introduction</a><br>
<a href="#Solution">Solution</a><br>
<a href="#latch_operations">Latch Operations</a><br>
<a href="#barrier_operations">Barrier Operations</a><br>
<a href="#example">Sample Usage</a><br>
<a href="#synopsis">Synopsis</a><br>
<a href="#wording">Wording</a><br>
</p>
<h2><a name="Introduction">Introduction</a></h2>
<p>
Certain idioms that are commonly used in concurrent programming are missing
from the standard libraries. Although many of these these can be relatively
straightforward to implement, we believe it is more efficient to have a
standard version.
</p><p>
</p>
In addition, although some idioms can be provided using
mutexes, higher performance can often be obtained with atomic operations and
lock-free algorithms. However, these algorithms are more complex to write, and
are prone to error.
<p></p>
<p>
Other standard concurrency idioms may have difficult corner cases, and can be
hard to implement correctly. For these reasons, we believe that it is
valuable to provide these in the standard library.
</p>
<h2><a name="Solution">Solution</a></h2>
<p>
We propose a set of commonly-used concurrency classes, some of which may be
implemented using efficient lock-free algorithms where appropriate. This paper
describes the <i>latch</i> and <i>barrier</i> classes.
</p>
<p>
Latches are a thread co-ordination mechanism that allow one or more threads to
block until an operation is completed. An individual latch is a single-use
object; once the operation has been completed, it cannot be re-used.
</p>
<p>
Barriers are a thread co-ordination mechanism that allow multiple threads to
block until an operation is completed. Unlike a latch, a barrier is re-usable;
once the operation has been completed, the threads can re-use the same
barrier. It is thus useful for managing repeated tasks handled by multiple
threads.
</p>
<p>
A reference implementation of these two classes has been written.
</p>
<h3><a name="latch_operations">Latch Operations</a></h3>
A latch maintains an internal counter that is initialized when the latch is
created. One or more threads may block waiting until the counter is decremented
to 0.
<dl>
<dt><code>constructor( size_t );</code></dt>
<dd>
<p>
The parameter is the initial value of the internal counter.
</p>
</dd>
<dt><code>destructor( );</code></dt>
<dd>
<p>
Destroys the latch. If the latch is destroyed while other threads are blocked in
<code>wait()</code>, the behaviour is undefined. Once the internal count has
reached 0, the latch may safely be destroyed.
</p>
</dd>
<dt><code>void count_down( );</code></dt>
<dd>
<p>
Decrements the internal count by 1, and returns. If the count reaches 0, any
threads blocked in <code>wait()</code> will be released.
</p>
<p>
Throws <code>std::logic_error</code> if the internal count is already 0.
</p>
</dd>
<dt><code>void wait( );</code></dt>
<dd>
<p>
Blocks the calling thread until the internal count is decremented to 0 by one
or more other threads calling <code>count_down()</code>. If the count is
already 0, this is a no-op.
</p>
</dd>
<dt><code>bool try_wait( );</code></dt>
<dd>
<p>
Returns true if the internal count has been decremented to 0 by one
or more other threads calling <code>count_down()</code>, and false otherwise.
Does not block the calling thread.
</p>
</dd>
<dt><code>void count_down_and_wait( );</code></dt>
<dd>
<p>
Decrements the internal count by 1. If the resulting count is not 0, blocks the
calling thread until the internal count is decremented to 0 by one or more
other threads calling <code>count_down()</code>.
</p>
</dd>
</dl>
<p>
There are no copy or assignment operations.
</p>
<h4>Memory Ordering</h4>
All calls to <code>count_down()</code> synchronize with any thread
returning from <code>wait()</code>. All calls to <code>count_down()</code>
synchronize with any thread that gets a true value from <code>try_wait()</code>.
<h3><a name="barrier_operations">Barrier Operations</a></h3>
<p>
A barrier maintains an internal thread counter that is initialized when the
barrier is created. Threads may decrement the counter and then block waiting
until the specified number of threads are blocked. All threads will then be
woken up, and the barrier will reset. In addition, there is a mechanism to
change the thread count value after the count reaches 0.
</p>
<dl>
<dt><code>constructor( size_t );</code></dt>
<dd>
<p>
The parameter is the initial value of the internal thread counter.
</p>
<p>
Throws <code>std::invalid_argument</code> if the specified count is 0.
</p>
</dd>
<dt><code>constructor( size_t, std::function<void()> );</code></dt>
<dd>
<p>
The parameters are the initial value of the internal thread counter, and a
function that will be invoked when the counter reaches 0.
</p>
<p>
Throws <code>std::invalid_argument</code> if the specified count is 0.
</p>
</dd>
<dt><code>constructor( size_t, std::function<size_t()> );</code></dt>
<dd>
<p>
The parameters are the initial value of the internal thread counter, and a
function that will be invoked when the counter reaches 0. The return value
from the function will be used to reset the internal thread counter.
</p>
<p>
Throws <code>std::invalid_argument</code> if the specified count is 0.
</p>
</dd>
<dt><code>destructor( );</code></dt>
<dd>
<p>
Destroys the barrier. If the barrier is destroyed while other threads are
blocked in <code>count_down_and_wait()</code>, the behaviour is undefined.
</p>
</dd>
<dt><code>void count_down_and_wait( );</code></dt>
<dd>
<p>
Decrements the internal thread count by 1. If the resulting count is not 0,
blocks the calling thread until the internal count is decremented to 0 by one
or more other threads calling <code>count_down_and_wait()</code>.
</p>
<p>
Before any threads are released, the completion function registered in the
constructor will be invoked (if specified and non-NULL). Note that the
completion function may be invoked in the context of one of the blocked
threads. When the completion function returns, the internal thread count will
be reset, and all blocked threads will be unblocked. If the barrier was created
with a void function, then the internal thread count will be reset to the
initial thread count specified in the contructor. If the barrier was created
with a function returning size_t, then the thread count will be reset to the
function's return value. It is illegal to return 0.
</p><p>
Note that it is safe for a thread to re-enter <code>count_down_and_wait()</code>
immediately. It is not necessary to ensure that all blocked threads have exited
<code>count_down_and_wait()</code> before one thread re-enters it.
</p></dd>
</dl>
<p>
There are no copy or assignment operations.
</p>
<p>
Note that the barrier does not have separate <code>count_down()</code> and
<code>wait()</code> methods. Every thread that counts down will then block until
all threads have counted down. Hence only the
<code>count_down_and_wait()</code> method is supported.
</p>
<h4>Memory Ordering</h4>
For threads X and Y that call <code>count_down_and_wait()</code>, the
call to <code>count_down_and_wait()</code> in X synchronizes with the return from
<code>count_down_and_wait()</code> in Y.
<h4>A Note on Completion Functions and Templates</h4>
The proposed barrier takes an optional completion function, which may either
return void or size_t. A barrier may thus do one of three things after all
threads have called <code>count_down_and_wait()</code>:
<ul>
<li>
Reset itself automatically (if given no completion function.)
</li>
<li>
Invoke the completion function and then reset itself automatically (if given a
function returning void).
</li>
<li>
Invoke the completion function and use the return value to reset itself (if
given a function returning size_t).
</li>
</ul>
<p>
It has been suggested that the barrier class could be templated on the type of
the completion function, so that a specialisation could be made for the first
type of barrier. (If the compiler knew that no completion function would be
involved, it could generate faster code, possibly using hardware barriers.)
</p>
<p>
However, doing this would require users of the barrier to declare a templated
barrier parameter rather than using a plain barrier type. Given this, it would
be simpler to create multipe barrier types (e.g. simple_barrier and barrier,
with the same interface) and let users of the barrier class template that.
</p>
<h3><a name="example">Sample Usage</a></h3>
Sample use cases for the latch include:
<ul>
<li>
Setting multiple threads to perform a task, and then waiting until all threads
have reached a common point.
</li>
<li>
Creating multiple threads, which wait for a signal before advancing beyond a
common point.
</li>
</ul>
An example of the first use case would be as follows:
<pre>
<code>
void DoWork(threadpool* pool) {
latch completion_latch(NTASKS);
for (int i = 0; i < NTASKS; ++i) {
pool->add_task([&] {
// perform work
...
completion_latch.count_down();
}));
}
// Block until work is done
completion_latch.wait();
}
</code>
</pre>
An example of the second use case is shown below. We need to load data and then
process it using a number of threads. Loading the data is I/O bound, whereas
starting threads and creating data structures is CPU bound. By running these in
parallel, throughput can be increased.
<pre>
<code>
void DoWork() {
latch start_latch(1);
vector<thread*> workers;
for (int i = 0; i < NTHREADS; ++i) {
workers.push_back(new thread([&] {
// Initialize data structures. This is CPU bound.
...
start_latch.wait();
// perform work
...
}));
}
// Load input data. This is I/O bound.
...
// Threads can now start processing
start_latch.count_down();
// Wait for threads to finish, delete allocated objects.
...
}
</code>
</pre>
<p>
The barrier can be used to co-ordinate a set of threads carrying out a repeated
task. The number of threads can be adjusted dynamically to respond to changing
requirements.
</p>
<p>
In the example below, a number of threads are performing a multi-stage
task. Some tasks may require fewer steps than others, meaning that some threads
may finish before others. We reduce the number of threads waiting on the
barrier when this happens.
</p>
<pre>
<code>
void DoWork() {
Tasks& tasks;
size_t initial_threads;
atomic<size_t> current_threads(initial_threads)
vector<thread*> workers;
// Create a barrier, and set a lambda that will be invoked every time the
// barrier counts down. If one or more active threads have completed,
// reduce the number of threads.
std::function rf = [&] { return current_threads;};
barrier task_barrier(n_threads, rf);
for (int i = 0; i < n_threads; ++i) {
workers.push_back(new thread([&] {
bool active = true;
while(active) {
Task task = tasks.get();
// perform task
...
if (finished(task)) {
current_threads--;
active = false;
}
task_barrier.count_down_and_wait();
}
});
}
// Read each stage of the task until all stages are complete.
while (!finished()) {
GetNextStage(tasks);
}
}
</code>
</pre>
<h2><a name="synopsis">Synopsis</a></h2>
<p>
The synopsis is as follows.
</p>
<pre>
<code>
class latch {
public:
explicit latch(size_t count);
~latch();
void count_down();
void wait();
bool try_wait();
void count_down_and_wait();
};
class barrier {
public:
explicit barrier(size_t num_threads) throw (std::invalid_argument);
barrier(size_t num_threads, std::function<void()> completion) throw (std::invalid_argument);
barrier(size_t num_threads, void (*completion)()) throw (std::invalid_argument);
barrier(size_t num_threads, std::function<size_t()> completion) throw (std::invalid_argument);
barrier(size_t num_threads, size_t (*completion)()) throw (std::invalid_argument);
~barrier();
void count_down_and_wait();
};
</code>
</pre>
<h2><a name="wording">Wording</a></h2>
The wording in this section is relative to N3242.
<h3>30.7 Thread coordination [thread.coordination]</h3>
<p>
This section provides mechanisms for thread coordination: latches and
barriers.
These mechanisms allow multiple threads to block until a given operation
has completed.
</p>
<h3>30.7.1 Latches [thread.latch]</h3>
A latch is a thread co-ordination mechanism that allow one or more threads to
block until an operation is completed.
An individual latch is a single-use object; once the operation has been
completed, it cannot be re-used.
<h4>30.7.1.1 Class latch [thread.latch]</h4>
<pre>
<code>
namespace std {
class latch {
public:
explicit latch(size_t count);
~latch();
void count_down();
void wait();
bool try_wait();
void count_down_and_wait();
};
}
</pre>
</code>
<p>
The class <code>latch</code> provides a single-use thread coordination mechanism.
An individual latch instance maintains an internal counter that is initialized
when the latch is created.
One or more threads may block waiting until the counter is decremented to 0.
</p>
<p>
<code>latch(size_t count);</code>
</p><blockquote>
<p>
<i>Effects:</i>
Constructs an object of type latch.
The parameter is the initial value of the internal counter.
</p>
<p>
<i>Throws:</i>
Nothing.
</p>
</blockquote>
<code>~latch();</code>
<blockquote>
<p>
<i>Effects:</i>
Destroys the latch.
</p>
<p>
<i>Requires:</i>
There are no threads currently
calling <code>wait()</code>, <code>count_down()</code>
or <code>count_down_and_wait()</code>.
If there are, the behaviour is undefined.
</p>
<p>
<i>Throws:</i>
Nothing.
</p>
</blockquote>
<code>void count_down();</code>
<blockquote>
<p>
<i>Effects:</i>
Decrements the internal count by 1, and returns. If the count reaches 0, any
threads blocked in <code>wait()</code> will be released.
</p><p>
<i>Synchronization:</i>
All calls to <code>count_down()</code> synchronize with any thread
returning from <code>wait()</code>.
All calls to <code>count_down()</code> synchronize with any thread
that obtains a true return value from <code>try_wait()</code>.
</p>
<p>
<i>Throws:</i>
<code>std::logic_error</code> if the internal count is already 0.
<code>system_error</code> when an exception is required.
</p>
</blockquote>
<p></p>
<code>void wait();</code>
<blockquote>
<p>
<i>Effects:</i>
Blocks the calling thread until the internal count is decremented to 0 by one
or more other threads calling <code>count_down()</code>.
If the count is already 0, returns immediately.
</p>
<p>
<i>Synchronization:</i>
See <code>count_down()</code>.
</p>
<p>
<i>Throws:</i>
<code>system_error</code> when an exception is required.
</p>
</blockquote>
<code>bool try_wait();</code>
<blockquote>
<p>
<i>Effects:</i>
Returns true if the internal count has been decremented to 0 by one
or more other threads calling <code>count_down()</code>, and false otherwise.
Does not block the calling thread.
</p>
<p>
<i>Synchronization:</i>
See <code>count_down()</code>.
</p>
<p>
<i>Throws:</i>
Nothing.
</p>
</blockquote>
<code>void count_down_and_wait();</code>
<blockquote>
<p>
<i>Effects:</i>
Decrements the internal count by 1.
If the resulting internal count is not 0, blocks the
calling thread until the internal count is decremented to 0 by one or more
other threads calling <code>count_down()</code> or <code>count_down_and_wait</code>.
</p>
<p>
<i>Synchronization:</i>
All calls to <code>count_down_and_wait()</code> synchronize with any thread
returning from <code>wait()</code>.
All calls to <code>count_down_and_wait()</code> synchronize with any thread
that obtains a true return value from <code>try_wait()</code>.
</p>
<p>
<i>Throws:</i>
<code>std::logic_error</code> if the internal count is already 0.
<code>system_error</code> when an exception is required.
</p>
</blockquote>
<h3>30.7.2 Barriers [thread.barrier]</h3>
A barrier is a thread co-ordination mechanism that allows one or more threads to
block until an operation is completed. A barrier is re-usable; once the operation
has been completed, it can be used again to block until a subsequent set of
operations has completed.
<h4>30.7.2.1 Class barrier [thread.barrier]</h4>
<pre>
<code>
class barrier {
public:
explicit barrier(size_t num_threads) throw (std::invalid_argument);
barrier(size_t num_threads, std::function<void()> completion) throw (std::invalid_argument);
barrier(size_t num_threads, void (*completion)()) throw (std::invalid_argument);
barrier(size_t num_threads, std::function<size_t()> completion) throw (std::invalid_argument);
barrier(size_t num_threads, size_t (*completion)()) throw (std::invalid_argument);
~barrier();
void count_down_and_wait();
};
</code>
</pre>
<p>
The class <code>barrier</code> provides a re-usable coordination mechanism.
An individual barrier maintains an internal thread counter that is
initialized when the barrier is created.
One or more threads may decrement the counter and then block waiting
until the specified number of threads are similarly blocked.
All threads will then be unblocked, and the barrier will reset.
While resetting the barrier, there is a mechanism to
change the internal thread count value.
</p>
<p>
<code>barrier(size_t count);</code>
</p><blockquote>
<p>
<i>Effects:</i>
Constructs an object of type barrier.
The parameter is the initial value of the internal counter.
</p>
<p>
<i>Throws:</i>
<code>std::invalid_argument</code> if the specified count is 0.
</p>
</blockquote>
<p>
<code>barrier(size_t num_threads, std::function<void()> completion);</code>
</p><blockquote>
<p>
<i>Effects:</i>
Constructs an object of type barrier.
The parameters are the initial value of the internal counter, and a
<code>std::function</code> completion that will be invoked when the
internal count reaches 0.
If the function argument is NULL, it will be ignored.
</p>
<p>
<i>Throws:</i>
<code>std::invalid_argument</code> if the specified count is 0.
</p>
</blockquote>
<code>barrier(size_t num_threads, void (*completion)()));</code>
<blockquote>
<p>
<i>Effects:</i>
Constructs an object of type barrier.
The parameters are the initial value of the internal counter, and a
completion function that will be invoked when the internal count reaches 0.
If the function argument is NULL, it will be ignored.
</p>
<p>
<i>Throws:</i>
<code>std::invalid_argument</code> if the specified count is 0.
</p>
</blockquote>
<code>barrier(size_t num_threads, std::function<size_t()> completion);</code>
<blockquote>
<p>
<i>Effects:</i>
Constructs an object of type barrier.
The parameters are the initial value of the internal counter, and a
<code>std::function</code> completion function that will be invoked
when the internal count reaches 0.
If the function argument is NULL, it will be ignored.
</p>
<p>
<i>Throws:</i>
<code>std::invalid_argument</code> if the specified count is 0.
</p>
</blockquote>
<code>barrier(size_t num_threads, size_t (*completion)()));</code>
<blockquote>
<p>
<i>Effects:</i>
Constructs an object of type barrier.
The parameters are the initial value of the internal counter, and a
completion function that will be invoked when the internal count reaches 0.
If the function argument is NULL, it will be ignored.
</p>
<p>
<i>Throws:</i>
<code>std::invalid_argument</code> if the specified count is 0.
</p>
</blockquote>
<code>~barrier();</code>
<blockquote>
<p>
<i>Effects:</i>
Destroys the barrier.
</p>
<p>
<i>Requires:</i>
There are no threads currently
calling <code>count_down_and_wait()</code>.
If there are, the behaviour is undefined.
</p>
<p>
<i>Throws:</i>
Nothing.
</p>
</blockquote>
<code>void count_down_and_wait();</code>
<blockquote>
<p>
<i>Effects:</i>
Decrements the internal thread count by 1.
If the resulting count is not 0, blocks the calling thread until the
internal count is decremented to 0 by one or more other threads calling
<code>count_down_and_wait()</code>.
Before any threads are unblocked, the completion function parameter passed to the
constructor (if specified and non-NULL) will be invoked.
When the completion function returns, the internal thread count will
be reset, and all blocked threads will be unblocked.
If the barrier was created with a void completion function, then the internal
thread count will be reset to the initial thread count specified in the
contructor.
If the barrier was created with a completion function returning size_t, then
the thread count will be reset to the function's return value. It is illegal to
return 0, and a <code>std::logic_error</code> will be thrown in the completion
function's thread if this occurs.
</p>
<p>
<i>Note:</i>
It is safe for a thread to re-enter <code>count_down_and_wait()</code>
immediately.
It is not necessary to ensure that all blocked threads have exited
<code>count_down_and_wait()</code> before one thread re-enters it.
</p>
<p>
<i>Note:</i>The thread that the completion function is invoked in is
implementation dependent.
It may be invoked in one of the threads that has called <code>count_down_and_wait()</code>.
</p>
<p>
<i>Synchronization:</i>
All calls to <code>count_down_and_wait()</code> synchronize with any thread
returning from <code>count_down_and_wait()</code>.
The invocation of the completion function synchronizes with any thread that has
called <code>count_down_and_wait()</code>.
</p>
<p>
<i>Throws:</i>
<code>std::logic_error</code> in the thread of the completion function if the
completion function returns 0.
<code>system_error</code> when an exception is required.
</p>
</blockquote>
</body>
</html>
|
maeikei/madoop
|
3dpart/google-concurrency-library/papers/latch_barrier.html
|
HTML
|
apache-2.0
| 23,445
|
/*
* 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
///////////////
package com.hp.hpl.jena.rdf.model.test;
// Imports
///////////////
import java.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.*;
import com.hp.hpl.jena.enhanced.*;
import com.hp.hpl.jena.graph.Graph;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.rdf.model.impl.RDFListImpl;
import com.hp.hpl.jena.shared.JenaException;
import com.hp.hpl.jena.util.iterator.Map1;
import com.hp.hpl.jena.vocabulary.*;
/**
* <p>
* A collection of unit tests for the standard implementation of
* {@link RDFList}.
* </p>
*
* @author Ian Dickinson, HP Labs
* (<a href="mailto:ian_dickinson@users.sourceforge.net" >email</a>)
* @version CVS $Id: TestList.java,v 1.3 2010-01-11 09:17:05 chris-dollin Exp $
*/
public class TestList
extends TestCase
{
// Constants
//////////////////////////////////
public static final String NS = "uri:urn:x-rdf:test#";
// Static variables
//////////////////////////////////
// Instance variables
//////////////////////////////////
// Constructors
//////////////////////////////////
public TestList( String name ) {
super( name );
}
// External signature methods
//////////////////////////////////
public static TestSuite suite() {
TestSuite s = new TestSuite( "TestList" );
for (int i = 0; i <= 5; i++) {
s.addTest( new CountTest( i ) );
s.addTest( new TailTest( i ) );
}
s.addTest( new ValidityTest() );
s.addTest( new HeadTest() );
s.addTest( new SetHeadTest() );
s.addTest( new SetTailTest() );
s.addTest( new ConsTest() );
s.addTest( new AddTest() );
s.addTest( new TestListGet() );
s.addTest( new ReplaceTest() );
s.addTest( new IndexTest1() );
s.addTest( new IndexTest2() );
s.addTest( new AppendTest() );
s.addTest( new ConcatenateTest() );
s.addTest( new ConcatenateTest2() );
s.addTest( new ApplyTest() );
s.addTest( new ReduceTest() );
s.addTest( new RemoveTest() );
s.addTest( new Map1Test() );
s.addTest( new ListEqualsTest() );
s.addTest( new ListSubclassTest() );
s.addTest( new UserDefinedListTest() );
return s;
}
// Internal implementation methods
//////////////////////////////////
/** Test that an iterator delivers the expected values */
protected static void iteratorTest( Iterator<?> i, Object[] expected ) {
Logger logger = LoggerFactory.getLogger( TestList.class );
List<Object> expList = new ArrayList<Object>();
for (int j = 0; j < expected.length; j++) {
expList.add( expected[j] );
}
while (i.hasNext()) {
Object next = i.next();
// debugging
if (!expList.contains( next )) {
logger.debug( "TestList - Unexpected iterator result: " + next );
}
assertTrue( "Value " + next + " was not expected as a result from this iterator ", expList.contains( next ) );
assertTrue( "Value " + next + " was not removed from the list ", expList.remove( next ) );
}
if (!(expList.size() == 0)) {
logger.debug( "TestList - Expected iterator results not found" );
for (Iterator<Object> j = expList.iterator(); j.hasNext(); ) {
logger.debug( "TestList - missing: " + j.next() );
}
}
assertEquals( "There were expected elements from the iterator that were not found", 0, expList.size() );
}
//==============================================================================
// Inner class definitions
//==============================================================================
protected static class ListTest extends TestCase {
public ListTest( String n ) {super(n);}
protected void checkValid( String testName, RDFList l, boolean validExpected ) {
l.setStrict( true );
boolean valid = l.isValid();
// for debugging ... String s = l.getValidityErrorMessage();
assertEquals( "Validity test " + testName + " returned wrong isValid() result", validExpected, valid );
}
protected RDFList getListRoot( Model m ) {
Resource root = m.getResource( NS + "root" );
assertNotNull( "Root resource should not be null", root );
Resource listHead = root.getRequiredProperty( m.getProperty( NS + "p" ) ).getResource();
RDFList l = listHead.as( RDFList.class );
assertNotNull( "as(RDFList) should not return null for root", l );
return l;
}
}
protected static class CountTest extends ListTest {
protected int i;
public CountTest( int i ) {
super( "CountTest" );
this.i = i;
}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list" + i + ".rdf" );
RDFList l0 = getListRoot( m );
assertEquals( "List size should be " + i, i, l0.size() );
}
}
protected static class ValidityTest extends ListTest {
public ValidityTest() {
super( "ValidityTest");
}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource root = m.createResource( NS + "root" );
Property p = m.createProperty( NS, "p");
// a list of the nil object, but not typed
Resource nil = RDF.nil;
m.add( root, p, nil );
RDFList l0 = getListRoot( m );
checkValid( "valid1", l0, true );
// add another node to the head of the list
Resource badList = m.createResource();
m.getRequiredProperty( root, p ).remove();
m.add( root, p, badList );
m.add( badList, RDF.type, RDF.List );
RDFList l1 = getListRoot( m );
checkValid( "valid2", l1, false );
//checkValid( "valid3", l1, false );
m.add( badList, RDF.first, "fred" );
checkValid( "valid4", l1, false );
m.add( badList, RDF.rest, nil );
checkValid( "valid5", l1, true );
}
}
protected static class HeadTest extends ListTest {
public HeadTest() {super( "HeadTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
RDFList l0 = getListRoot( m );
String[] names = {"a", "b", "c", "d", "e"};
for (int i = 0; i < names.length; i++) {
assertEquals( "head of list has incorrect URI", NS + names[i], ((Resource) l0.getHead()).getURI() );
l0 = l0.getTail();
}
}
}
protected static class TailTest extends ListTest {
protected int i;
public TailTest( int i ) {
super( "TailTest" );
this.i = i;
}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list" + i + ".rdf" );
RDFList l0 = getListRoot( m );
// get the tail n times, should be nil at the end
for (int j = 0; j < i; j++) {
l0 = l0.getTail();
}
assertTrue( "Should have reached the end of the list after " + i + " getTail()'s", l0.isEmpty() );
}
}
protected static class SetHeadTest extends ListTest {
public SetHeadTest() {super( "SetHeadTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource root = m.createResource( NS + "root" );
Property p = m.createProperty( NS, "p");
// a list of the nil object, but not typed
Resource nil = RDF.nil;
m.add( nil, RDF.type, RDF.List );
Resource list = m.createResource();
m.add( list, RDF.type, RDF.List );
m.add( list, RDF.first, "fred" );
m.add( list, RDF.rest, nil );
m.add( root, p, list );
RDFList l1 = getListRoot( m );
checkValid( "sethead1", l1, true );
assertEquals( "List head should be 'fred'", "fred", ((Literal) l1.getHead()).getString() );
l1.setHead( m.createTypedLiteral( 42 ) );
checkValid( "sethead2", l1, true );
assertEquals( "List head should be '42'", 42, ((Literal) l1.getHead()).getInt() );
}
}
protected static class SetTailTest extends ListTest {
public SetTailTest() {super( "SetTailTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource root = m.createResource( NS + "root" );
Property p = m.createProperty( NS, "p");
Resource nil = RDF.nil;
m.add( nil, RDF.type, RDF.List );
Resource list0 = m.createResource();
m.add( list0, RDF.type, RDF.List );
m.add( list0, RDF.first, "fred" );
m.add( list0, RDF.rest, nil );
m.add( root, p, list0 );
RDFList l1 = getListRoot( m );
checkValid( "settail1", l1, true );
Resource list1 = m.createResource();
m.add( list1, RDF.type, RDF.List );
m.add( list1, RDF.first, "george" );
m.add( list1, RDF.rest, nil );
RDFList l2 = list1.as( RDFList.class );
assertNotNull( "as(RDFList) should not return null for root", l2 );
checkValid( "settail2", l2, true );
assertEquals( "l1 should have length 1", 1, l1.size() );
assertEquals( "l2 should have length 1", 1, l2.size() );
// use set tail to join the lists together
l1.setTail( l2 );
checkValid( "settail3", l1, true );
checkValid( "settail4", l2, true );
assertEquals( "l1 should have length 2", 2, l1.size() );
assertEquals( "l2 should have length 1", 1, l2.size() );
}
}
protected static class ConsTest extends ListTest {
public ConsTest() {super( "ConsTest" );}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource root = m.createResource( NS + "root" );
Property p = m.createProperty( NS, "p");
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList list = nil.as( RDFList.class );
Resource[] toAdd = new Resource[] {
m.createResource( NS + "e" ),
m.createResource( NS + "d" ),
m.createResource( NS + "c" ),
m.createResource( NS + "b" ),
m.createResource( NS + "a" ),
};
// cons each of these resources onto the front of the list
for (int i = 0; i < toAdd.length; i++) {
RDFList list0 = list.cons( toAdd[i] );
checkValid( "constest1", list0, true );
assertTrue( "cons'ed lists should not be equal", !list0.equals( list ) );
list = list0;
}
// relate the root to the list
m.add( root, p, list );
// should be isomorphic with list 5
Model m0 = ModelFactory.createDefaultModel();
m0.read( "file:testing/ontology/list5.rdf" );
assertTrue( "Cons'ed and read models should be the same", m0.isIsomorphicWith( m ) );
}
}
protected static class AddTest extends ListTest {
public AddTest() {super( "AddTest" );}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource root = m.createResource( NS + "root" );
Property p = m.createProperty( NS, "p");
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList list = nil.as( RDFList.class );
Resource[] toAdd = new Resource[] {
m.createResource( NS + "a" ),
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" ),
m.createResource( NS + "e" ),
};
// add each of these resources onto the end of the list
for (int i = 0; i < toAdd.length; i++) {
RDFList list0 = list.with( toAdd[i] );
checkValid( "addTest0", list0, true );
assertTrue( "added'ed lists should be equal", list.equals( nil ) || list0.equals( list ) );
list = list0;
}
// relate the root to the list
m.add( root, p, list );
// should be isomorphic with list 5
Model m0 = ModelFactory.createDefaultModel();
m0.read( "file:testing/ontology/list5.rdf" );
assertTrue( "Add'ed and read models should be the same", m0.isIsomorphicWith( m ) );
}
}
protected static class TestListGet extends ListTest {
public TestListGet() {super("TestListGet");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
Resource[] toGet = new Resource[] {
m.createResource( NS + "a" ),
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" ),
m.createResource( NS + "e" ),
};
RDFList l1 = getListRoot( m );
// test normal gets
for (int i = 0; i < toGet.length; i++) {
assertEquals( "list element " + i + " is not correct", toGet[i], l1.get( i ) );
}
// now test we get an exception for going beyong the end of the list
boolean gotEx = false;
try {
l1.get( toGet.length + 1 );
}
catch (ListIndexException e) {
gotEx = true;
}
assertTrue( "Should see exception raised by accessing beyond end of list", gotEx );
}
}
protected static class ReplaceTest extends ListTest {
public ReplaceTest() {super("ReplaceTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
Literal[] toSet = new Literal[] {
m.createLiteral( "a" ),
m.createLiteral( "b" ),
m.createLiteral( "c" ),
m.createLiteral( "d" ),
m.createLiteral( "e" ),
};
RDFList l1 = getListRoot( m );
// change all the values
for (int i = 0; i < toSet.length; i++) {
l1.replace( i, toSet[i] );
}
// then check them
for (int i = 0; i < toSet.length; i++) {
assertEquals( "list element " + i + " is not correct", toSet[i], l1.get( i ) );
}
// now test we get an exception for going beyong the end of the list
boolean gotEx = false;
try {
l1.replace( toSet.length + 1, toSet[0] );
}
catch (ListIndexException e) {
gotEx = true;
}
assertTrue( "Should see exception raised by accessing beyond end of list", gotEx );
}
}
protected static class IndexTest1 extends ListTest {
public IndexTest1() {super("IndexTest1");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
Resource[] toGet = new Resource[] {
m.createResource( NS + "a" ),
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" ),
m.createResource( NS + "e" ),
};
RDFList l1 = getListRoot( m );
// check the indexes are correct
for (int i = 0; i < toGet.length; i++) {
assertTrue( "list should contain element " + i, l1.contains( toGet[i] ) );
assertEquals( "list element " + i + " is not correct", i, l1.indexOf( toGet[i] ) );
}
}
}
protected static class IndexTest2 extends ListTest {
public IndexTest2() {super("IndexTest2");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList list = nil.as( RDFList.class );
Resource r = m.createResource( NS + "a" );
// cons each a's onto the front of the list
for (int i = 0; i < 10; i++) {
list = list.cons( r );
}
// now index them back again
for (int j = 0; j < 10; j++) {
assertEquals( "index of j'th item should be j", j, list.indexOf( r, j ) );
}
}
}
protected static class AppendTest extends ListTest {
public AppendTest() {super("AppendTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList list = nil.as( RDFList.class );
Resource r = m.createResource( NS + "foo" );
// create a list of foos
for (int i = 0; i < 5; i++) {
list = list.cons( r );
}
int listLen = list.size();
// now append foos to the root list
RDFList root = getListRoot( m );
int rootLen = root.size();
RDFList appended = root.append( list );
// original list should be unchanged
checkValid( "appendTest0", root, true );
assertEquals( "Original list should be unchanged", rootLen, root.size() );
checkValid( "appendTest1", list, true );
assertEquals( "Original list should be unchanged", listLen, list.size() );
// new list should be length of combined
checkValid( "appendTest2", appended, true );
assertEquals( "Appended list not correct length", rootLen + listLen, appended.size() );
}
}
protected static class ConcatenateTest extends ListTest {
public ConcatenateTest() {super("ConcatenateTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList list = nil.as( RDFList.class );
Resource r = m.createResource( NS + "foo" );
// create a list of foos
for (int i = 0; i < 5; i++) {
list = list.cons( r );
}
int listLen = list.size();
// now append foos to the root list
RDFList root = getListRoot( m );
int rootLen = root.size();
root.concatenate( list );
// original list should be unchanged
checkValid( "concatTest0", list, true );
assertEquals( "Original list should be unchanged", listLen, list.size() );
// but lhs list has changed
checkValid( "concatTest1", root, true );
assertEquals( "Root list should be new length", rootLen + listLen, root.size() );
}
}
protected static class ConcatenateTest2 extends ListTest {
public ConcatenateTest2() {super("ConcatenateTest2");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
Resource a = m.createResource( NS + "a" );
// create a list of foos
Resource[] rs = new Resource[] {
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" ),
m.createResource( NS + "e" )
};
RDFList aList = m.createList().cons( a );
RDFList rsList = m.createList( rs );
// concatenate the above resources onto the empty list
aList.concatenate( rsList );
checkValid( "concatTest3", aList, true );
RDFList root = getListRoot( m );
assertTrue( "Constructed and loaded lists should be the same", aList.sameListAs( root ) );
}
}
protected static class ApplyTest extends ListTest {
public ApplyTest() {super("ApplyTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
RDFList root = getListRoot( m );
class MyApply implements RDFList.ApplyFn {
String collect = "";
@Override
public void apply( RDFNode n ) {
collect = collect + ((Resource) n).getLocalName();
}
}
MyApply f = new MyApply();
root.apply( f );
assertEquals( "Result of apply should be concatentation of local names", "abcde", f.collect );
}
}
protected static class ReduceTest extends ListTest {
public ReduceTest() {super("ReduceTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
RDFList root = getListRoot( m );
RDFList.ReduceFn f = new RDFList.ReduceFn() {
@Override
public Object reduce( RDFNode n, Object acc ) {
return ((String) acc) + ((Resource) n).getLocalName();
}
};
assertEquals( "Result of reduce should be concatentation of local names", "abcde", root.reduce( f, "" ) );
}
}
protected static class Map1Test extends ListTest {
public Map1Test() {super("Map1Test");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
m.read( "file:testing/ontology/list5.rdf" );
RDFList root = getListRoot( m );
iteratorTest( root.mapWith( new Map1<RDFNode, String>() {@Override
public String map1( RDFNode x ){return ((Resource) x).getLocalName();} } ),
new Object[] {"a","b","c","d","e"} );
}
}
protected static class RemoveTest extends ListTest {
public RemoveTest() {super( "RemoveTest" );}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList list0 = nil.as( RDFList.class );
RDFList list1 = nil.as( RDFList.class );
Resource r0 = m.createResource( NS + "x" );
Resource r1 = m.createResource( NS + "y" );
Resource r2 = m.createResource( NS + "z" );
for (int i = 0; i < 10; i++) {
list0 = list0.cons( r0 );
list1 = list1.cons( r1 );
}
// delete the elements of list0 one at a time
while (!list0.isEmpty()) {
list0 = list0.removeHead();
checkValid( "removeTest0", list0, true );
}
// delete all of list1 in one go
list1.removeList();
// model should now be empty
assertEquals( "Model should be empty after deleting two lists", 0, m.size() );
// selective remove
RDFList list2 = (nil.as( RDFList.class ))
.cons( r2 )
.cons( r1 )
.cons( r0 );
assertTrue( "list should contain x ", list2.contains( r0 ));
assertTrue( "list should contain y ", list2.contains( r1 ));
assertTrue( "list should contain z ", list2.contains( r2 ));
list2 = list2.remove( r1 );
assertTrue( "list should contain x ", list2.contains( r0 ));
assertTrue( "list should contain y ", !list2.contains( r1 ));
assertTrue( "list should contain z ", list2.contains( r2 ));
list2 = list2.remove( r0 );
assertTrue( "list should contain x ", !list2.contains( r0 ));
assertTrue( "list should contain y ", !list2.contains( r1 ));
assertTrue( "list should contain z ", list2.contains( r2 ));
list2 = list2.remove( r2 );
assertTrue( "list should contain x ", !list2.contains( r0 ));
assertTrue( "list should contain y ", !list2.contains( r1 ));
assertTrue( "list should contain z ", !list2.contains( r2 ));
assertTrue( "list should be empty", list2.isEmpty() );
}
}
protected static class ListEqualsTest extends ListTest {
public ListEqualsTest() {super("ListEqualsTest");}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
Resource nil = m.getResource( RDF.nil.getURI() );
RDFList nilList = nil.as( RDFList.class );
// create a list of foos
Resource[] r0 = new Resource[] {
m.createResource( NS + "a" ), // canonical
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" ),
m.createResource( NS + "e" )
};
Resource[] r1 = new Resource[] {
m.createResource( NS + "a" ), // same
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" ),
m.createResource( NS + "e" )
};
Resource[] r2 = new Resource[] {
m.createResource( NS + "a" ), // one shorter
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "d" )
};
Resource[] r3 = new Resource[] {
m.createResource( NS + "a" ), // elements swapped
m.createResource( NS + "b" ),
m.createResource( NS + "d" ),
m.createResource( NS + "c" ),
m.createResource( NS + "e" )
};
Resource[] r4 = new Resource[] {
m.createResource( NS + "a" ), // different name
m.createResource( NS + "b" ),
m.createResource( NS + "c" ),
m.createResource( NS + "D" ),
m.createResource( NS + "e" )
};
Object[][] testSpec = new Object[][] {
{r0, r1, Boolean.TRUE},
{r0, r2, Boolean.FALSE},
{r0, r3, Boolean.FALSE},
{r0, r4, Boolean.FALSE},
{r1, r2, Boolean.FALSE},
{r1, r3, Boolean.FALSE},
{r1, r4, Boolean.FALSE},
{r2, r3, Boolean.FALSE},
{r2, r4, Boolean.FALSE},
};
for (int i = 0; i < testSpec.length; i++) {
RDFList l0 = nilList.append( Arrays.asList( (Resource[]) testSpec[i][0] ).iterator() );
RDFList l1 = nilList.append( Arrays.asList( (Resource[]) testSpec[i][1] ).iterator() );
boolean expected = ((Boolean) testSpec[i][2]).booleanValue();
assertEquals( "sameListAs testSpec[" + i + "] incorrect", expected, l0.sameListAs( l1 ) );
assertEquals( "sameListAs testSpec[" + i + "] (swapped) incorrect", expected, l1.sameListAs( l0 ) );
}
}
}
protected static class ListSubclassTest extends ListTest {
public ListSubclassTest() {
super( "ListSubClassTest");
}
@Override
public void runTest() {
Model m = ModelFactory.createDefaultModel();
String NS = "http://example.org/test#";
Resource a = m.createResource( NS + "a" );
Resource b = m.createResource( NS + "b" );
Resource cell0 = m.createResource();
Resource cell1 = m.createResource();
cell0.addProperty( RDF.first, a );
cell0.addProperty( RDF.rest, cell1 );
cell1.addProperty( RDF.first, b );
cell1.addProperty( RDF.rest, RDF.nil );
UserList ul = new UserListImpl( cell0.asNode(), (EnhGraph) m );
assertEquals( "User list length ", 2, ul.size() );
assertEquals( "head of user list ", a, ul.getHead() );
RDFList l = ul.as( RDFList.class );
assertNotNull( "RDFList facet of user-defined list subclass", l );
}
}
/** A simple extension to RDFList to test user-subclassing of RDFList */
protected static interface UserList extends RDFList {
}
/** Impl of a simple extension to RDFList to test user-subclassing of RDFList */
protected static class UserListImpl extends RDFListImpl implements UserList {
public UserListImpl( Node n, EnhGraph g ) {
super( n, g );
}
}
protected static class UserDefinedListTest extends ListTest {
public UserDefinedListTest() {
super( "UserDefinedListTest");
}
@Override
public void runTest() {
BuiltinPersonalities.model.add( UserDefList.class, UserDefListImpl.factoryForTests );
Model m = ModelFactory.createDefaultModel();
String NS = "http://example.org/test#";
Resource a = m.createResource( NS + "a" );
Resource b = m.createResource( NS + "b" );
Resource empty = m.createResource( UserDefListImpl.NIL.getURI() );
UserDefList ul = empty.as( UserDefList.class );
assertNotNull( "UserList facet of empty list", ul );
UserDefList ul0 = (UserDefList) ul.cons( b );
ul0 = (UserDefList) ul0.cons( a );
assertEquals( "should be length 2", 2, ul0.size() );
assertTrue( "first statement", m.contains( ul0, UserDefListImpl.FIRST, a ) );
}
}
protected static interface UserDefList extends RDFList {}
protected static class UserDefListImpl extends RDFListImpl implements UserDefList {
@SuppressWarnings("hiding") public static final String NS = "http://example.org/testlist#";
public static final Property FIRST = ResourceFactory.createProperty( NS+"first" );
public static final Property REST = ResourceFactory.createProperty( NS+"rest" );
public static final Resource NIL = ResourceFactory.createResource( NS+"nil" );
public static final Resource LIST = ResourceFactory.createResource( NS+"List" );
/**
* A factory for generating UserDefList facets from nodes in enhanced graphs.
*/
public static Implementation factoryForTests = new Implementation() {
@Override public EnhNode wrap( Node n, EnhGraph eg ) {
if (canWrap( n, eg )) {
UserDefListImpl impl = new UserDefListImpl( n, eg );
Model m = impl.getModel();
impl.m_listFirst = FIRST.inModel( m );
impl.m_listRest = REST.inModel( m );
impl.m_listNil = NIL.inModel( m );
impl.m_listType = LIST.inModel( m );
return impl;
}
else {
throw new JenaException( "Cannot convert node " + n + " to UserDefList");
}
}
@Override public boolean canWrap( Node node, EnhGraph eg ) {
Graph g = eg.asGraph();
return node.equals( NIL.asNode() ) ||
g.contains( node, FIRST.asNode(), Node.ANY ) ||
g.contains( node, REST.asNode(), Node.ANY ) ||
g.contains( node, RDF.type.asNode(), LIST.asNode() );
}
};
/** This method returns the Java class object that defines which abstraction facet is presented */
@Override public Class<? extends RDFList> listAbstractionClass() {
return UserDefList.class;
}
public UserDefListImpl( Node n, EnhGraph g ) {
super( n, g );
}
}
}
|
danc86/jena-core
|
src/test/java/com/hp/hpl/jena/rdf/model/test/TestList.java
|
Java
|
apache-2.0
| 36,714
|
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_MARKDOWNTOWN_MEDIA_DADOS_PROJETOS_MARKDOWNTOWN_MODULES_MARKDOWNTOWN_SOURCE_MARKDOWNTOWN_Y_HH_INCLUDED
# define YY_MARKDOWNTOWN_MEDIA_DADOS_PROJETOS_MARKDOWNTOWN_MODULES_MARKDOWNTOWN_SOURCE_MARKDOWNTOWN_Y_HH_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
#if YYDEBUG
extern int markdowntown_debug;
#endif
/* "%code requires" blocks. */
#line 8 "/media/dados/projetos/markdowntown/modules/markdowntown/source/markdowntown.y" /* yacc.c:1909 */
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#include <markdowntown/Node.hh>
#include "Token.hh"
#pragma GCC diagnostic ignored "-Wunused-function"
/*
* The parser needs to know about the 'yyscan_t' type,
* but the generated header by Flex don't provide this information.
*/
typedef void *yyscan_t;
typedef struct
{
yyscan_t lexer;
std::vector<markdowntown::Node*> stack;
const char *fileName;
} parser_context_t;
/**
* Get the current column in the lexer scanner.
*
* For some reason this prototype is not generated in the Flex
* header file, so we include it here.
*/
int markdowntown_get_column (yyscan_t yyscanner);
const char *markdowntown_get_token_name( int tok );
#line 90 "/media/dados/projetos/markdowntown/modules/markdowntown/source/markdowntown.y.hh" /* yacc.c:1909 */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
TOK_CODE = 258,
TOK_TEXT = 259,
TOK_HASHTAG = 260,
TOK_SM = 261,
TOK_COLON = 262,
TOK_BOL = 263,
TOK_OPEN_BLOCKQUOTE = 264,
TOK_OPEN_PARAGRAPH = 265,
TOK_OPEN_HEADING = 266,
TOK_OPEN_BOLD = 267,
TOK_OPEN_ITALIC = 268,
TOK_OPEN_STRONG = 269,
TOK_OPEN_UNORDERED_LIST = 270,
TOK_OPEN_ORDERED_LIST = 271,
TOK_OPEN_URL = 272,
TOK_OPEN_CONTINUATION = 273,
TOK_OPEN_MACRO = 274,
TOK_CLOSE_BLOCKQUOTE = 275,
TOK_CLOSE_PARAGRAPH = 276,
TOK_CLOSE_HEADING = 277,
TOK_CLOSE_BOLD = 278,
TOK_CLOSE_ITALIC = 279,
TOK_CLOSE_STRONG = 280,
TOK_CLOSE_UNORDERED_LIST = 281,
TOK_CLOSE_ORDERED_LIST = 282,
TOK_CLOSE_URL = 283,
TOK_CLOSE_CONTINUATION = 284,
TOK_CLOSE_MACRO = 285,
TOK_LINE = 286,
TOK_RAW_TEXT = 287,
TOK_MACRO = 288,
TOK_MACRO_IDENTIFIER = 289,
TOK_MACRO_VALUE = 290,
TOK_MACRO_PIPE = 291,
TOK_EMPTY = 292
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 204 "/media/dados/projetos/markdowntown/modules/markdowntown/source/markdowntown.y" /* yacc.c:1909 */
Token *token;
#line 144 "/media/dados/projetos/markdowntown/modules/markdowntown/source/markdowntown.y.hh" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
int markdowntown_parse (parser_context_t *parserContext);
#endif /* !YY_MARKDOWNTOWN_MEDIA_DADOS_PROJETOS_MARKDOWNTOWN_MODULES_MARKDOWNTOWN_SOURCE_MARKDOWNTOWN_Y_HH_INCLUDED */
|
brunexgeek/markdowntown
|
modules/markdowntown/source/markdowntown.y.hh
|
C++
|
apache-2.0
| 4,489
|
package org.ebayopensource.turmeric.tools.codegen;
import java.io.File;
import java.util.Properties;
import org.custommonkey.xmlunit.DifferenceEngine;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
public class CommentsAddedToConfigTest extends AbstractServiceGeneratorTestCase{
@Rule public TestName name = new TestName();
File destDir = null;
File binDir = null;
final String CONSUMER_PROPERTIES = "service_consumer_project.properties";
@Before
public void init() throws Exception{
testingdir.ensureEmpty();
destDir = testingdir.getDir();
binDir = testingdir.getFile("bin");
File consumerProperty = null;
consumerProperty = createPropertyFile(destDir.getAbsolutePath(), CONSUMER_PROPERTIES);
Properties consumerProps = new Properties();
consumerProps.put("scpp_version","1.1");
fillProperties(consumerProps, consumerProperty);
}
@Test
public void testCommentedElementsClientConfig() throws Exception{
File path = getCodegenQEDataFileInput("AccountService1.wsdl");
String [] testArgs1 = {"-serviceName","AccountService",
"-genType","ClientConfig",
"-wsdl",path.getAbsolutePath(),
"-consumerid","123",
"-interface","com.ebay.AccountService",
"-ccgn","marketplace",
"-sl","http://www.ebayopensource.com/services",
"-wl","http://www.ebayopensource.com/services?wsdl",
"-cn","AccountServiceConsumer",
"-environment","production",
"-dest",destDir.getAbsolutePath(),
"-src",destDir.getAbsolutePath(),
"-adminname","AccountService",
"-slayer","INTERMEDIATE",
"-bin",binDir.getAbsolutePath(),
"-scv","1.0.0",
"-pr",destDir.getAbsolutePath()};
performDirectCodeGen(testArgs1, binDir);
File genFile = new File(getClientConfigFile(destDir.getAbsolutePath(), "AccountService", "AccountServiceConsumer"));
File goldFile = getCodegenQEDataFileInput("ClientConfig.xml");
String genString = readFileAsString(genFile.getAbsolutePath());
String goldString = readFileAsString(goldFile.getAbsolutePath());
XMLAssert.assertXMLEqual(genString, goldString);
}
@Test
public void testCommentedElementsServiceConfig() throws Exception{
File path = getCodegenQEDataFileInput("AccountService1.wsdl");
String [] testArgs1 = {"-serviceName","AccountService",
"-genType","ServerConfig",
"-wsdl",path.getAbsolutePath(),
"-interface","com.ebayopensource.AccountService",
"-sicn","com.ebayopensource.impl.AccountServicesImpl",
"-scgn","marketplace",
"-dest",destDir.getAbsolutePath(),
"-src",destDir.getAbsolutePath(),
"-adminname","AccountService",
"-slayer","INTERMEDIATE",
"-bin",binDir.getAbsolutePath(),
"-scv","1.0.0",
"-pr",destDir.getAbsolutePath()};
performDirectCodeGen(testArgs1, binDir);
File genFile = new File(getServiceConfigFile(destDir.getAbsolutePath(), "AccountService"));
File goldFile = getCodegenQEDataFileInput("ServiceConfig.xml");
String genString = readFileAsString(genFile.getAbsolutePath());
String goldString = readFileAsString(goldFile.getAbsolutePath());
XMLAssert.assertXMLEqual(genString, goldString);
}
@Test
public void testCommentedElementsConfigAll() throws Exception{
File path = getCodegenQEDataFileInput("AccountService1.wsdl");
String [] testArgs1 = {"-serviceName","AccountService",
"-genType","ConfigAll",
"-wsdl",path.getAbsolutePath(),
//"-interface","org.ebayopensource.turmeric.common.v1.services.AccountService",
"-sl","http://www.ebayopensource.com/services",
"-wl","http://www.ebayopensource.com/services?wsdl",
"-cn","AccountServiceConsumer",
"-sicn","com.ebayopensource.impl.AccountServicesImpl",
"-environment","production",
"-ccgn","marketplace",
"-dest",destDir.getAbsolutePath(),
"-src",destDir.getAbsolutePath(),
"-adminname","AccountService",
"-slayer","INTERMEDIATE",
"-bin",binDir.getAbsolutePath(),
"-scv","1.0.0",
"-pr",destDir.getAbsolutePath()};
performDirectCodeGen(testArgs1,binDir);
File genFile = new File(getClientConfigFile(destDir.getAbsolutePath(), "AccountService", "AccountServiceConsumer"));
File goldFile = getCodegenQEDataFileInput("ClientConfig2.xml");
String genString = readFileAsString(genFile.getAbsolutePath());
String goldString = readFileAsString(goldFile.getAbsolutePath());
XMLAssert.assertXMLEqual(genString, goldString);
}
public String getClientConfigFile(String destDir,String serviceName,String consumerName){
return destDir + File.separator +"gen-meta-src/META-INF/soa/client/config/"+consumerName+File.separator+ "production"+File.separator+serviceName+File.separator+"ClientConfig.xml";
}
public String getServiceConfigFile(String destDir,String serviceName){
return destDir + File.separator +"gen-meta-src/META-INF/soa/services/config/"+serviceName+"/ServiceConfig.xml";
}
}
|
ebayopensource/turmeric-runtime
|
codegen/codegen-tools/src/test/java/org/ebayopensource/turmeric/tools/codegen/CommentsAddedToConfigTest.java
|
Java
|
apache-2.0
| 5,019
|
/**
* Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.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.
*/
package com.artivisi.biller.simulator.entity;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.GenericGenerator;
@Entity @Table(name="pembelian_listrik_prabayar")
public class PembelianListrikPrabayar {
@Id @GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
private String id;
@ManyToOne @JoinColumn(name="id_pelanggan", nullable=false)
private Pelanggan pelanggan;
@Column(nullable=false, name="nilai_token")
private BigDecimal nilaiToken;
@Column(nullable=false, name="nomer_token")
private String nomerToken;
@Column(nullable=false, name="kwh")
private BigDecimal kwh;
@Column(nullable=false, name="waktu_transaksi")
@Temporal(TemporalType.TIMESTAMP)
private Date waktuTransaksi = new Date();
@Temporal(TemporalType.DATE)
@Column(nullable=false, name="tanggal_transaksi")
private Date tanggalTransaksi = new Date();
@Column(nullable=false)
private String bank;
@Column(nullable=false)
private String switcher;
@Column(nullable=false)
private String loket;
@Column(nullable=false)
private String operator;
@Column(nullable=false, name="merchant_category")
private String merchantCategory;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public BigDecimal getNilaiToken() {
return nilaiToken;
}
public void setNilaiToken(BigDecimal nilaiToken) {
this.nilaiToken = nilaiToken;
}
public String getNomerToken() {
return nomerToken;
}
public void setNomerToken(String nomerToken) {
this.nomerToken = nomerToken;
}
public Date getWaktuTransaksi() {
return waktuTransaksi;
}
public void setWaktuTransaksi(Date waktuTransaksi) {
this.waktuTransaksi = waktuTransaksi;
}
public Date getTanggalTransaksi() {
return tanggalTransaksi;
}
public void setTanggalTransaksi(Date tanggalTransaksi) {
this.tanggalTransaksi = tanggalTransaksi;
}
public String getBank() {
return bank;
}
public void setBank(String bank) {
this.bank = bank;
}
public String getSwitcher() {
return switcher;
}
public void setSwitcher(String switcher) {
this.switcher = switcher;
}
public String getLoket() {
return loket;
}
public void setLoket(String loket) {
this.loket = loket;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getMerchantCategory() {
return merchantCategory;
}
public void setMerchantCategory(String merchantCategory) {
this.merchantCategory = merchantCategory;
}
public Pelanggan getPelanggan() {
return pelanggan;
}
public void setPelanggan(Pelanggan pelanggan) {
this.pelanggan = pelanggan;
}
public BigDecimal getKwh() {
return kwh;
}
public void setKwh(BigDecimal kwh) {
this.kwh = kwh;
}
}
|
artivisi/biller-simulator
|
biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/PembelianListrikPrabayar.java
|
Java
|
apache-2.0
| 3,776
|
package pom_ios.main_tabs;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import io.appium.java_client.pagefactory.iOSFindBy;
public class RiotHomePageTabObjects extends RiotTabPageObjects{
public RiotHomePageTabObjects(AppiumDriver<MobileElement> myDriver) throws InterruptedException {
super(myDriver);
PageFactory.initElements(new AppiumFieldDecorator(driver), this);
Assert.assertTrue(waitUntilDisplayed((IOSDriver<MobileElement>) driver,"HomeVCView", true, 10),"HomePage tab isn't open.");
//Instanciate protected properties from mother class with own and uniques values of this tab.
super.roomsTableView=hpTabRoomsTableView;
super.tabMainView=homePageTabView;
}
@iOSFindBy(accessibility="HomeVCView")
public MobileElement homePageTabView;
/*
* ROOMS LIST.
*/
/**
* Table view of rooms items. </br> Contains a list of 'RecentTableViewCell' cells.
*/
@iOSFindBy(accessibility="HomeVCTableView")
public MobileElement hpTabRoomsTableView;
/**
* TEMP !!!!!!!!!!
* Return a room as a MobileElement using his title.</br>
* Return null if not found.
* @param myRoomName
* @return
*/
public MobileElement getRoomByName(String myRoomName){
try {
return roomsTableView.findElementByXPath("//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='TitleLabel' and @value='"+myRoomName+"']");
} catch (Exception e) {
System.out.println("No room found with name "+myRoomName);
return null;
}
}
}
|
vector-im/riot-automated-tests
|
VectorMobileTests/src/test/java/pom_ios/main_tabs/RiotHomePageTabObjects.java
|
Java
|
apache-2.0
| 1,671
|
import { gql } from '@urql/core'
import { P } from '@/schemas'
import { titleCase, plural } from '@/utils/helper'
const getPagedPublishedArticlesSchema = (thread) => {
return gql`
${P[`pagedPublished${plural(titleCase(thread))}`]}
`
}
const follow = gql`
${P.follow}
`
const undoFollow = gql`
${P.undoFollow}
`
const user = gql`
query user($login: String) {
user(login: $login) {
viewerHasFollowed
}
}
`
const schema = {
getPagedPublishedArticlesSchema,
follow,
undoFollow,
user,
}
export default schema
|
mydearxym/mastani
|
src/containers/user/UserProfile/schema.ts
|
TypeScript
|
apache-2.0
| 549
|
/*
* Copyright 2013 Google 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.google.common.jimfs;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.CompletionHandler;
import java.nio.channels.FileLock;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
/**
* {@link AsynchronousFileChannel} implementation that delegates to a {@link JimfsFileChannel}.
*
* @author Colin Decker
*/
final class JimfsAsynchronousFileChannel extends AsynchronousFileChannel {
private final JimfsFileChannel channel;
private final ListeningExecutorService executor;
public JimfsAsynchronousFileChannel(JimfsFileChannel channel, ExecutorService executor) {
this.channel = checkNotNull(channel);
this.executor = MoreExecutors.listeningDecorator(executor);
}
@Override
public long size() throws IOException {
return channel.size();
}
private <R, A> void addCallback(
ListenableFuture<R> future,
CompletionHandler<R, ? super A> handler,
@NullableDecl A attachment) {
future.addListener(new CompletionHandlerCallback<>(future, handler, attachment), executor);
}
@Override
public AsynchronousFileChannel truncate(long size) throws IOException {
channel.truncate(size);
return this;
}
@Override
public void force(boolean metaData) throws IOException {
channel.force(metaData);
}
@Override
public <A> void lock(
long position,
long size,
boolean shared,
@NullableDecl A attachment,
CompletionHandler<FileLock, ? super A> handler) {
checkNotNull(handler);
addCallback(lock(position, size, shared), handler, attachment);
}
@Override
public ListenableFuture<FileLock> lock(
final long position, final long size, final boolean shared) {
Util.checkNotNegative(position, "position");
Util.checkNotNegative(size, "size");
if (!isOpen()) {
return closedChannelFuture();
}
if (shared) {
channel.checkReadable();
} else {
channel.checkWritable();
}
return executor.submit(
new Callable<FileLock>() {
@Override
public FileLock call() throws IOException {
return tryLock(position, size, shared);
}
});
}
@Override
public FileLock tryLock(long position, long size, boolean shared) throws IOException {
Util.checkNotNegative(position, "position");
Util.checkNotNegative(size, "size");
channel.checkOpen();
if (shared) {
channel.checkReadable();
} else {
channel.checkWritable();
}
return new JimfsFileChannel.FakeFileLock(this, position, size, shared);
}
@Override
public <A> void read(
ByteBuffer dst,
long position,
@NullableDecl A attachment,
CompletionHandler<Integer, ? super A> handler) {
addCallback(read(dst, position), handler, attachment);
}
@Override
public ListenableFuture<Integer> read(final ByteBuffer dst, final long position) {
checkArgument(!dst.isReadOnly(), "dst may not be read-only");
Util.checkNotNegative(position, "position");
if (!isOpen()) {
return closedChannelFuture();
}
channel.checkReadable();
return executor.submit(
new Callable<Integer>() {
@Override
public Integer call() throws IOException {
return channel.read(dst, position);
}
});
}
@Override
public <A> void write(
ByteBuffer src,
long position,
@NullableDecl A attachment,
CompletionHandler<Integer, ? super A> handler) {
addCallback(write(src, position), handler, attachment);
}
@Override
public ListenableFuture<Integer> write(final ByteBuffer src, final long position) {
Util.checkNotNegative(position, "position");
if (!isOpen()) {
return closedChannelFuture();
}
channel.checkWritable();
return executor.submit(
new Callable<Integer>() {
@Override
public Integer call() throws IOException {
return channel.write(src, position);
}
});
}
@Override
public boolean isOpen() {
return channel.isOpen();
}
@Override
public void close() throws IOException {
channel.close();
}
/** Immediate future indicating that the channel is closed. */
private static <V> ListenableFuture<V> closedChannelFuture() {
SettableFuture<V> future = SettableFuture.create();
future.setException(new ClosedChannelException());
return future;
}
/** Runnable callback that wraps a {@link CompletionHandler} and an attachment. */
private static final class CompletionHandlerCallback<R, A> implements Runnable {
private final ListenableFuture<R> future;
private final CompletionHandler<R, ? super A> completionHandler;
@NullableDecl private final A attachment;
private CompletionHandlerCallback(
ListenableFuture<R> future,
CompletionHandler<R, ? super A> completionHandler,
@NullableDecl A attachment) {
this.future = checkNotNull(future);
this.completionHandler = checkNotNull(completionHandler);
this.attachment = attachment;
}
@Override
public void run() {
R result;
try {
result = Futures.getDone(future);
} catch (ExecutionException e) {
onFailure(e.getCause());
return;
} catch (RuntimeException | Error e) {
onFailure(e);
return;
}
onSuccess(result);
}
private void onSuccess(R result) {
completionHandler.completed(result, attachment);
}
private void onFailure(Throwable t) {
completionHandler.failed(t, attachment);
}
}
}
|
google/jimfs
|
jimfs/src/main/java/com/google/common/jimfs/JimfsAsynchronousFileChannel.java
|
Java
|
apache-2.0
| 6,873
|
setTimeout(function(){
(function(){
id = Ti.App.Properties.getString("tisink", "");
var param, xhr;
file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,"examples/youtube.html");
text = (file.read()).text
xhr = Titanium.Network.createHTTPClient();
xhr.open("POST", "http://tisink.nodester.com/");
xhr.setRequestHeader("content-type", "application/json");
param = {
data: text,
file: "youtube.html",
id: id
};
xhr.send(JSON.stringify(param));
})();
},0);
//TISINK----------------
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=320"/>
<title>YouTube Demo</title>
</head>
<body style="background:#fff;margin-top:0px;margin-left:0px">
<div>
<object width="320" height="150">
<param name="movie" value="http://www.youtube.com/watch?v=Y-mv6_YVqto"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/watch?v=Y-mv6_YVqto" type="application/x-shockwave-flash" wmode="transparent" width="320" height="150"></embed>
</object>
</div>
</body>
</html>
|
steerapi/KichenSinkLive
|
Resources/examples/youtube.html
|
HTML
|
apache-2.0
| 1,127
|
/*
* Copyright 2011-2014 Chris de Vreeze
*
* 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 nl.ebpi.yaidom.queryapitests.indexed
import java.{ util => jutil }
import scala.collection.immutable
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import nl.ebpi.yaidom.core.EName
import nl.ebpi.yaidom.core.Path
import nl.ebpi.yaidom.core.QName
import nl.ebpi.yaidom.core.Scope
import nl.ebpi.yaidom.parse.DocumentParserUsingDom
import nl.ebpi.yaidom.queryapitests.AbstractSubtypeAwareElemLikeQueryTest
import nl.ebpi.yaidom.queryapitests.AbstractSubtypeAwareElemLikeQueryTest.IndexedBridgeElem
import SubtypeAwareElemLikeQueryTest.BridgeElemTakingIndexedElem
/**
* Query test case for an XML dialect using indexed elements.
*
* @author Chris de Vreeze
*/
@RunWith(classOf[JUnitRunner])
class SubtypeAwareElemLikeQueryTest extends AbstractSubtypeAwareElemLikeQueryTest {
private val logger: jutil.logging.Logger = jutil.logging.Logger.getLogger("nl.ebpi.yaidom.queryapitests.indexed")
final type E = BridgeElemTakingIndexedElem
protected val wrappedDocumentContent: E = {
val docParser = DocumentParserUsingDom.newInstance
val docUri = classOf[AbstractSubtypeAwareElemLikeQueryTest].getResource("content.xml").toURI
val doc = docParser.parse(docUri)
new BridgeElemTakingIndexedElem(
nl.ebpi.yaidom.indexed.Document(doc.withUriOption(Some(docUri))).documentElement)
}
}
object SubtypeAwareElemLikeQueryTest {
/**
* Overridable bridge element taking a `indexed.Elem`. This is a value class instance, to prevent object creation.
*/
class BridgeElemTakingIndexedElem(val backingElem: nl.ebpi.yaidom.indexed.Elem) extends AnyVal with IndexedBridgeElem {
final type BackingElem = nl.ebpi.yaidom.indexed.Elem
final type SelfType = BridgeElemTakingIndexedElem
final type UnwrappedBackingElem = nl.ebpi.yaidom.simple.Elem
final def findAllChildElems: immutable.IndexedSeq[SelfType] =
backingElem.findAllChildElems.map(e => new BridgeElemTakingIndexedElem(e))
final def resolvedName: EName = backingElem.resolvedName
final def resolvedAttributes: immutable.Iterable[(EName, String)] = backingElem.resolvedAttributes
final def qname: QName = backingElem.qname
final def attributes: immutable.Iterable[(QName, String)] = backingElem.attributes
final def scope: Scope = backingElem.scope
final def text: String = backingElem.text
final def findChildElemByPathEntry(entry: Path.Entry): Option[SelfType] =
backingElem.findChildElemByPathEntry(entry).map(e => new BridgeElemTakingIndexedElem(e))
final def toElem: nl.ebpi.yaidom.simple.Elem = backingElem.elem
final def rootElem: UnwrappedBackingElem = backingElem.rootElem
final def path: Path = backingElem.path
final def unwrappedBackingElem: UnwrappedBackingElem = backingElem.elem
}
}
|
EBPI/yaidom
|
src/test/scala/nl/ebpi/yaidom/queryapitests/indexed/SubtypeAwareElemLikeQueryTest.scala
|
Scala
|
apache-2.0
| 3,402
|
package util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Linhong
* @email: linhong.seba.zhu@gmail.com
*/
public class StrUtil {
private static Set<Integer> windowsCharset;
/**
*
* @param str
* @return
*/
public static boolean isnumric (String str){
return str.matches("-?\\d+(\\.\\d+)?");
}
public static void PrintMap(HashMap<String,Integer> maps, BufferedWriter out){
try {
Iterator it = maps.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
out.write(pairs.getKey() + "\t" + pairs.getValue()+"\n");
}
out.close();
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static int GetMapMaxvalue(Map mp){
int max=0;
Iterator it = mp.entrySet().iterator();
while(it.hasNext()){
Map.Entry pairs=(Map.Entry)it.next();
Integer w=(Integer)pairs.getValue();
if(w>max)
max=w;
}
return max;
}
public static String fixEncoding(String latin1) {
try{
byte[] bytes = latin1.getBytes("ISO-8859-1");
if (!validUTF8(bytes))
return latin1;
return new String(bytes, "UTF-8");
} catch (Exception e) {
// Impossible, throw unchecked
throw new IllegalStateException("No Latin1 or UTF-8: " + e.getMessage());
}
}
public static ArrayList<String> Initfolder(String path){
ArrayList<String> filelists=new ArrayList<String>(100);
try {
LinkedList<String> Dir = new LinkedList<String>();
File f = new File(path);
if (f.isFile()){
filelists.add(f.getAbsolutePath());
} else {
Dir.add(f.getCanonicalPath());
while(!Dir.isEmpty()){
f = new File(Dir.pop());
if(f.isFile()){
filelists.add(f.getAbsolutePath());
} else{
String arr[] = f.list();
try{
for(int i = 0;i<arr.length;i++){
Dir.add(f.getAbsolutePath()+"/"+arr[i]);
}
}
catch(NullPointerException exp){
Dir.remove(f.getAbsoluteFile());
}
}
}
}
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
return filelists;
}
public static void CreateWindowsCharset(){
HashSet<Integer> tmp = new HashSet<>();
try {
byte[] bytes = new byte[256];
for (int i = 0; i <= 255; i++) {
bytes[i] = (byte)i;
}
String newTest = new String(bytes, "Windows-1252");
for (int i = 0; i < newTest.length(); i++) {
if (newTest.codePointAt(i) != 65533) {
tmp.add(newTest.codePointAt(i));
}
else {
tmp.add(i);
}
}
windowsCharset = Collections.unmodifiableSet(tmp);
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static String fixbrokenencoding(String s){
try {
byte[] windows = getWindowsBytes(s);
if (windows == null) {
return s;
}
String guess = new String(windows, "UTF-8");
if (isGoodConversion(guess)) {
return guess;
}
Logger.getLogger(StrUtil.class.getName()).log(Level.OFF, "Original: '{''}'{0}", s);
return s;
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
return s;
}
private static byte[] getWindowsBytes(String s) {
List<Byte> byteList = new ArrayList<>();
for (int i = 0; i < s.length(); ) {
int codePoint = s.codePointAt(i);
if (windowsCharset.contains(codePoint)) {
if (codePoint != 0x81 && codePoint != 0x8d && codePoint != 0x8f && codePoint != 0x90 && codePoint != 0x9d) {
try {
StringBuilder builder = new StringBuilder();
builder.appendCodePoint(codePoint);
for (byte b : builder.toString().getBytes("Windows-1252")) {
byteList.add(b);
}
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
else {
byteList.add((byte)codePoint);
}
}
else {
return null;
}
i += Character.charCount(codePoint);
}
byte[] bytes = new byte[byteList.size()];
for (int i = 0; i < byteList.size(); i++) {
bytes[i] = byteList.get(i);
}
return bytes;
}
public static boolean isGoodConversion(String s) {
for (int i = 0; i < s.length(); ) {
int codePoint = s.codePointAt(i);
if (codePoint == 65533) {
return false;
}
if (Character.getType(codePoint) == Character.SURROGATE) {
return false;
}
i += Character.charCount(codePoint);
}
return true;
}
public static boolean validUTF8(byte[] input) {
int i = 0;
// Check for BOM
if (input.length >= 3 && (input[0] & 0xFF) == 0xEF
&& (input[1] & 0xFF) == 0xBB & (input[2] & 0xFF) == 0xBF) {
i = 3;
}
int end;
for (int j = input.length; i < j; ++i) {
int octet = input[i];
if ((octet & 0x80) == 0) {
continue; // ASCII
}
// Check for UTF-8 leading byte
if ((octet & 0xE0) == 0xC0) {
end = i + 1;
} else if ((octet & 0xF0) == 0xE0) {
end = i + 2;
} else if ((octet & 0xF8) == 0xF0) {
end = i + 3;
} else {
// Java only supports BMP so 3 is max
return false;
}
while (i < end) {
i++;
octet = input[i];
if ((octet & 0xC0) != 0x80) {
// Not a valid trailing byte
return false;
}
}
}
return true;
}
public static void Inserthashmap(HashMap<String,Integer> firstMap, HashMap<String,Integer> secondMap){
Set<Map.Entry<String, Integer>> entries = firstMap.entrySet();
for ( Map.Entry<String, Integer> entry : entries ) {
Integer secondMapValue = secondMap.get( entry.getKey() );
if ( secondMapValue == null ) {
secondMap.put( entry.getKey(), entry.getValue() );
}
else {
secondMap.put(entry.getKey(), entry.getValue()+secondMapValue);
}
}
}
public static int EnumerateTFIDF(HashMap<String,Integer> dict, long id, int featurenodenum,HashMap<String, Integer> featureids,HashMap<String, Integer> DF, BufferedWriter out, int N){
Set<Map.Entry<String, Integer>> entries = dict.entrySet();
int newfnum=featurenodenum;
for ( Map.Entry<String, Integer> entry : entries ) {
try {
String word=entry.getKey();
int tf=entry.getValue();
int df=1;
if(DF.containsKey(word)==true)
df=DF.get(word)+1;
double tfidf=(double)tf*Math.log((double)N/df);
long wid;
if(featureids.containsKey(word)==false){
featureids.put(word, newfnum);
wid=newfnum;
newfnum++;
}else{
wid=featureids.get(word);
}
out.write((id+1)+"\t"+(wid+1)+"\t"+tfidf+"\n");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
return newfnum;
}
public static void printMap(Map mp, BufferedWriter out) {
try {
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
out.write(pairs.getKey() + "\t" + pairs.getValue()+"\n");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
out.close();
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void printMap(Map mp, BufferedWriter out,double thres) {
try {
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
double w=(double)pairs.getValue();
if(w>thres)
out.write(pairs.getKey() + "\t" + pairs.getValue()+"\n");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
out.close();
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void printMap(Map mp, BufferedWriter out, String []lists, double thres){
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
double w=(double)pairs.getValue();
String s=(String)pairs.getKey();
String []ids=s.split("\t");
if (ids.length<2)
continue;
int a=Integer.parseInt(ids[0]);
int b=Integer.parseInt(ids[1]);
if((lists[a-1]!=null&&lists[b-1]!=null&&lists[a-1].equals(lists[b-1]))||w>thres)
out.write(pairs.getKey() + "\t" + pairs.getValue()+"\n");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public static void printappendMap(Map mp, BufferedWriter out) {
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
out.write(pairs.getKey() + "\t" + pairs.getValue()+"\n");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public static void printappendMapHTML(Map mp, BufferedWriter out) {
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
if(pairs.getValue().toString().length()>6)
out.write("<li>"+pairs.getValue().toString().substring(0, 6));
else
out.write("<li>"+pairs.getValue().toString());
out.write("\t\t|||\t\t" + pairs.getKey()+"</li>");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public static void printappendMapHTML2(Map mp, BufferedWriter out) {
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
out.write("<blockquote><p>");
double count=(Double)pairs.getValue();
String content=pairs.getKey().toString();
if(content.contains("<br>")&&!content.contains("</br>")){
content.replaceAll("<br>", "");
}
if(count>1){
out.write("<span style=\"color:red\"</span>");
out.write("(Freq*Prob): "+pairs.getValue()+"\n");
out.write(content+"</p></blockquote>");
}
else{
out.write("(Freq*Prob): "+pairs.getValue()+"\n");
out.write(content+"</p></blockquote>");
}
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public static void printpruneappendMapHTML(Map mp, BufferedWriter out) {
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
try {
Map.Entry pairs = (Map.Entry)it.next();
int count=(Integer)pairs.getValue();
if(count>1)
out.write("<li>"+pairs.getKey() + "\t" + pairs.getValue()+"</li>");
} catch (IOException ex) {
Logger.getLogger(StrUtil.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public static int parseInt(String str){
int value=0;
if(str==null){
return value;
}
if(str.trim().length()>0){
try{
value = Integer.parseInt(getDigitStr(str));
}catch(Exception e){
e.printStackTrace();
}
}
return value;
}
/**
*
* @param str
* @return
*/
public static long parseLong(String str){
long value=0;
if(str==null){
return 0;
}
if(str.trim().length()>0){
try{
value = Long.parseLong(getDigitStr(str));
}catch(Exception e){
e.printStackTrace();
}
}
return value;
}
/**
*
* @param digStr
* @return
*/
public static String getDigitStr(String digStr){
if(digStr==null){
return "0";
}
StringBuffer sb=new StringBuffer();
for(int i=0; i<digStr.length(); i++){
char c=digStr.charAt(i);
if(Character.isDigit(c)){
sb.append(c);
}
}
return sb.toString().trim();
}
/**
*
* @param searchTimeStr
* @param queryRank
* @param hitRank
* @return
*/
public static String getDocId(String searchTimeStr, int queryRank, int hitRank){
StringBuffer sb= new StringBuffer();
sb.append(searchTimeStr).append(".");
if(queryRank<10){
sb.append(0);
}
sb.append(queryRank).append(".");
if(hitRank<10){
sb.append(0);
}
sb.append(hitRank);
return sb.toString().trim();
}
public static long parseDIGTime(String timestr){
long timeIns = 0;
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = (Date) formatter.parse(timestr);
timeIns = date.getTime() / 1000;
} catch (Exception e) {
e.printStackTrace();
}
return timeIns;
}
/**
*
* @param timeStr
* @return
*/
public static long parseSearchTime(String timeStr){
long timeInMillis = 0;
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
try {
Date date = (Date) formatter.parse(timeStr);
timeInMillis = date.getTime() / 1000 * 1000;
} catch (Exception e) {
e.printStackTrace();
}
return timeInMillis;
}
public static long parseHTTime(String timestr) {
long timeIns = 0;
DateFormat formatter = new SimpleDateFormat("EEEE, MMMM dd, yyyy hh:mm aa");
try {
Date date = (Date) formatter.parse(timestr);
timeIns = date.getTime() / 1000;
} catch (Exception e) {
e.printStackTrace();
}
return timeIns;
}
/**
*
* @param timeLong
* @return
*/
public static String getTimeStr(long timeLong){
Date date= new Date(timeLong);
String timeStr = new SimpleDateFormat("yyyyMMddHHmmss").format(date);
return timeStr;
}
/**
*
* @param arg
*/
public static void main(String[] arg){
//System.out.println(StrUtil.getSearchTime("20070811110001"));
long start=StrUtil.parseSearchTime("20061108010001");
long end=StrUtil.parseSearchTime("20071130220001");
long number = (end - start)/(3*3600*1000);
System.out.println(number*15);
System.out.println((float)2978/number);
System.out.println((float)44594/number/15);
long timedigit = StrUtil.parseHTTime("Saturday, December 27, 2014 8:56 PM");
System.out.println(timedigit);
}
}
|
linhongseba/ConnectedComponent
|
Connected_Comp/pre-process/src/util/StrUtil.java
|
Java
|
apache-2.0
| 18,073
|
var express = require('express');
//var db = require('../db');
var assert = require('assert');
var mongoose = require('mongoose');
var User = require('../schemas/User');
var Challenge = require('../schemas/Challenge');
var Version = require('../schemas/Version');
var ObjectId = require('mongoose').Types.ObjectId;
var router = express.Router(); // get router instance
// Connection URL
var db_url = 'mongodb://localhost:27017/openchallenge';
mongoose.connect(db_url);
router.get('/', function (req, res, next) {
res.send("Ciao chicco!");
});
router.get('/checkUpdate/:my_version', function (req, res) {
var v = req.params.my_version;
Version.findOne().exec(function (err, version) {
if (err) res.send("Errore");
else {
if (v != version.version)
res.send("yes");
else res.send("no");
}
})
});
router.get('/newUpdate/:my_version', function (req, res) {
var v = new Version({'version': req.params.my_version});
Version.findOneAndUpdate({}, {'version': req.params.my_version}, { upsert: true} ).exec(function (err) {
if (err) res.send("Errrore");
else res.send("Updated!")
});
});
/*****************************************************************************
*
* API to manage CHALLENGES
*
*/
router.post('/newChallenge', function (req, res) {
var obj = req.body;
User.findOne({'uid': obj.organizer})
.exec(function (err, user) {
assert.equal(err, null);
var dat = obj.date.split("/");
var challenge = new Challenge({
name: obj.name,
description: obj.description,
rules: obj.rules,
image: obj.image,
location: {
address: obj.location.address,
lat: obj.location.lat,
long: obj.location.long
},
organizer: user._id,
participants: [],
invited: [],
isTerminated: false
});
challenge.date = new Date(Date.UTC(dat[2], dat[1] - 1, dat[0], 0, 0, 0, 0));
/*
if (challenge.date < Date.now()) challenge.isTerminated = true;
*/
challenge.save(function (err, chall) {
if (err) {
res.send("Error");
console.log("Error saving new challenge");
} else {
User.findByIdAndUpdate(
user._id,
{$addToSet: {organizedChallenges: chall._id}},
function (errr) {
if (errr) {
res.send("Error updating users");
}
else res.send("Saved!");
}
)
}
})
});
});
router.get('/getNumParticipants/:id_chall/:user_uid', function (req, res, next) {
var user_uid = req.params.user_uid;
var chall_id = req.params.id_chall;
User.findOne({'uid': user_uid})
.exec(function (err, user) {
Challenge.aggregate([
{$match: {'_id': mongoose.Types.ObjectId(chall_id)}},
{ //add number participants field
$addFields: {
numParticipants: {$size: '$participants'}
}
},
{ //select only participants array that will be populated later and numPart
$project: {
numParticipants: 1,
_id: 0,
participants: 1
}
}
]).exec(function (err, chall) {
if (err) res.send("Err");
else {
//check if you participate in this challenge (we can change with joined challenges)
var part = chall[0].participants;
var found = false;
for (var i = 0; i < part.length; i++) {
if (part[i].toString() == user._id.toString()) {
found = true;
break;
}
}
Challenge.populate(chall,
{
path: 'participants',
select: 'picture',
options: {limit: 3}
},
function (err, challPop) {
//adding youparticipate field
challPop[0].joined = found;
res.send(challPop)
})
}
});
});
});
router.get('/allChallenges', function (req, res, next) {
Challenge.find()
.select('name description rules image location date organizer isTerminated')
.sort({date: 1})
.populate({
path: 'organizer'
})
.exec(function (err, challenge) {
assert.equal(err, null);
res.send(challenge);
})
});
router.get('/activeChallenges', function (req, res) {
Challenge.find({isTerminated: false})
.select('name description rules image location date organizer isTerminated')
.sort({date: 1})
.populate({
path: 'organizer'
})
.exec(function (err, challenge) {
assert.equal(err, null);
res.send(challenge);
})
});
router.get('/addParticipant/:challenge_id/:user_id', function (req, res) {
var challenge_id = req.params.challenge_id;
var user_id = req.params.user_id;
User.findOneAndUpdate({'uid': user_id}, {$addToSet: {joinedChallenges: challenge_id}}) // add to joined list
.exec(function (err, user) {
if (err) res.send("Error in finding and updating joined list");
else {
Challenge.findByIdAndUpdate(
challenge_id,
{$addToSet: {"participants": user._id}}, // do not add if already present
{safe: true, upsert: true},
function (err) {
if (err) {
res.send('Error in finding and updating participants list');
console.log(err);
}
else res.send('you participate now!')
}
);
}
});
});
router.get('/removeParticipant/:chall_id/:user_id', function (req, res) {
var chall_id = req.params.chall_id;
var user_id = req.params.user_id;
User.findOneAndUpdate({'uid': user_id}, {$pull: {joinedChallenges: chall_id}}) // remove from joined list
.exec(function (err, user) {
if (err) res.send("Error");
else {
Challenge.findByIdAndUpdate(
chall_id,
{$pull: {"participants": user._id}},
{safe: true, upsert: true},
function (err) {
if (err) {
res.send('Error');
console.log(err);
}
else res.send('removed!');
}
);
}
});
});
router.get('/getParticipants/:chall_id', function (req, res, next) {
Challenge.findById(req.params.chall_id)
.populate('participants')
.exec(function (err, chall) {
assert.equal(err, null);
res.send(chall.participants);
})
});
router.get('/terminateChallenge/:challenge_id', function (req, res) {
Challenge.findByIdAndUpdate(req.params.challenge_id,
{isTerminated: true},
function (err, challenge) {
assert.equal(err, null);
res.send("Challenge " + challenge.name + " terminated")
});
});
router.post('/setWinners/:ch_id', function (req, res) {
var podium = req.body;
Challenge.findByIdAndUpdate(req.params.ch_id,
{
"winner": ObjectId(podium.first),
"secondPlace": ObjectId(podium.second),
"thirdPlace": ObjectId(podium.third)
},
function (err, challenge) {
if (err) console.log(err);
assert.equal(err, null);
});
// update medals
var errors = false;
User.findByIdAndUpdate(
podium.first,
{$inc: {'gold': 1}},
{safe: true, upsert: true},
function (err) {
errors = errors || err;
User.findByIdAndUpdate(
podium.second,
{$inc: {'silver': 1}},
{safe: true, upsert: true},
function (err) {
errors = errors || err;
User.findByIdAndUpdate(
podium.third,
{$inc: {'bronze': 1}},
{safe: true, upsert: true},
function (err) {
errors = errors || err;
assert.equal(errors, null);
console.log(errors);
res.send(errors);
});
});
});
});
router.get('/winners/:challenge_id', function (req, res) {
Challenge.findById(req.params.challenge_id)
.populate('winner secondPlace thirdPlace')
.exec(function (err, challenge) {
assert.equal(err, null);
var winners = [];
winners.push(challenge.winner);
winners.push(challenge.secondPlace);
winners.push(challenge.thirdPlace);
res.json(winners);
});
});
router.get('/invite/:challenge_id/:user_id', function (req, res) {
var challenge_id = req.params.challenge_id;
var user_id = req.params.user_id;
User.findByIdAndUpdate(user_id, {$addToSet: {invitations: challenge_id}})
.exec(function (err, user) {
if (err) res.send("Error in finding and updating invitations list");
else {
Challenge.findByIdAndUpdate(
challenge_id,
{$addToSet: {"invitedList": user._id}}, // do not add if already present
{safe: true, upsert: true},
function (err) {
if (err) {
res.send('Error in finding and updating invited list');
console.log(err);
} else res.send('you have been invited!')
});
}
});
});
router.get('/cancelInvite/:challenge_id/:user_id', function (req, res) {
var challenge_id = req.params.challenge_id;
var user_id = req.params.user_id;
User.findByIdAndUpdate(user_id, {$pull: {invitations: challenge_id}})
.exec(function (err, user) {
if (err) res.send("Error in finding and updating invitations list");
else {
Challenge.findByIdAndUpdate(
challenge_id,
{$pull: {"invitedList": user._id}}, // do not add if already present
{safe: true, upsert: true},
function (err) {
if (err) {
res.send('Error in finding and updating invited list');
console.log(err);
} else res.send('you participate now!')
});
}
});
});
router.get('/usersInvited/:challenge_id', function (req, res) {
Challenge.findById(req.params.challenge_id)
.populate('invitedList')
.exec(function (err, challenge) {
assert.equal(err, null);
res.send(challenge.invitedList);
});
});
/*****************************************************************************
*
* API to manage USERS
*
*/
router.post('/newUser', function (req, res) {
var obj = req.body;
var user = new User({
username: obj.username,
status: obj.status,
picture: obj.picture,
rate: 0,
gold: 0,
silver: 0,
bronze: 0,
uid: obj.uid,
joinedChallenges: [],
organizedChallenges: [],
invitations: [],
following: []
});
User.findOne({'username': user.username}).exec(function (err, u) {
if (err) res.send("Error!");
else if (u) {
res.send("already exists");
}
else {
user.save(function (err) {
if (err) res.send("Error");
else res.send("User " + user.username + " created!");
});
}
});
});
router.get('/deleteUser/:user', function (req, res) {
User.deleteOne({_id: req.params.user})
.exec(function (err) {
assert.equal(err, null);
res.send('deleted');
})
});
router.get('/allUsers', function (req, res) {
User.find(function (err, users) {
assert.equal(err, null);
res.send(users);
});
});
router.get('/findUsers/:user', function (req, res) {
var user = req.params.user;
User.find({'username': new RegExp('^' + user, "i")}).exec(function (err, users) {
if (err) res.send('Error');
else res.send(users);
});
});
router.get('/findUserByUid/:uid', function (req, res) {
var user_id = req.params.uid;
User.findOne({'uid': user_id})
.exec(function (err, user) {
if (err) res.send("Error");
if (user)
res.send(user);
else
res.send("No user found");
});
});
router.get('/organizedChallenges/:user_id', function (req, res) {
User.findById(req.params.user_id)
.populate({
path: 'organizedChallenges',
populate: {
path: 'organizer',
select: 'username picture uid rate'
}
})
.exec(function (err, user) {
assert.equal(err, null);
res.json(user.organizedChallenges);
});
});
router.get('/joinedChallenges/:user_id', function (req, res) {
User.findById(req.params.user_id)
.populate({
path: 'joinedChallenges',
populate: {
path: 'organizer',
select: 'username picture uid rate'
}
})
.exec(function (err, user) {
assert.equal(err, null);
res.json(user.joinedChallenges);
});
});
/**
* request must be a json object in this form:
* {
* "new_status" : "text of the new status"
* }
*/
router.post('/setStatus/:user_id', function (req, res) {
User.findByIdAndUpdate(req.params.user_id, {status: req.body.new_status},
function (err, user) {
assert.equal(err, null);
res.send("Successfully updated status of " + user.username);
});
});
router.get('/follow/:user_uid/:followed', function (req, res) {
User.findOneAndUpdate({'uid': req.params.user_uid},
{$addToSet: {'following': req.params.followed}},
function (err) {
if (err) console.log(err);
assert.equal(err, null);
res.send(err);
});
});
router.get('/unfollow/:user_uid/:followed', function (req, res) {
User.findOneAndUpdate({'uid': req.params.user_uid},
{$pull: {'following': req.params.followed}},
function (err) {
if (err) console.log(err);
assert.equal(err, null);
res.send(err);
});
});
router.get('/following/:user_uid', function (req, res) {
User.findOne({'uid': req.params.user_uid})
.populate({
path: 'following'
})
.exec(function (err, user) {
assert.equal(err, null);
res.json(user.following);
});
});
router.post('/setWinners', function (req, res) {
var obj = req.body;
var errors = false;
User.findByIdAndUpdate(
obj.first,
{$inc: {'gold': 1}},
{safe: true, upsert: true},
function (err) {
errors = errors || err;
User.findByIdAndUpdate(
obj.second,
{$inc: {'silver': 1}},
{safe: true, upsert: true},
function (err) {
errors = errors || err;
User.findByIdAndUpdate(
obj.third,
{$inc: {'bronze': 1}},
{safe: true, upsert: true},
function (err) {
errors = errors || err;
console.log(errors);
res.send(errors);
});
});
});
});
router.get('/pendingInvitations/:user_id', function (req, res) {
User.findById(req.params.user_id)
.populate({
path: 'invitations',
populate: {
path: 'organizer',
select: 'username picture uid rate'
}
})
.exec(function (err, user) {
assert.equal(err, null);
res.json(user.invitations);
});
});
module.exports = router;
|
gnufsociety/openchallenge
|
server/routes/api.js
|
JavaScript
|
apache-2.0
| 17,448
|
package com.melon.modules.jdk8.entity;
/**
* .
* User: xiongjinteng@raycloud.com
* Date: 2017/6/17
* Time: 19:33
*/
public class Data {
}
|
Ansafari/melon
|
melon-sample-jdk8/src/main/java/com/melon/modules/jdk8/entity/Data.java
|
Java
|
apache-2.0
| 145
|
/*
* Copyright 2020 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.
*/
package org.jboss.as.arquillian.container.bootable;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.jboss.as.arquillian.container.CommonManagedDeployableContainer;
import org.jboss.as.arquillian.container.ParameterUtils;
import org.jboss.logging.Logger;
import org.wildfly.core.launcher.BootableJarCommandBuilder;
import org.wildfly.core.launcher.CommandBuilder;
/**
* The managed deployable container for a bootable JAR.
*
* @author jdenise@redhat.com
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
* @since 3.0.0
*/
public final class BootableDeployableContainer extends CommonManagedDeployableContainer<BootableContainerConfiguration> {
private final Logger log = Logger.getLogger(BootableDeployableContainer.class.getName());
@Override
public Class<BootableContainerConfiguration> getConfigurationClass() {
return BootableContainerConfiguration.class;
}
@Override
@SuppressWarnings("FeatureEnvy")
protected CommandBuilder createCommandBuilder(final BootableContainerConfiguration config) {
final BootableJarCommandBuilder commandBuilder = BootableJarCommandBuilder.of(config.getJarFile());
final String path = config.getInstallDir();
if (path != null) {
final Path installDir = Paths.get(path);
// Workaround for https://issues.redhat.com/browse/WFCORE-5062
if (Files.notExists(installDir)) {
try {
Files.createDirectories(installDir);
} catch (IOException e) {
throw new UncheckedIOException(String.format("Failed to create directory %s", installDir), e);
}
}
commandBuilder.setInstallDir(installDir);
}
final String javaOpts = config.getJavaVmArguments();
final String jbossArguments = config.getJbossArguments();
commandBuilder.setJavaHome(config.getJavaHome());
if (javaOpts != null && !javaOpts.trim().isEmpty()) {
commandBuilder.setJavaOptions(ParameterUtils.splitParams(javaOpts));
}
if (config.isEnableAssertions()) {
commandBuilder.addJavaOption("-ea");
}
if (jbossArguments != null && !jbossArguments.trim().isEmpty()) {
commandBuilder.addServerArguments(ParameterUtils.splitParams(jbossArguments));
}
return commandBuilder;
}
@Override
protected Logger getLogger() {
return log;
}
}
|
jamezp/wildfly-arquillian
|
container-bootable/src/main/java/org/jboss/as/arquillian/container/bootable/BootableDeployableContainer.java
|
Java
|
apache-2.0
| 3,198
|
/**
* <p>
* Provides classes and interfaces to work and resolve external Apache Solr
* Maven artifacts.
* </p>
*/
package com.ffbit.maven.solr.artefact.external;
|
ffbit/solr-maven-plugin
|
src/main/java/com/ffbit/maven/solr/artefact/external/package-info.java
|
Java
|
apache-2.0
| 175
|
package jepperscore.scraper.etl;
import java.util.Arrays;
import org.apache.commons.cli.ParseException;
/**
* This main class delegates to the Scraper or Install class depending on the first argument.
* @author Chuck
*
*/
public class Main {
/**
* This main function delegates to either the Scraper or Install mains.
* @param args The command line arguments.
* @throws ParseException Thrown from Scraper or Install.
*/
public static void main(String[] args) throws ParseException {
if (args.length == 0) {
throw new RuntimeException("Please specify either Scraper or Install as the first argument.");
}
String[] remainingArgs = args.length == 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length);
if ("Scraper".equalsIgnoreCase(args[0])) {
ScraperMain.main(remainingArgs);
} else if ("Install".equalsIgnoreCase(args[0])) {
//InstallMain.main(remainingArgs);
} else {
throw new RuntimeException("Please specify either Scraper or Install as the first argument.");
}
}
}
|
SiphonSquirrel/jepperscore
|
scrapers/etl/src/main/java/jepperscore/scraper/etl/Main.java
|
Java
|
apache-2.0
| 1,024
|
//
// AppDelegate.h
// adb-ios
//
// Created by Li Zonghai on 9/28/15.
// Copyright (c) 2015 Li Zonghai. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
zonghai-li/adb-ios
|
adb-ios/AppDelegate.h
|
C
|
apache-2.0
| 278
|
/*
* Copyright 2019 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.web.calltree.span;
import com.navercorp.pinpoint.common.server.bo.SpanBo;
import com.navercorp.pinpoint.common.server.bo.SpanChunkBo;
import com.navercorp.pinpoint.common.server.bo.SpanEventBo;
import com.navercorp.pinpoint.common.util.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* @author Woonduk Kang(emeroad)
*/
public class Node {
private static final Logger logger = LoggerFactory.getLogger(Node.class);
private final SpanBo span;
private final SpanCallTree spanCallTree;
private boolean linked = false;
private boolean corrupted = false;
private List<Align> alignList;
private SpanAsyncEventMap asyncSpanEventMap;
public Node(final SpanBo span, final SpanCallTree spanCallTree) {
this.span = Objects.requireNonNull(span, "span");
this.spanCallTree = Objects.requireNonNull(spanCallTree, "spanCallTree");
}
public SpanBo getSpanBo() {
return span;
}
public SpanCallTree getSpanCallTree() {
return spanCallTree;
}
public boolean isLinked() {
return linked;
}
public void setLinked(boolean linked) {
this.linked = linked;
}
public boolean isCorrupted() {
return corrupted;
}
public void setCorrupted(boolean corrupted) {
this.corrupted = corrupted;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("applicationId").append(span.getApplicationId());
sb.append(", agentId=").append(span.getAgentId());
sb.append(", parentSpanId=").append(span.getParentSpanId());
sb.append(", spanId=").append(span.getSpanId());
sb.append(", startTime=").append(span.getStartTime());
sb.append(", elapsed=").append(span.getElapsed());
sb.append(", collectorAcceptTime=").append(span.getCollectorAcceptTime());
sb.append(", linked=").append(linked);
sb.append('}');
return sb.toString();
}
private Align newSpanEventAlign(SpanEventBo spanEventBo) {
Objects.requireNonNull(spanEventBo, "spanEventBo");
return new SpanEventAlign(span, spanEventBo);
}
private Align newSpanEventAlign(SpanChunkBo spanChunkBo, SpanEventBo spanEventBo) {
Objects.requireNonNull(spanChunkBo, "spanChunkBo");
Objects.requireNonNull(spanEventBo, "spanEventBo");
return new SpanChunkEventAlign(span, spanChunkBo, spanEventBo);
}
public static Node toNode(SpanBo span) {
SpanCallTree spanCallTree = new SpanCallTree(new SpanAlign(span));
return Node.build(span, spanCallTree);
}
public static Node build(SpanBo spanBo, SpanCallTree spanCallTree) {
Objects.requireNonNull(spanBo, "spanBo");
Objects.requireNonNull(spanCallTree, "spanCallTree");
Node node = new Node(spanBo, spanCallTree);
node.alignList = buildAlignList(spanBo, node);
node.asyncSpanEventMap = SpanAsyncEventMap.build(spanBo);
return node;
}
private static List<Align> buildAlignList(SpanBo spanBo, Node node) {
List<SpanEventBo> spanEventBoList = spanBo.getSpanEventBoList();
List<Align> alignList = node.buildAlignList(spanEventBoList);
List<SpanChunkBo> spanChunkBoList = spanBo.getSpanChunkBoList();
List<Align> chunkSpanEventList = node.buildSpanChunkBaseAligns(spanChunkBoList);
return mergeAndSort(alignList, chunkSpanEventList);
}
private static List<Align> mergeAndSort(List<Align> alignList1, List<Align> alignList2) {
List<Align> mergedList = ListUtils.union(alignList1, alignList2);
mergedList.sort(AlignComparator.INSTANCE);
return mergedList;
}
private List<Align> buildAlignList(List<SpanEventBo> spanEventBoList) {
if (CollectionUtils.isEmpty(spanEventBoList)) {
return Collections.emptyList();
}
List<Align> alignList = new ArrayList<>();
for (SpanEventBo spanEventBo : spanEventBoList) {
if (logger.isDebugEnabled()) {
logger.debug("Populate spanEvent{seq={}, depth={}, event={}}", spanEventBo.getSequence(), spanEventBo.getDepth(), spanEventBo);
}
final Align spanEventAlign = this.newSpanEventAlign(spanEventBo);
alignList.add(spanEventAlign);
}
return alignList;
}
public List<Align> getAlignList() {
return alignList;
}
public SpanAsyncEventMap getAsyncSpanEventMap() {
return asyncSpanEventMap;
}
private List<Align> buildSpanChunkBaseAligns(List<SpanChunkBo> spanChunkBoList) {
if (CollectionUtils.isEmpty(spanChunkBoList)) {
return Collections.emptyList();
}
List<Align> alignList = new ArrayList<>();
for (SpanChunkBo chunkBo : spanChunkBoList) {
if (chunkBo.isAsyncSpanChunk()) {
// asyncSpanEvent
continue;
}
List<SpanEventBo> spanEventList = chunkBo.getSpanEventBoList();
for (SpanEventBo spanEventBo : spanEventList) {
if (logger.isTraceEnabled()) {
logger.trace("Populate spanEvent{seq={}, depth={}, event={}}", spanEventBo.getSequence(), spanEventBo.getDepth(), spanEventBo);
}
final Align spanEventAlign = this.newSpanEventAlign(chunkBo, spanEventBo);
alignList.add(spanEventAlign);
}
}
return alignList;
}
}
|
naver/pinpoint
|
web/src/main/java/com/navercorp/pinpoint/web/calltree/span/Node.java
|
Java
|
apache-2.0
| 6,333
|
#!/usr/bin/env python
import os.path
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r"/", MainHandler),
]
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
debug=True,
autoescape=None
)
tornado.web.Application.__init__(self, handlers, **settings)
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.render(
"index.html",
page_title = "Burt's Books | Home",
header_text = "Welcome to Burt's Books!",
footer_text = "For more information, please email us at <a href=\"mailto:contact@burtsbooks.com\">contact@burtsbooks.com</a>.",
)
def main():
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
if __name__ == "__main__":
main()
|
iamaris/xtornado
|
test/Introduction-to-Tornado-master/template_basics/bookstore/main.py
|
Python
|
apache-2.0
| 1,173
|
/*
* Copyright 1999-2018 Alibaba Group Holding 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 com.alibaba.csp.sentinel.cluster.flow.statistic.concurrent.expire;
import com.alibaba.csp.sentinel.cluster.flow.rule.ClusterFlowRuleManager;
import com.alibaba.csp.sentinel.cluster.flow.statistic.concurrent.CurrentConcurrencyManager;
import com.alibaba.csp.sentinel.cluster.flow.statistic.concurrent.TokenCacheNode;
import com.alibaba.csp.sentinel.cluster.server.connection.ConnectionManager;
import com.alibaba.csp.sentinel.concurrent.NamedThreadFactory;
import com.alibaba.csp.sentinel.log.RecordLog;
import com.alibaba.csp.sentinel.util.AssertUtil;
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* We need to consider the situation that the token client goes offline
* or the resource call times out. It can be detected by sourceTimeout
* and clientTimeout. The resource calls timeout detection is triggered
* on the token client. If the resource is called over time, the token
* client will request the token server to release token or refresh the
* token. The client offline detection is triggered on the token server.
* If the offline detection time is exceeded, token server will trigger
* the detection token client’s status. If the token client is offline,
* token server will delete the corresponding tokenId. If it is not offline,
* token server will continue to save it.
*
* @author yunfeiyanggzq
**/
public class RegularExpireStrategy implements ExpireStrategy {
/**
* The max number of token deleted each time,
* the number of expired key-value pairs deleted each time does not exceed this number
*/
private long executeCount = 1000;
/**
* Length of time for task execution
*/
private long executeDuration = 800;
/**
* Frequency of task execution
*/
private long executeRate = 1000;
/**
* the local cache of tokenId
*/
private ConcurrentLinkedHashMap<Long, TokenCacheNode> localCache;
@SuppressWarnings("PMD.ThreadPoolCreationRule")
private static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1,
new NamedThreadFactory("regular clear expired token thread", true));
public RegularExpireStrategy(ConcurrentLinkedHashMap<Long, TokenCacheNode> localCache) {
AssertUtil.isTrue(localCache != null, " local cache can't be null");
this.localCache = localCache;
}
@Override
public void startClearTaskRegularly() {
executor.scheduleAtFixedRate(new ClearExpiredTokenTask(), 0, executeRate, TimeUnit.MILLISECONDS);
}
private class ClearExpiredTokenTask implements Runnable {
@Override
public void run() {
try {
clearToken();
} catch (Throwable e) {
e.printStackTrace();
RecordLog.warn("[RegularExpireStrategy] undefined throwable during clear token: ", e);
}
}
}
private void clearToken() {
long start = System.currentTimeMillis();
List<Long> keyList = new ArrayList<>(localCache.keySet());
for (int i = 0; i < executeCount && i < keyList.size(); i++) {
// time out execution exit
if (System.currentTimeMillis() - start > executeDuration) {
RecordLog.info("[RegularExpireStrategy] End the process of expired token detection because of execute time is more than executeDuration: {}", executeDuration);
break;
}
Long key = keyList.get(i);
TokenCacheNode node = localCache.get(key);
if (node == null) {
continue;
}
// remove the token whose client is offline and saved for more than clientTimeout
if (!ConnectionManager.isClientOnline(node.getClientAddress()) && node.getClientTimeout() - System.currentTimeMillis() < 0) {
removeToken(key, node);
RecordLog.info("[RegularExpireStrategy] Delete the expired token<{}> because of client offline for ruleId<{}>", node.getTokenId(), node.getFlowId());
continue;
}
// If we find that token's save time is more than 2 times of the client's call resource timeout time,
// the token will be determined to timeout.
long resourceTimeout = ClusterFlowRuleManager.getFlowRuleById(node.getFlowId()).getClusterConfig().getResourceTimeout();
if (System.currentTimeMillis() - node.getResourceTimeout() > resourceTimeout) {
removeToken(key, node);
RecordLog.info("[RegularExpireStrategy] Delete the expired token<{}> because of resource timeout for ruleId<{}>", node.getTokenId(), node.getFlowId());
}
}
}
private void removeToken(long tokenId, TokenCacheNode node) {
if (localCache.remove(tokenId) == null) {
RecordLog.info("[RegularExpireStrategy] Token<{}> is already released for ruleId<{}>", tokenId, node.getFlowId());
return;
}
AtomicInteger nowCalls = CurrentConcurrencyManager.get(node.getFlowId());
if (nowCalls == null) {
return;
}
nowCalls.getAndAdd(node.getAcquireCount() * -1);
}
}
|
alibaba/Sentinel
|
sentinel-cluster/sentinel-cluster-server-default/src/main/java/com/alibaba/csp/sentinel/cluster/flow/statistic/concurrent/expire/RegularExpireStrategy.java
|
Java
|
apache-2.0
| 6,059
|
/*
* 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.hadoop.chukwa.rest;
import junit.framework.TestCase;
import java.util.*;
import java.sql.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.chukwa.database.DatabaseConfig;
import org.apache.hadoop.chukwa.database.Macro;
import org.apache.hadoop.chukwa.util.DatabaseWriter;
public class TestDatabaseMrJobTest extends DatabaseRestServerSetup {
/* testing setup */
public TestDatabaseMrJobTest() {
super();
this.tableName="mr_job";
this.insertString="insert into [mr_job] ("+
"job_id,submit_time,launch_time,finish_time"+
") values (\""+time.getTime()+"\",\""+this.dateString+"\",\""+this.dateString+"\",\""+this.dateString+"\")";
this.deleteString="delete from [mr_job] where "+
"job_id=\""+time.getTime()+"\" ";
}
/* run the test */
public void test() {
// test xml
String string = resource.path("mr_job/job_id/"+time.getTime()).accept("application/xml").get(String.class);
checkXML(string);
string = resource.path("mr_job/job_id/"+time.getTime()).accept("application/json").get(String.class);
checkJson(string);
string = resource.path("mr_job/job_id/"+time.getTime()).accept("text/csv").get(String.class);
checkCsv(string);
}
}
|
intel-hadoop/HiTune
|
chukwa-hitune-dist/src/test/org/apache/hadoop/chukwa/rest/TestDatabaseMrJobTest.java
|
Java
|
apache-2.0
| 2,128
|
\documentclass[a4paper,11pt]{exam}
\printanswers % pour imprimer les réponses (corrigé)
%\noprintanswers % Pour ne pas imprimer les réponses (énoncé)
\addpoints % Pour compter les points
% \noaddpoints % pour ne pas compter les points
%\pointsinmargin
%\qformat{\textbf{\thequestion ) } }
\qformat{\textbf{\thequestion )} (\textit{\thepoints}) \\ } % Pour définir le style des questions (facultatif)
\usepackage{color} % définit une nouvelle couleur
\shadedsolutions % définit le style des réponses
% \framedsolutions % définit le style des réponses
\definecolor{SolutionColor}{rgb}{0.8,0.9,1} % bleu ciel
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent} % Définit le titre des solutions
\usepackage{multicol}
\usepackage{caption}
\usepackage{tikz}
\usepackage{tkz-tab}
\usepackage{array}
\usetikzlibrary{trees}
\usepackage[final]{pdfpages}
\input{../../../../monbacblanc}
%\usepackage{../../pas-math}
%\usepackage{../../moncours}
%\usepackage{pas-cours}
\input{../../../../utils_maths}
%\usepackage{fullpage}
\author{\ }
\date{24 Décembre 2017}
\title{Terminale ST$_2$S : DS num\'ero 2}
\begin{document}
% \usepackage{fancyhdr}
%
% \pagestyle{fancy}
% \fancyhf{}
%\rhead{Share\LaTeX}
%\maketitle
\input{title}
\
\
\\
\newpage
\input{vrai_faux}
\newpage
\input{tabac}
%
\newpage
%
\input{naissances}
%
%\appendix
\label{LastPage}
%\newpage
%\thispagestyle{empty}
\includepdf[pages={2}]{essai}
%\include{pap_milli}
%\label{annexe}
\end{document}
|
malhys/maths_projects
|
bac_techno/TST2S/bac_blanc/bac_blanc_2018_04/bb_04-18.tex
|
TeX
|
apache-2.0
| 1,520
|
package com.visualthreat.api;
import com.visualthreat.api.data.Device;
import com.visualthreat.api.exception.APIAuthException;
import com.visualthreat.api.exception.APIException;
import com.visualthreat.api.v1.APIImpl;
import com.visualthreat.api.v1.Token;
import java.util.Collection;
/**
* Interface for 3rd party API.
* Connects to CAN bus devices via VT cloud.
*/
public interface API {
static API get() {
return new APIImpl();
}
/**
* Authenticates application in VT Cloud. Should be ran before other methods.
*
* @param apiKey Your API key.
* @param secret Your secret.
* @return Your access token.
* @throws APIAuthException Thrown if apiKey and secret aren't correct.
*/
Token authenticate(final String apiKey, final String secret) throws APIAuthException;
/**
* @param token You access token.
* @return Connected devices, available for your API key (for current and future time slots).
*/
Collection<Device> getConnectedDevices(final Token token) throws APIException;
/**
* Tries to connect to a device.
*
* @param device Device to connect to.
* @param token You access token.
* @return API connection to send and receive CAN frames from/to device.
*/
VTCloud connectToDevice(final Device device, final Token token) throws APIException;
}
|
vt-dev/sdk
|
java/sdk/src/main/java/com/visualthreat/api/API.java
|
Java
|
apache-2.0
| 1,326
|
package sg.edu.nus.iss.phoenix.schedule.entity;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.sql.*;
import static org.junit.Assert.*;
/**
* Created by GONG MENGNAN on 2/10/17.
*/
public class ProgramSlotTest {
private ProgramSlot programSlot;
@Before
public void setUp() throws Exception {
//String iName, java.sql.Date iDateofProgram, Integer iDuration, Integer iStartTime,
//String iRadioProgram, String iPresenter, String iProducer
programSlot = new ProgramSlot("name",new Date(2017, 9, 9), 2, new Time(12, 12, 12), "program4", "presenter5", "producer6");
}
@After
public void tearDown() throws Exception {
programSlot = null;
}
@Test
public void TestName() {
assertEquals(programSlot.getName(),"name");
}
@Test
public void TestDateOfProgram() {
assertEquals(programSlot.getDateOfProgram(),new Date(2017, 9, 9));
}
@Test
public void TestDuration() {
assertEquals(programSlot.getDuration(),new Integer(2));
}
@Test
public void TestStartTime() {
assertEquals(programSlot.getStartTime(),new Time(12, 12, 12));
}
@Test
public void TestPresenter() {
assertEquals(programSlot.getPresenter(),"presenter5");
}
@Test
public void TestProducer() {
assertEquals(programSlot.getProducer(),"producer6");
}
}
|
rahulnusiss/PRMS_Android
|
app/src/test/java/sg/edu/nus/iss/phoenix/schedule/entity/ProgramSlotTest.java
|
Java
|
apache-2.0
| 1,430
|
<?php
/* :category:show.html.twig */
class __TwigTemplate_57298564d32bdea85384e4f186ec6a90600abbd0466ee4f7afbe0495b8305ed7 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
$this->parent = $this->loadTemplate("base.html.twig", ":category:show.html.twig", 1);
$this->blocks = array(
'body' => array($this, 'block_body'),
);
}
protected function doGetParent(array $context)
{
return "base.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_body($context, array $blocks = array())
{
// line 4
echo " <h1>Category</h1>
<table>
<tbody>
<tr>
<th>Id</th>
<td>";
// line 10
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["category"]) ? $context["category"] : null), "id", array()), "html", null, true);
echo "</td>
</tr>
<tr>
<th>Name</th>
<td>";
// line 14
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["category"]) ? $context["category"] : null), "name", array()), "html", null, true);
echo "</td>
</tr>
</tbody>
</table>
<ul>
<li>
<a href=\"";
// line 21
echo $this->env->getExtension('routing')->getPath("category_index");
echo "\">Back to the list</a>
</li>
<li>
<a href=\"";
// line 24
echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("category_edit", array("id" => $this->getAttribute((isset($context["category"]) ? $context["category"] : null), "id", array()))), "html", null, true);
echo "\">Edit</a>
</li>
<li>
";
// line 27
echo $this->env->getExtension('form')->renderer->renderBlock((isset($context["delete_form"]) ? $context["delete_form"] : null), 'form_start');
echo "
<input type=\"submit\" value=\"Delete\">
";
// line 29
echo $this->env->getExtension('form')->renderer->renderBlock((isset($context["delete_form"]) ? $context["delete_form"] : null), 'form_end');
echo "
</li>
</ul>
";
}
public function getTemplateName()
{
return ":category:show.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 73 => 29, 68 => 27, 62 => 24, 56 => 21, 46 => 14, 39 => 10, 31 => 4, 28 => 3, 11 => 1,);
}
}
/* {% extends 'base.html.twig' %}*/
/* */
/* {% block body %}*/
/* <h1>Category</h1>*/
/* */
/* <table>*/
/* <tbody>*/
/* <tr>*/
/* <th>Id</th>*/
/* <td>{{ category.id }}</td>*/
/* </tr>*/
/* <tr>*/
/* <th>Name</th>*/
/* <td>{{ category.name }}</td>*/
/* </tr>*/
/* </tbody>*/
/* </table>*/
/* */
/* <ul>*/
/* <li>*/
/* <a href="{{ path('category_index') }}">Back to the list</a>*/
/* </li>*/
/* <li>*/
/* <a href="{{ path('category_edit', { 'id': category.id }) }}">Edit</a>*/
/* </li>*/
/* <li>*/
/* {{ form_start(delete_form) }}*/
/* <input type="submit" value="Delete">*/
/* {{ form_end(delete_form) }}*/
/* </li>*/
/* </ul>*/
/* {% endblock %}*/
/* */
|
stack-this/hunter-price
|
app/cache/prod/twig/47/4727eb15e5b8b45a0332152a2d4c12dfea2972d737b7f5622a87b87e20e75f51.php
|
PHP
|
apache-2.0
| 3,797
|
# 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
#
# 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.
def load_table_uri_parquet(table_id):
# [START bigquery_load_table_gcs_parquet]
from google.cloud import bigquery
# Construct a BigQuery client object.
client = bigquery.Client()
# TODO(developer): Set table_id to the ID of the table to create.
# table_id = "your-project.your_dataset.your_table_name"
job_config = bigquery.LoadJobConfig(source_format=bigquery.SourceFormat.PARQUET,)
uri = "gs://cloud-samples-data/bigquery/us-states/us-states.parquet"
load_job = client.load_table_from_uri(
uri, table_id, job_config=job_config
) # Make an API request.
load_job.result() # Waits for the job to complete.
destination_table = client.get_table(table_id)
print("Loaded {} rows.".format(destination_table.num_rows))
# [END bigquery_load_table_gcs_parquet]
|
googleapis/python-bigquery
|
samples/load_table_uri_parquet.py
|
Python
|
apache-2.0
| 1,400
|
<!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-google-v5) on Thu Dec 19 17:42:45 EST 2013 -->
<title>ForecastErrorReason</title>
<meta name="date" content="2013-12-19">
<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="ForecastErrorReason";
}
//-->
</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 class="navBarCell1Rev">Class</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><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastError.html" title="class in com.google.api.ads.dfp.v201311"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastService.html" title="interface in com.google.api.ads.dfp.v201311"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/google/api/ads/dfp/v201311/ForecastErrorReason.html" target="_top">Frames</a></li>
<li><a href="ForecastErrorReason.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>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.google.api.ads.dfp.v201311</div>
<h2 title="Class ForecastErrorReason" class="title">Class ForecastErrorReason</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.google.api.ads.dfp.v201311.ForecastErrorReason</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable</dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">ForecastErrorReason</span>
extends java.lang.Object
implements java.io.Serializable</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../serialized-form.html#com.google.api.ads.dfp.v201311.ForecastErrorReason">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<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 java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_EXCEEDED_QUOTA">_EXCEEDED_QUOTA</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_INTERNAL_ERROR">_INTERNAL_ERROR</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_NO_FORECAST_YET">_NO_FORECAST_YET</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_NOT_ENOUGH_INVENTORY">_NOT_ENOUGH_INVENTORY</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_SERVER_NOT_AVAILABLE">_SERVER_NOT_AVAILABLE</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_SUCCESS">_SUCCESS</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_UNKNOWN">_UNKNOWN</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#_ZERO_LENGTH_RESERVATION">_ZERO_LENGTH_RESERVATION</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#EXCEEDED_QUOTA">EXCEEDED_QUOTA</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#INTERNAL_ERROR">INTERNAL_ERROR</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#NO_FORECAST_YET">NO_FORECAST_YET</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#NOT_ENOUGH_INVENTORY">NOT_ENOUGH_INVENTORY</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#SERVER_NOT_AVAILABLE">SERVER_NOT_AVAILABLE</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#SUCCESS">SUCCESS</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#UNKNOWN">UNKNOWN</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#ZERO_LENGTH_RESERVATION">ZERO_LENGTH_RESERVATION</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colLast" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected </code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#ForecastErrorReason(java.lang.String)">ForecastErrorReason</a></strong>(java.lang.String value)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</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>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object obj)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#fromString(java.lang.String)">fromString</a></strong>(java.lang.String value)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#fromValue(java.lang.String)">fromValue</a></strong>(java.lang.String value)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static org.apache.axis.encoding.Deserializer</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">getDeserializer</a></strong>(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static org.apache.axis.encoding.Serializer</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">getSerializer</a></strong>(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static org.apache.axis.description.TypeDesc</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#getTypeDesc()">getTypeDesc</a></strong>()</code>
<div class="block">Return type metadata object</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#getValue()">getValue</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#hashCode()">hashCode</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#readResolve()">readResolve</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html#toString()">toString</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, finalize, getClass, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="_SERVER_NOT_AVAILABLE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_SERVER_NOT_AVAILABLE</h4>
<pre>public static final java.lang.String _SERVER_NOT_AVAILABLE</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._SERVER_NOT_AVAILABLE">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_INTERNAL_ERROR">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_INTERNAL_ERROR</h4>
<pre>public static final java.lang.String _INTERNAL_ERROR</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._INTERNAL_ERROR">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_NO_FORECAST_YET">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_NO_FORECAST_YET</h4>
<pre>public static final java.lang.String _NO_FORECAST_YET</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._NO_FORECAST_YET">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_NOT_ENOUGH_INVENTORY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_NOT_ENOUGH_INVENTORY</h4>
<pre>public static final java.lang.String _NOT_ENOUGH_INVENTORY</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._NOT_ENOUGH_INVENTORY">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_SUCCESS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_SUCCESS</h4>
<pre>public static final java.lang.String _SUCCESS</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._SUCCESS">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_ZERO_LENGTH_RESERVATION">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_ZERO_LENGTH_RESERVATION</h4>
<pre>public static final java.lang.String _ZERO_LENGTH_RESERVATION</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._ZERO_LENGTH_RESERVATION">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_EXCEEDED_QUOTA">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_EXCEEDED_QUOTA</h4>
<pre>public static final java.lang.String _EXCEEDED_QUOTA</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._EXCEEDED_QUOTA">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="_UNKNOWN">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>_UNKNOWN</h4>
<pre>public static final java.lang.String _UNKNOWN</pre>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#com.google.api.ads.dfp.v201311.ForecastErrorReason._UNKNOWN">Constant Field Values</a></dd></dl>
</li>
</ul>
<a name="SERVER_NOT_AVAILABLE">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SERVER_NOT_AVAILABLE</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> SERVER_NOT_AVAILABLE</pre>
</li>
</ul>
<a name="INTERNAL_ERROR">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>INTERNAL_ERROR</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> INTERNAL_ERROR</pre>
</li>
</ul>
<a name="NO_FORECAST_YET">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>NO_FORECAST_YET</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> NO_FORECAST_YET</pre>
</li>
</ul>
<a name="NOT_ENOUGH_INVENTORY">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>NOT_ENOUGH_INVENTORY</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> NOT_ENOUGH_INVENTORY</pre>
</li>
</ul>
<a name="SUCCESS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SUCCESS</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> SUCCESS</pre>
</li>
</ul>
<a name="ZERO_LENGTH_RESERVATION">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ZERO_LENGTH_RESERVATION</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> ZERO_LENGTH_RESERVATION</pre>
</li>
</ul>
<a name="EXCEEDED_QUOTA">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>EXCEEDED_QUOTA</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> EXCEEDED_QUOTA</pre>
</li>
</ul>
<a name="UNKNOWN">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>UNKNOWN</h4>
<pre>public static final <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> UNKNOWN</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="ForecastErrorReason(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ForecastErrorReason</h4>
<pre>protected ForecastErrorReason(java.lang.String value)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getValue()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre>public java.lang.String getValue()</pre>
</li>
</ul>
<a name="fromValue(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromValue</h4>
<pre>public static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException</pre>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code></dd></dl>
</li>
</ul>
<a name="fromString(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromString</h4>
<pre>public static <a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastErrorReason.html" title="class in com.google.api.ads.dfp.v201311">ForecastErrorReason</a> fromString(java.lang.String value)
throws java.lang.IllegalArgumentException</pre>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code></dd></dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals</h4>
<pre>public boolean equals(java.lang.Object obj)</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>equals</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode</h4>
<pre>public int hashCode()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>hashCode</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public java.lang.String toString()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
</dl>
</li>
</ul>
<a name="readResolve()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readResolve</h4>
<pre>public java.lang.Object readResolve()
throws java.io.ObjectStreamException</pre>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.io.ObjectStreamException</code></dd></dl>
</li>
</ul>
<a name="getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSerializer</h4>
<pre>public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</pre>
</li>
</ul>
<a name="getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDeserializer</h4>
<pre>public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType)</pre>
</li>
</ul>
<a name="getTypeDesc()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getTypeDesc</h4>
<pre>public static org.apache.axis.description.TypeDesc getTypeDesc()</pre>
<div class="block">Return type metadata object</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= 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 class="navBarCell1Rev">Class</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><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastError.html" title="class in com.google.api.ads.dfp.v201311"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../../../com/google/api/ads/dfp/v201311/ForecastService.html" title="interface in com.google.api.ads.dfp.v201311"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/google/api/ads/dfp/v201311/ForecastErrorReason.html" target="_top">Frames</a></li>
<li><a href="ForecastErrorReason.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>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
google-code-export/google-api-dfp-java
|
docs/com/google/api/ads/dfp/v201311/ForecastErrorReason.html
|
HTML
|
apache-2.0
| 27,921
|
@charset "UTF-8";
.pace .pace-progress-inner,.page-header.navbar,.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu .dropdown-menu-list>li .progress .progress-bar {
box-shadow: none;
}
@media print {
body {
background-color: #fff !important;
}
.hidden-print,.page-bar,.page-footer,.page-sidebar-wrapper,.theme-panel {
display: none;
}
.no-page-break {
page-break-after: avoid;
}
.page-container {
margin: 0 !important;
padding: 0 !important;
}
.page-content {
min-height: 300px !important;
padding: 0 20px 20px !important;
margin: 0 !important;
}
.page-content>.portlet,.page-content>.portlet>.portlet-body {
padding: 0;
margin: 0;
}
}
.page-header.navbar {
width: 100%;
margin: 0;
border: 0;
padding: 0;
height: 68px;
min-height: 68px;
filter: none;
background-image: none;
}
.page-header.navbar.navbar-fixed-top,.page-header.navbar.navbar-static-top {
z-index: 9995;
}
.page-header.navbar .page-logo {
float: left;
display: block;
width: 195px;
height: 68px;
padding-left: 20px;
padding-right: 20px;
}
.page-header.navbar .page-logo>.logo-image,.page-header.navbar .page-logo>a {
display: block;
float: left;
}
.page-header.navbar .page-logo .logo-default {
margin: 27px 0 0;
}
.page-header.navbar .page-logo .logo-mini {
display: none;
margin-left: 5px;
}
.page-header.navbar .page-logo .text-logo {
padding-left: 20px;
padding-top: 12px;
}
.page-header.navbar .page-top {
height: 68px;
background: #BAC0B6;
}
.page-header.navbar .search-form {
margin-left: 10px;
display: inline-block;
width: 68px;
position: relative;
float: left !important;
transition: all .6s;
}
.page-header.navbar .search-form .input-group .form-control {
height: 68px;
border: 0;
background: 0 0 !important;
font-size: 14px;
padding-left: 0;
margin-left: 12px;
text-indent: -150000px;
}
.page-header.navbar .search-form .input-group .form-control:hover {
cursor: pointer;
}
.page-header.navbar .search-form .input-group .input-group-btn {
height: 68px;
}
.page-header.navbar .search-form .input-group .input-group-btn .btn.submit {
margin-left: -24px;
padding: 0;
width: 68px;
background: 0 0;
margin-top: 4px;
display: block;
}
.page-header.navbar .search-form .input-group .input-group-btn .btn.submit>i {
font-size: 15px;
}
.page-header.navbar .search-form.open {
transition: all .6s;
width: 300px !important;
}
.page-header.navbar .search-form.open .input-group .form-control {
text-indent: 0;
}
.page-header.navbar .search-form.open .input-group .form-control:hover {
cursor: text;
}
.page-header.navbar .search-form.open .input-group .input-group-btn .btn.submit {
margin-left: 0;
}
.page-header.navbar .menu-toggler {
display: block;
cursor: pointer;
opacity: .6;
filter: alpha(opacity=60);
width: 20px;
height: 20px;
background-repeat: no-repeat;
background-position: center center;
background-image: url(../img/sidebar-toggler.png);
}
.page-header.navbar .menu-toggler:hover,.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu .dropdown-menu-list>li>a:hover {
opacity: 1;
filter: alpha(opacity=100);
}
.page-header.navbar .menu-toggler.sidebar-toggler {
float: right;
margin: 23px 0 0;
}
.page-sidebar-closed.page-sidebar-closed-hide-logo .page-header.navbar .menu-toggler.sidebar-toggler {
margin-right: 17px;
}
.page-header.navbar .menu-toggler.responsive-toggler {
display: none;
float: right;
margin: 24px 14px 0 6px;
background-image: url(../img/sidebar-toggler-inverse.png);
}
.page-header.navbar .page-actions {
margin: 17px 0 15px 15px;
padding: 0;
float: left;
}
.page-header.navbar .page-actions .btn-group .dropdown-menu:before {
left: 9px;
right: auto;
}
.page-header.navbar .page-actions .btn-group .dropdown-menu:after {
left: 10px;
right: auto;
}
.page-header.navbar .top-menu {
margin: 0;
padding: 0;
float: right;
}
.page-header.navbar .top-menu .navbar-nav {
padding: 0;
margin-right: 20px;
display: block;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown {
margin: 0;
padding: 0;
height: 68px;
display: inline-block;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown>.dropdown-toggle {
margin: 0;
padding: 28px 16px 19px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown>.dropdown-toggle:last-child {
padding-right: 0;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown>.dropdown-toggle>i {
font-size: 19px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown>.dropdown-toggle>i.glyphicon {
top: 0;
font-size: 17px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown>.dropdown-toggle>.badge {
font-family: "Open Sans",sans-serif;
position: absolute;
top: 17px;
right: 9px;
font-weight: 300;
padding: 3px 6px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown>.dropdown-toggle:focus {
background: 0 0;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown .dropdown-menu {
margin-top: 9px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown .dropdown-menu:before {
position: absolute;
top: -7px;
right: 9px;
display: inline-block !important;
border-right: 7px solid transparent;
border-bottom: 7px solid #eee;
border-left: 7px solid transparent;
border-bottom-color: rgba(0,0,0,.2);
content: '';
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown .dropdown-menu:after {
position: absolute;
top: -6px;
right: 10px;
display: inline-block !important;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown .dropdown-menu>li>a {
color: #555;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu {
min-width: 160px;
max-width: 275px;
width: 275px;
z-index: 9995;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu>li.external {
display: block;
overflow: hidden;
padding: 15px;
letter-spacing: .5px;
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
-ms-border-radius: 4px 4px 0 0;
-o-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu>li.external>h3 {
margin: 0;
padding: 0;
float: left;
font-size: 13px;
display: inline-block;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu>li.external>a {
display: inline-block;
padding: 0;
background: 0 0;
clear: inherit;
font-size: 13px;
font-weight: 300;
position: absolute;
right: 10px;
border: 0;
margin-top: -1px;
}
.page-bar:after,.page-container:after,.page-footer:after {
clear: both;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu>li.external>a:hover {
text-decoration: underline;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu .dropdown-menu-list {
padding-right: 0 !important;
padding-left: 0;
list-style: none;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu .dropdown-menu-list>li>a {
display: block;
clear: both;
font-weight: 300;
line-height: 20px;
white-space: normal;
font-size: 13px;
padding: 16px 15px 18px;
text-shadow: none;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended .dropdown-menu .dropdown-menu-list>li:first-child a {
border-top: none;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu .dropdown-menu-list>li a .details {
overflow: hidden;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu .dropdown-menu-list>li a .details .label-icon {
margin-right: 10px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu .dropdown-menu-list>li a .details .label-icon i {
margin-right: 2px;
margin-left: 1px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu .dropdown-menu-list>li a .details .label-icon .badge {
right: 15px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu .dropdown-menu-list>li a .time {
float: right;
max-width: 75px;
font-size: 11px;
font-weight: 400;
opacity: .7;
filter: alpha(opacity=70);
text-align: right;
padding: 1px 5px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox>.dropdown-menu .dropdown-menu-list>li .photo {
float: left;
margin: 0 6px 6px 0;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox>.dropdown-menu .dropdown-menu-list>li .photo img {
height: 40px;
width: 40px;
-webkit-border-radius: 50% !important;
-moz-border-radius: 50% !important;
-ms-border-radius: 50% !important;
-o-border-radius: 50% !important;
border-radius: 50% !important;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox>.dropdown-menu .dropdown-menu-list>li .subject {
display: block;
margin-left: 46px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox>.dropdown-menu .dropdown-menu-list>li .subject .from {
font-size: 13px;
font-weight: 600;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox>.dropdown-menu .dropdown-menu-list>li .subject .time {
font-size: 12px;
font-weight: 400;
opacity: .5;
filter: alpha(opacity=50);
float: right;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox>.dropdown-menu .dropdown-menu-list>li .message {
display: block !important;
font-size: 12px;
line-height: 1.3;
margin-left: 46px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu .dropdown-menu-list>li .task {
margin-bottom: 5px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu .dropdown-menu-list>li .task .desc {
font-size: 13px;
font-weight: 300;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu .dropdown-menu-list>li .task .percent {
float: right;
font-weight: 600;
display: inline-block;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu .dropdown-menu-list>li .progress {
display: block;
height: 8px;
margin: 8px 0 2px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user {
padding: 0 0 0 10px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle {
padding: 24px 12px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle>.username {
display: inline-block;
font-size: 14px;
font-weight: 400;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle>img {
float: left;
margin-top: -8px;
margin-right: 7px;
height: 39px;
display: inline-block;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle>i {
display: inline-block;
margin: 0;
font-size: 14px;
font-weight: 400;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-menu {
width: 175px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-menu>li>a {
font-size: 14px;
font-weight: 300;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-menu>li>a i {
width: 15px;
display: inline-block;
margin-right: 9px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-menu>li>a .badge {
margin-right: 10px;
}
.page-header.navbar .top-menu .navbar-nav>li.quick-sidebar-toggler {
cursor: pointer;
padding: 24px 12px;
}
.page-header.navbar .top-menu .navbar-nav>li.quick-sidebar-toggler>i {
top: 3px;
color: #c0cddc;
font-size: 19px;
}
.page-header.navbar .top-menu .navbar-nav>li.quick-sidebar-toggler>i:before {
content: "";
}
.page-quick-sidebar-open .page-header.navbar .top-menu .navbar-nav>li.quick-sidebar-toggler>i:before {
content: "";
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language {
padding-left: 0;
padding-right: 0;
margin: 0;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language>.dropdown-toggle {
font-size: 13px;
padding: 24px 12px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language>.dropdown-toggle>img {
margin-bottom: 2px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language>.dropdown-toggle>i {
font-size: 14px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language>.dropdown-menu>li>a {
font-size: 13px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language>.dropdown-menu>li>a>img {
margin-bottom: 2px;
margin-right: 5px;
}
.page-header.navbar .top-menu .navbar-nav li.dropdown-dark .dropdown-menu {
border: 0;
}
.page-header.navbar .top-menu .navbar-nav li.dropdown-dark .dropdown-menu:before {
border-left: none;
border-right: none;
}
.page-header.navbar .top-menu .navbar-nav li.dropdown-dark .dropdown-menu .dropdown-menu-list>li.external a {
background: 0 0 !important;
border: none !important;
}
@media (min-width:768px) {
.page-header.navbar .search-form.search-form-expanded {
width: 200px;
}
.page-header.navbar .search-form.search-form-expanded .input-group .form-control {
text-indent: 0;
}
.page-header.navbar .search-form.search-form-expanded .input-group .form-control:hover {
cursor: text;
}
.page-header.navbar .search-form.search-form-expanded .input-group .input-group-btn .btn.submit {
margin-left: 0;
}
}
@media (min-width:992px) and (max-width:1200px) {
.page-boxed .page-header.navbar .top-menu .navbar-nav>li.dropdown-language .dropdown-toggle .langname,.page-boxed .page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle .username.username-hide-on-mobile {
display: none;
}
}
@media (min-width:992px) {
.page-sidebar-closed.page-sidebar-closed-hide-logo .page-header.navbar .page-logo {
padding: 0;
width: 54px;
}
.page-sidebar-closed.page-sidebar-closed-hide-logo .page-header.navbar .page-logo .logo-default {
display: none;
}
.page-boxed .page-header.navbar .page-logo {
width: 195px;
}
.page-boxed .page-header.navbar .top-menu .navbar-nav {
margin-right: 20px;
}
.page-sidebar-closed.page-sidebar-closed-hide-logo.page-boxed .page-header.navbar .page-logo {
width: 54px;
}
.page-boxed.page-sidebar-fixed .page-header.navbar .page-logo {
width: 195px;
}
}
@media (max-width:991px) {
.page-header.navbar {
padding: 0;
margin: 0;
position: relative;
clear: both;
}
.page-header.navbar .page-logo {
width: auto;
padding: 0 15px 0 10px;
}
.page-header.navbar .page-logo img {
margin-left: 4px !important;
}
.page-header.navbar .menu-toggler.sidebar-toggler {
display: none !important;
}
.page-header.navbar .menu-toggler.responsive-toggler {
display: inline-block;
}
.page-header.navbar .search-form {
margin-left: 0;
}
.page-header.navbar .search-form.open {
width: 245px !important;
}
.page-header.navbar .page-header-inner.container {
width: 100%;
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
}
.page-header.navbar .top-menu .navbar-nav {
display: inline-block;
margin: 0 10px 0 0;
}
.page-header.navbar .top-menu .navbar-nav>li {
float: left;
}
.page-header.navbar .top-menu .navbar-nav .nav li.dropdown i {
display: inline-block;
position: relative;
top: 1px;
right: 0;
}
.page-header.navbar .top-menu .navbar-nav .open .dropdown-menu {
position: absolute;
}
.page-header-fixed.page-header-fixed-mobile .navbar-fixed-top {
position: fixed;
}
.page-boxed .page-header.navbar>.container {
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
}
}
@media (min-width:768px) and (max-width:991px) {
.page-boxed .page-header.navbar {
margin: auto !important;
padding: 0;
}
.page-boxed .page-header.navbar>.container {
margin: auto !important;
}
}
@media (max-width:580px) {
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language .dropdown-toggle .langname,.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle .username.username-hide-on-mobile {
display: none;
}
}
@media (max-width:767px) {
.page-header.navbar {
padding: 0;
height: 136px;
}
.page-header.navbar .page-logo {
width: auto;
}
.page-header.navbar .search-form.open {
z-index: 3;
left: 10px;
right: 10px;
position: absolute;
width: auto !important;
margin: 0 -10px !important;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-extended>.dropdown-menu {
max-width: 245px;
width: 245px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu {
margin-right: -170px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu:after,.page-header.navbar .top-menu .navbar-nav>li.dropdown-notification .dropdown-menu:before {
margin-right: 170px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox .dropdown-menu {
margin-right: -120px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox .dropdown-menu:after,.page-header.navbar .top-menu .navbar-nav>li.dropdown-inbox .dropdown-menu:before {
margin-right: 120px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu {
margin-right: -80px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu:after,.page-header.navbar .top-menu .navbar-nav>li.dropdown-tasks .dropdown-menu:before {
margin-right: 80px;
}
.page-header.navbar .top-menu .navbar-nav {
margin-right: 0;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown .dropdown-toggle {
padding: 28px 10px 19px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-language .dropdown-toggle,.page-header.navbar .top-menu .navbar-nav>li.dropdown-user .dropdown-toggle {
padding: 24px 6px;
}
.page-header.navbar .top-menu .navbar-nav>li.dropdown-user {
margin-right: 10px;
}
.page-header.navbar .menu-toggler.responsive-toggler {
background-image: url(../img/sidebar-toggler.png);
}
.page-header.navbar .search-form {
margin-left: -12px;
}
.page-header.navbar .page-top {
display: block;
clear: both;
}
}
.pace .pace-progress {
z-index: 10000;
top: 66px;
height: 2px;
}
.pace .pace-activity {
top: 70px;
right: 22px;
border-radius: 10px !important;
}
@media (max-width:767px) {
.page-header-fixed .pace .pace-progress {
top: 136px;
}
.page-header-fixed .pace .pace-activity {
top: 276px;
right: 15px;
}
}
.page-container {
margin: 0;
padding: 0;
position: relative;
}
.page-container:after,.page-container:before {
content: " ";
display: table;
}
.page-header-fixed .page-container {
margin-top: 68px;
}
.page-footer-fixed.page-footer-fixed-mobile .page-container {
margin-bottom: 20px !important;
}
@media (min-width:1260px) {
.container {
width: 1270px;
}
}
@media (min-width:992px) {
.page-footer-fixed .page-container {
margin-bottom: 20px !important;
}
}
@media (max-width:991px) {
.page-container {
margin: 0 !important;
padding: 0 !important;
}
.page-header-fixed.page-header-fixed-mobile .page-container {
margin-top: 68px !important;
}
}
@media (max-width:480px) {
.page-header-fixed.page-header-fixed-mobile .page-container {
margin-top: 136px !important;
}
}
.ie8 .page-sidebar {
width: 195px;
float: left;
position: relative;
margin-right: -100%;
}
.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover.navbar-collapse,.page-sidebar.navbar-collapse {
padding: 0;
box-shadow: none;
}
.page-sidebar .page-sidebar-menu,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu {
list-style: none;
margin: 0;
padding: 0;
}
.page-sidebar .page-sidebar-menu>li,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li {
display: block;
margin: 0;
padding: 0;
border: 0;
}
.page-sidebar .page-sidebar-menu>li.start>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.start>a {
border-top-color: transparent !important;
}
.page-sidebar .page-sidebar-menu>li.last>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.last>a {
border-bottom-color: transparent !important;
}
.page-sidebar .page-sidebar-menu>li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a {
min-height: 78px;
display: block;
position: relative;
margin: 0;
border: 0;
padding: 17px 15px 15px;
text-decoration: none;
font-size: 13px;
font-weight: 300;
text-align: center;
}
.page-sidebar .page-sidebar-menu>li>a>.title,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a>.title {
display: block;
text-align: center;
margin-top: 5px;
}
.page-sidebar .page-sidebar-menu>li>a>i,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a>i {
font-size: 24px;
text-shadow: none;
font-weight: 300;
text-align: center;
}
.page-sidebar .page-sidebar-menu>li>a>i.glyphicon,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a>i.glyphicon {
top: 3px;
margin-left: 1px;
margin-right: 4px;
}
.page-sidebar .page-sidebar-menu>li>a>[class^=icon-],.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a>[class^=icon-] {
top: 2px;
margin-left: 1px;
margin-right: 4px;
}
.page-sidebar-fixed .page-sidebar .page-sidebar-menu>li>a,.page-sidebar-fixed .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a {
transition: all .2s ease;
}
.page-sidebar-reversed.page-sidebar-fixed .page-sidebar .page-sidebar-menu>li>a,.page-sidebar-reversed.page-sidebar-fixed .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li>a {
transition: none;
}
.page-sidebar .page-sidebar-menu>li.open>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.open>a {
font-size: 13px;
}
.page-sidebar .page-sidebar-menu>li.active>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.active>a {
border: none;
text-shadow: none;
font-size: 13px;
}
.page-sidebar .page-sidebar-menu>li.active>a>.selected,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.active>a>.selected {
float: right;
position: absolute;
right: -1px;
top: 26px;
background: 0 0;
width: 0;
height: 0;
border-style: solid;
border-top: 12px double transparent;
border-bottom: 12px double transparent;
border-left: 0;
border-right: 8px solid #fff;
}
.page-sidebar-reversed .page-sidebar .page-sidebar-menu>li.active>a>.selected,.page-sidebar-reversed .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.active>a>.selected {
right: auto;
left: -1px;
border-right: 0;
border-left: 8px solid #fff;
}
.page-container-bg-solid .page-sidebar .page-sidebar-menu>li.active>a>.selected,.page-container-bg-solid .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.active>a>.selected {
border-color: transparent #eef1f5 transparent transparent;
}
.page-container-bg-solid.page-sidebar-reversed .page-sidebar .page-sidebar-menu>li.active>a>.selected,.page-container-bg-solid.page-sidebar-reversed .page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu>li.active>a>.selected {
border-color: transparent transparent transparent #eef1f5;
}
.page-sidebar .page-sidebar-menu li>a>.arrow:before,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu li>a>.arrow:before {
width: 10px;
float: right;
margin-right: 5px;
margin-left: 5px;
margin-top: -32px;
display: inline;
font-size: 16px;
font-family: FontAwesome;
height: auto;
content: "\f104";
font-weight: 300;
text-shadow: none;
}
.page-sidebar .page-sidebar-menu li>a>.arrow.open:before,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu li>a>.arrow.open:before {
content: "\f107";
}
.page-sidebar .page-sidebar-menu li>a>.badge,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu li>a>.badge {
float: right;
margin-top: 1px;
margin-right: 0;
}
.page-sidebar .page-sidebar-menu .sub-menu,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu {
list-style: none;
display: none;
padding: 0;
margin: 8px 0;
}
.page-sidebar .page-sidebar-menu .sub-menu li,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li {
background: 0 0;
margin: 0;
padding: 0;
margin-top: 1px !important;
}
.page-sidebar .page-sidebar-menu .sub-menu li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>a {
display: block;
margin: 0;
padding: 9px 15px;
text-decoration: none;
font-size: 13px;
font-weight: 300;
background: 0 0;
}
.page-sidebar .page-sidebar-menu .sub-menu li>a>i,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>a>i {
font-size: 14px;
margin-right: 1px;
}
.page-sidebar .page-sidebar-menu .sub-menu li>a .arrow:before,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>a .arrow:before {
margin-top: -4px;
}
.page-sidebar .page-sidebar-menu .sub-menu li>a .arrow.open:before,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>a .arrow.open:before {
margin-top: -2px;
}
.page-sidebar .page-sidebar-menu .sub-menu li>.sub-menu,.page-sidebar .page-sidebar-menu .sub-menu li>.sub-menu>li>.sub-menu,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>.sub-menu,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>.sub-menu>li>.sub-menu {
margin: 0;
}
.page-sidebar .page-sidebar-menu .sub-menu li>.sub-menu>li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>.sub-menu>li>a {
padding-left: 30px;
}
.page-sidebar .page-sidebar-menu .sub-menu li>.sub-menu>li>.sub-menu>li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .sub-menu li>.sub-menu>li>.sub-menu>li>a {
padding-left: 40px;
}
.page-sidebar .page-sidebar-menu li.active>.sub-menu,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu li.active>.sub-menu {
display: block;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact>li,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact>li {
text-align: left;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact>li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact>li>a {
text-align: left;
min-height: 50px;
padding: 15px;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact>li>a>.title,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact>li>a>.title {
display: inline-block;
text-align: left;
margin-top: 0;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact>li>a>i,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact>li>a>i {
font-size: 16px;
text-align: left;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact>li.active>a>.selected,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact>li.active>a>.selected {
top: 14px;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact>li>.sub-menu>li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact>li>.sub-menu>li>a {
padding-left: 22px;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact li>a>.arrow.open:before,.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact li>a>.arrow:before,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact li>a>.arrow.open:before,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact li>a>.arrow:before {
margin-top: -1px;
}
.page-sidebar .page-sidebar-menu.page-sidebar-menu-compact.page-sidebar-menu-hover-submenu>li>.sub-menu>li>a,.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu.page-sidebar-menu-compact.page-sidebar-menu-hover-submenu>li>.sub-menu>li>a {
padding-left: 15px;
}
@media (min-width:992px) {
.page-full-width .page-sidebar,.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li.open>.sub-menu,.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>.sub-menu {
display: none !important;
}
.page-sidebar {
width: 195px;
float: left;
position: relative;
margin-right: -100%;
}
.page-sidebar.navbar-collapse {
max-height: none !important;
}
.page-sidebar .page-sidebar-menu {
margin-bottom: 10px;
}
.page-sidebar-reversed .page-sidebar {
float: right;
margin-right: 0;
margin-left: -100%;
}
.page-sidebar-reversed.page-sidebar-fixed .page-sidebar {
margin-left: -195px;
}
.page-sidebar-reversed.page-sidebar-fixed .page-sidebar-wrapper {
position: relative;
float: right;
}
.page-sidebar-fixed .page-sidebar {
position: fixed !important;
margin-left: 0;
top: 68px;
}
.page-sidebar-fixed .page-sidebar-menu>li.last {
margin-bottom: 15px !important;
}
.page-sidebar-fixed .page-sidebar-menu .sub-menu {
height: auto !important;
}
.page-sidebar-closed .page-sidebar,.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed {
width: 54px !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover {
width: 249px !important;
position: relative !important;
z-index: 10000;
display: block !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a {
-webkit-border-radius: 0 4px 0 0;
-moz-border-radius: 0 4px 0 0;
-ms-border-radius: 0 4px 0 0;
-o-border-radius: 0 4px 0 0;
border-radius: 0 4px 0 0;
text-align: left;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a>i {
display: inline-block;
margin-right: 10px;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a>.title {
display: inline !important;
padding-left: 20px;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a>.badge {
display: block !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a>.selected {
display: none;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>.sub-menu {
width: 194px;
position: absolute;
z-index: 2000;
left: 55px;
margin-top: 0;
top: 100%;
display: block !important;
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
-ms-border-radius: 0 0 4px 4px;
-o-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>.sub-menu>li>a {
padding-left: 15px !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>.sub-menu>li>.sub-menu>li>a {
padding-left: 30px !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>.sub-menu>li>.sub-menu>li>.sub-menu>li>a {
padding-left: 45px !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>a {
min-height: 54px;
padding-left: 11px;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>a .selected {
top: 16px;
right: -2px !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>a>.arrow,.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>a>.badge,.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>a>.title {
display: none !important;
}
.page-sidebar-closed .page-sidebar .page-sidebar-menu.page-sidebar-menu-compact.page-sidebar-menu-closed>li>a {
min-height: 50px;
padding-right: 11px;
padding-left: 18px;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar {
margin-left: -54px;
width: 54px;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li>.sub-menu {
left: auto;
right: 55px;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover {
margin-left: -195px;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a {
-webkit-border-radius: 4px 0 0;
-moz-border-radius: 4px 0 0;
-ms-border-radius: 4px 0 0 0;
-o-border-radius: 4px 0 0;
border-radius: 4px 0 0;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a>.title {
padding-left: 0;
padding-right: 15px;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar .page-sidebar-menu.page-sidebar-menu-closed>li:hover>a>i {
margin-right: 0;
margin-left: 2px;
}
.page-sidebar-closed.page-sidebar-reversed .page-sidebar .page-sidebar-menu.page-sidebar-menu-light.page-sidebar-menu-closed>li>a {
padding-right: 7px;
padding-left: 11px;
}
.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover {
width: 195px !important;
display: block;
z-index: 10000;
}
.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu {
width: 195px !important;
}
.page-sidebar-closed.page-sidebar-fixed .page-sidebar:hover .page-sidebar-menu .selected {
display: none !important;
}
.page-sidebar-closed.page-sidebar-fixed.page-sidebar-reversed .page-sidebar:hover {
width: 195px !important;
display: block;
z-index: 10000;
margin-left: -195px !important;
}
.page-sidebar-closed.page-sidebar-fixed.page-sidebar-reversed .page-sidebar:hover .page-sidebar-menu {
width: 195px !important;
}
.page-sidebar-closed.page-sidebar-hide .page-sidebar {
display: none !important;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li .sub-menu {
display: none;
width: 194px;
z-index: 2000;
position: absolute;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li .sub-menu>li>a {
margin: 3px;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li.active .sub-menu,.page-sidebar-menu.page-sidebar-menu-hover-submenu li.open .sub-menu {
display: none !important;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li a>.arrow {
display: none;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li:hover>a>.arrow {
display: block;
float: right;
position: absolute;
right: 0;
margin-top: -20px;
background: 0 0;
width: 0;
height: 0;
border-style: solid;
border-top: 12px double transparent;
border-bottom: 12px double transparent;
border-left: 0;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li:hover>a>.arrow:after,.page-sidebar-menu.page-sidebar-menu-hover-submenu li:hover>a>.arrow:before {
display: none;
}
.page-sidebar-reversed .page-sidebar-menu.page-sidebar-menu-hover-submenu li:hover>a>.arrow {
right: auto;
left: 0;
border-right: 0;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu li:hover>.sub-menu {
display: inline-block !important;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>a>.arrow {
z-index: 1;
right: 0;
margin-top: -36px;
}
.page-fontawesome .page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>a>.arrow {
margin-top: -34px;
}
.page-glyphicons .page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>a>.arrow {
margin-top: -38px;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>.sub-menu {
margin-left: 195px;
margin-top: -78px;
}
.page-sidebar-reversed .page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>.sub-menu {
margin-left: -194px !important;
}
.page-sidebar-closed .page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>.sub-menu {
margin-left: 0;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>.sub-menu>li .sub-menu {
margin-left: 194px;
margin-top: -42px !important;
}
.page-sidebar-reversed .page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>.sub-menu>li .sub-menu {
margin-left: -194px !important;
}
.page-sidebar-menu.page-sidebar-menu-hover-submenu>li:hover>.sub-menu>li .sub-menu>li>a {
padding-left: 10px;
padding-right: 10px;
}
.page-sidebar-menu.page-sidebar-menu-compact.page-sidebar-menu-hover-submenu li:hover>a>.arrow,.page-sidebar-menu.page-sidebar-menu-compact.page-sidebar-menu-hover-submenu>li:hover>a>.arrow {
margin-top: -20px;
}
.page-sidebar-menu.page-sidebar-menu-compact.page-sidebar-menu-hover-submenu>li:hover>.sub-menu {
margin-top: -49px;
}
}
@media (max-width:991px) {
.page-sidebar .selected,.page-sidebar.navbar-collapse.collapse {
display: none !important;
}
.page-sidebar,.page-sidebar.navbar-collapse.in {
border-top: 0 !important;
margin: 20px;
}
.page-sidebar.navbar-collapse {
max-height: none;
}
.page-sidebar.navbar-collapse.in {
position: relative;
overflow: hidden !important;
overflow-y: auto !important;
display: block !important;
}
.page-sidebar.navbar-collapse.navbar-no-scroll {
max-height: none !important;
}
.page-sidebar .mega-menu-responsive-content {
padding: 10px 18px 10px 45px;
}
.page-full-width .page-sidebar-menu {
display: block;
}
}
@media (min-width:768px) and (max-width:991px) {
.page-sidebar .btn-navbar.collapsed .arrow {
display: none;
}
.page-sidebar .btn-navbar .arrow {
position: absolute;
right: 25px;
width: 0;
height: 0;
top: 50px;
border-bottom: 15px solid #5f646b;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
}
}
@media (max-width:480px) {
.page-sidebar,.page-sidebar.in {
margin: 10px !important;
}
.page-header-fixed.page-header-fixed-mobile .page-sidebar,.page-header-fixed.page-header-fixed-mobile .page-sidebar.in {
margin-top: 10px !important;
}
}
.page-title {
padding: 0;
font-size: 26px;
letter-spacing: -1px;
line-height: 26px;
display: block;
color: #666;
margin: 0 0 20px;
font-weight: 300;
font-family: "Open Sans",sans-serif;
}
.page-title small {
font-size: 13px;
letter-spacing: 0;
font-weight: 300;
color: #888;
}
.page-container-bg-solid .page-title,.page-container-bg-solid .page-title small {
color: #666;
}
.page-bar {
padding: 0;
background-color: #fff;
margin-bottom: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
}
.page-bar:after,.page-bar:before {
content: " ";
display: table;
}
.page-bar .page-breadcrumb {
display: inline-block;
float: left;
padding: 10px 6px;
margin: 0;
list-style: none;
}
.page-bar .page-breadcrumb>li {
display: inline-block;
}
.ie8 .page-bar .page-breadcrumb>li {
margin-right: 1px;
}
.page-bar .page-breadcrumb>li>a,.page-bar .page-breadcrumb>li>span {
color: #888;
font-size: 13px;
text-shadow: none;
}
.page-bar .page-breadcrumb>li>i {
color: #aaa;
font-size: 14px;
text-shadow: none;
}
.page-bar .page-breadcrumb>li>i[class*=icon-],.page-bar .page-breadcrumb>li>i[class^=icon-] {
color: #8c8c8c;
}
.page-bar .page-toolbar {
display: inline-block;
float: right;
}
.page-bar .page-toolbar .btn-fit-height {
-webkit-border-radius: 0 4px 4px 0;
-moz-border-radius: 0 4px 4px 0;
-ms-border-radius: 0 4px 4px 0;
-o-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
padding-top: 9px;
padding-bottom: 9px;
}
.page-md .page-bar .page-toolbar .btn-fit-height {
padding-top: 11px;
padding-bottom: 10px;
box-shadow: none !important;
}
.page-bar .page-toolbar .btn.btn-default {
border-color: #eee;
color: #999;
}
.page-bar .page-toolbar .btn.btn-default>i {
color: #999;
}
.page-bar .page-toolbar .btn.btn-sm {
margin-top: 0;
}
.page-bar .page-toolbar .btn-dashboard-daterange {
padding: 8px 16px;
}
.page-bar .page-toolbar .btn-dashboard-daterange>i[class^=icon-] {
position: relative;
font-size: 20px;
opacity: .8;
filter: alpha(opacity=80);
top: 2px;
}
.page-bar .page-toolbar .btn-dashboard-daterange>i.fa-angle-down {
font-size: 16px;
opacity: .8;
filter: alpha(opacity=80);
}
.page-content {
margin-top: 0;
padding: 0;
background-color: #fff;
}
.page-container-bg-solid .page-content {
background: #eef1f5;
}
.page-full-width .page-content {
margin-left: 0 !important;
}
@media (min-width:992px) {
.page-content-wrapper {
float: left;
width: 100%;
}
.page-content-wrapper .page-content {
margin-left: 195px;
margin-top: 0;
min-height: 600px;
padding: 25px 20px 10px;
}
.page-content-wrapper .page-content.no-min-height {
min-height: auto;
}
.page-sidebar-fixed.page-sidebar-hover-on .page-content-wrapper .page-content {
margin-left: 54px;
}
.page-sidebar-reversed .page-content-wrapper .page-content {
margin-left: 0 !important;
margin-right: 195px !important;
}
.page-sidebar-reversed.page-sidebar-fixed.page-sidebar-hover-on .page-content-wrapper .page-content {
margin-left: 0;
margin-right: 54px;
}
.page-sidebar-reversed.page-sidebar-closed .page-content-wrapper .page-content {
margin-left: 0 !important;
margin-right: 54px !important;
}
.page-sidebar-closed .page-content-wrapper .page-content {
margin-left: 54px !important;
}
.page-full-width .page-content-wrapper .page-content,.page-sidebar-closed.page-sidebar-hide .page-content-wrapper .page-content {
margin-left: 0 !important;
}
.page-sidebar-closed.page-sidebar-reversed.page-sidebar-hide .page-content-wrapper .page-content {
margin-right: 0 !important;
}
}
@media (max-width:991px) {
.page-boxed>.container {
width: 100%;
max-width: none !important;
margin: 0 !important;
padding: 0 !important;
}
.page-content-wrapper .page-content {
margin: 0 !important;
padding: 20px !important;
min-height: 280px;
}
}
@media (min-width:768px) and (max-width:991px) {
.page-boxed>.container {
margin: auto !important;
}
}
@media (max-width:767px) {
.page-content-wrapper .page-content {
padding: 20px 10px 10px !important;
overflow: hidden;
}
.page-content-wrapper .page-content .page-title {
margin-bottom: 15px;
font-size: 20px;
}
.page-content-wrapper .page-content .page-title small {
font-size: 13px;
padding-top: 3px;
}
}
@media (max-width:480px) {
.page-content-wrapper .page-content .page-title small {
display: block;
clear: both;
}
}
.page-footer {
padding: 8px 20px 5px;
font-size: 12px;
height: 33px;
}
.page-footer:after,.page-footer:before {
content: " ";
display: table;
}
.page-footer .page-footer-inner {
float: left;
display: inline-block;
}
.page-footer .page-footer-tools {
float: right;
display: inline-block;
}
.page-footer .page-footer-tools .go-top {
display: block;
text-decoration: none;
cursor: pointer;
margin-top: -2px;
margin-right: 0;
margin-bottom: 0;
font-size: 16px;
padding: 0 6px;
}
.page-footer .page-footer-tools .go-top i {
font-size: 22px;
margin-bottom: 5px;
}
.page-footer-fixed.page-footer-fixed-mobile .page-footer {
position: fixed;
left: 0;
right: 0;
z-index: 10000;
bottom: 0;
}
.page-footer-fixed.page-footer-fixed-mobile.page-sidebar-fixed .page-footer {
margin-left: 0 !important;
}
@media (min-width:992px) {
.page-footer {
clear: left;
}
.page-footer-fixed .page-footer {
position: fixed;
left: 0;
right: 0;
z-index: 10000;
bottom: 0;
}
.page-sidebar-fixed.page-sidebar-closed .page-footer {
margin-left: 54px;
}
.page-sidebar-fixed.page-footer-fixed .page-footer {
margin-left: 0 !important;
}
.page-sidebar-fixed .page-footer {
margin-left: 195px;
padding: 8px 20px 5px;
}
.page-boxed .page-footer {
padding: 8px 0 5px;
}
.page-boxed.page-sidebar-fixed .page-footer {
padding-right: 20px;
padding-left: 20px;
}
.page-sidebar-reversed.page-sidebar-fixed .page-footer {
margin-left: 0;
margin-right: 195px;
padding: 8px 20px 5px;
}
.page-sidebar-reversed.page-sidebar-fixed.page-footer-fixed .page-footer {
margin-left: 0;
margin-right: 0;
}
.page-sidebar-reversed.page-sidebar-fixed.page-sidebar-closed .page-footer {
margin-right: 54px;
}
.scroll-to-top {
right: 10px;
}
}
@media (max-width:991px) {
.page-footer {
padding-left: 10px;
padding-right: 10px;
}
}
@media (max-width:767px) {
.page-boxed .page-footer,.page-footer {
padding-left: 10px;
padding-right: 10px;
}
.page-footer-fixed .page-footer .container {
padding-left: 0;
padding-right: 0;
}
}
.scroll-to-top {
padding: 2px;
text-align: center;
position: fixed;
z-index: 10001;
bottom: 10px;
display: none;
right: 10px;
}
.scroll-to-top>i {
display: inline-block;
color: #687991;
font-size: 32px;
opacity: .7;
filter: alpha(opacity=70);
}
.scroll-to-top:hover {
cursor: pointer;
}
.scroll-to-top:hover>i {
opacity: 1;
filter: alpha(opacity=100);
}
@media (max-width:991px) {
.scroll-to-top {
right: 10px;
}
.scroll-to-top>i {
font-size: 28px;
}
}
.theme-panel {
width: 400px;
margin-top: -15px;
margin-right: 0;
z-index: 100;
float: right;
position: relative;
}
.theme-panel>.toggler {
top: 5px;
right: 1px;
height: 40px;
width: 40px;
border-radius: 50% !important;
cursor: pointer;
position: absolute;
text-align: center;
background-color: #fff;
}
.theme-panel>.toggler>i {
position: relative;
top: 12px;
font-size: 20px;
color: #9fb3ca;
}
.theme-panel>.toggler:hover {
background: #ACB5C3;
}
.theme-panel>.toggler:hover>i {
color: #fff;
}
.theme-panel>.toggler-close {
display: none;
top: 5px;
right: 1px;
z-index: 101;
cursor: pointer;
position: absolute;
}
.theme-panel>.toggler-close>i {
position: relative;
top: 12px;
right: 12px;
font-size: 20px;
color: #f2f2f2;
}
.theme-panel>.toggler-close:hover {
opacity: .8;
filter: alpha(opacity=80);
}
.theme-panel>.theme-options {
box-shadow: 5px 5px rgba(63,77,86,.1);
top: 4px;
right: 0;
display: none;
position: absolute;
z-index: 100;
background: #3f4d56;
border: 1px solid #39454d;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
}
.theme-panel>.theme-options>.theme-option {
color: #eee;
padding: 11px;
border-top: 1px solid #46545f;
margin-top: 0;
margin-bottom: 0;
}
.theme-panel>.theme-options>.theme-option>span {
text-transform: uppercase;
display: inline-block;
width: 115px;
font-size: 13px;
font-weight: 300;
}
.theme-panel>.theme-options>.theme-option>select.form-control {
display: inline;
width: 100px;
padding: 2px;
text-transform: lowercase;
}
.theme-panel>.theme-options>.theme-option.theme-colors {
border-top: 0;
}
.theme-panel>.theme-options>.theme-option.theme-colors>span {
display: block;
width: auto;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul {
list-style: none;
padding: 0;
display: block;
margin-bottom: 10px !important;
margin-top: 15px;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li {
width: 46px;
height: 45px;
margin: 0 4px;
cursor: pointer;
list-style: none;
float: left;
border: 1px solid #707070;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li:first-child {
margin-left: 0;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li.current,.theme-panel>.theme-options>.theme-option.theme-colors>ul>li:hover {
border: 2px solid #d64635;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li.color-default {
background: #2b3643;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li.color-dark {
background: #333438;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li.color-blue {
background: #26344B;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li.color-grey {
background: #4D5B69;
}
.theme-panel>.theme-options>.theme-option.theme-colors>ul>li.color-light {
background: #f5f5f5;
}
.page-portlet-fullscreen .page-quick-sidebar-toggler,.page-portlet-fullscreen .page-quick-sidebar-wrapper {
z-index: -1;
}
.page-quick-sidebar-toggler {
overflow: hidden;
z-index: 99999;
display: none;
width: 28px;
height: 27px;
position: fixed;
top: 10px;
right: 15px;
text-align: center;
padding-top: 6px;
}
.page-quick-sidebar-toggler:hover {
background: #303a43;
}
.page-quick-sidebar-open .page-quick-sidebar-toggler {
display: inline-block;
}
.page-quick-sidebar-open .page-quick-sidebar-toggler:hover {
background: 0 0;
}
.page-quick-sidebar-toggler>i {
color: #99a8b5;
font-size: 17px;
}
.page-quick-sidebar-toggler>i:hover {
color: #fff !important;
}
.page-quick-sidebar-open .page-quick-sidebar-toggler>i:before {
content: "";
}
.page-quick-sidebar-wrapper {
transition: right .3s;
z-index: 9996;
position: fixed;
top: 0;
bottom: 0;
width: 320px;
right: -320px;
overflow: hidden;
color: #99a8b5;
background: #21282e;
}
.page-quick-sidebar-open .page-quick-sidebar-wrapper {
transition: right .3s;
right: 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar {
background: #21282e;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs {
margin: 0;
padding: 0;
border: 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li {
display: table-cell !important;
width: 1% !important;
padding: 0;
margin: 0;
float: none;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li>a {
position: relative;
display: block;
text-align: center;
height: auto;
font-size: 14px;
padding: 45px 15px 8px;
text-transform: uppercase;
background: 0 0;
margin-right: 0;
color: #90a1af;
border: 0;
border-bottom: 3px solid rgba(243,86,93,.3);
-webkit-border-radius: 0;
-moz-border-radius: 0;
-ms-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
outline: 0 !important;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li>a>.badge {
position: absolute;
top: 45px;
right: 3px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li.active>a,.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li:hover>a {
border: 0;
border-bottom: 3px solid #f3565d;
background: 0 0;
color: #fff;
text-decoration: none;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu {
border: 0;
background: #36424c;
box-shadow: 5px 5px rgba(97,117,135,.1);
margin-top: 8px;
margin-right: 20px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu:before {
position: absolute;
top: -7px;
right: 19px;
display: inline-block !important;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #36424c;
content: '';
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu:after {
position: absolute;
top: -6px;
right: 20px;
display: inline-block !important;
border-right: 6px solid transparent;
border-left: 6px solid transparent;
border-bottom: 7px solid #36424c;
content: '';
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu>li>a {
padding: 10px 15px;
color: #99a8b5;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu>li>a>i {
color: #93a3b1;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu>li:hover>a {
background: #3d4a55;
color: #99a8b5;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu>li:hover>a>i {
color: #9babb8;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu>li.active>a {
background: #38444f;
color: #99a8b5;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li .dropdown-menu>li.divider {
background-color: #3d4a55;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .nav-tabs>li.open>a.dropdown-toggle {
border-bottom: 3px solid #f3565d;
background: 0 0;
text-decoration: none;
color: #90a1af;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .tab-content {
margin: 0;
padding: 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .list-heading {
font-size: 16px;
margin: 10px;
color: #6c8296;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .list-items {
margin: 0;
padding: 0;
list-style: none;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .list-items>li {
margin: 0;
padding: 15px;
background: 0 0;
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #273037;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .list-items>li:hover {
background: #273037;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .list-items>li:last-child {
border-bottom: 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .list-items.borderless li {
border: 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .inner-content {
margin: 10px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-list {
position: absolute !important;
width: 320px !important;
transition: margin .3s;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-item {
position: absolute !important;
width: 320px !important;
transition: margin .3s;
margin-left: 320px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-item .page-quick-sidebar-nav {
padding: 15px 10px 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-item .page-quick-sidebar-nav .page-quick-sidebar-back-to-list {
vertical-align: middle;
display: inline-block;
font-size: 14px;
color: #90a1af;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-item .page-quick-sidebar-nav .page-quick-sidebar-back-to-list:hover {
text-decoration: none;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-item .page-quick-sidebar-nav .page-quick-sidebar-back-to-list>i {
font-size: 17px;
line-height: 17px;
vertical-align: top;
margin-right: 3px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-content-item-shown .page-quick-sidebar-list {
transition: margin .3s;
margin-left: -320px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-content-item-shown .page-quick-sidebar-list .slimScrollBar,.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-content-item-shown .page-quick-sidebar-list .slimScrollRail {
display: none !important;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-content-item-shown .page-quick-sidebar-item {
transition: margin .3s;
margin-left: 0;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users {
padding: 10px 0;
position: relative;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media {
padding: 15px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-object {
border-radius: 50% !important;
width: 45.71px;
opacity: .8;
filter: alpha(opacity=80);
float: left;
margin-right: 10px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-object:after,.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-object:before {
content: " ";
display: table;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-object:after {
clear: both;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media:hover {
cursor: pointer;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media:hover .media-object {
opacity: 1;
filter: alpha(opacity=100);
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-body .media-heading {
margin: 5px 0 0;
font-size: 14px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-body .media-heading-sub {
font-size: 11px;
text-transform: uppercase;
color: #657b8d;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-body .media-heading-small {
font-size: 10px;
color: #5d7081;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-users .media-list .media .media-status {
margin-top: 10px;
right: 10px;
position: absolute;
display: inline-block;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages {
padding: 0 10px;
position: relative;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post {
transition: display .3s;
padding: 5px 0;
margin: 10px auto;
font-size: 13px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post .body {
color: #c3c3c3;
display: block;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post .avatar {
width: 45.71px;
border-radius: 50% !important;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.in .avatar {
float: left;
margin-right: 10px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.out .avatar {
float: right;
margin-left: 10px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post .datetime,.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post .name {
font-size: 12px;
font-weight: 300;
color: #8496a7;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post .message {
display: block;
padding: 5px;
position: relative;
color: #90a1af;
background: #36424c;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.in .message {
text-align: left;
margin-left: 55px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.in .message .arrow {
display: block;
position: absolute;
top: 9px;
left: -6px;
width: 0;
height: 0;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-right-width: 6px;
border-right-style: solid;
border-right-color: #36424c;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.out .message {
margin-right: 55px;
text-align: right;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.out .message .arrow {
display: block;
position: absolute;
top: 9px;
right: -6px;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left-width: 6px;
border-left-style: solid;
border-left-color: #36424c;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.out .datetime,.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-messages .post.out .name {
text-align: right;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-chat .page-quick-sidebar-chat-user .page-quick-sidebar-chat-user-form {
padding: 20px 10px 15px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-alerts .page-quick-sidebar-alerts-list {
padding: 10px 0;
position: relative;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-alerts .page-quick-sidebar-alerts-list .feeds li a {
color: #7e91a2;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-alerts .page-quick-sidebar-alerts-list .feeds li a .label {
margin-top: 5px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-alerts .page-quick-sidebar-alerts-list .feeds li a .desc {
text-decoration: underline;
padding: 0;
color: #788c9e;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-alerts .page-quick-sidebar-alerts-list .feeds li a .date {
color: #5d7081;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-settings .page-quick-sidebar-settings-list {
padding: 10px 0;
position: relative;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-settings .page-quick-sidebar-settings-list .list-items li .bootstrap-switch {
margin-top: -3px;
float: right;
border: 0;
min-width: 59px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-settings .page-quick-sidebar-settings-list .list-items li .form-control {
width: 75px !important;
padding: 4px !important;
float: right;
border: 0;
margin-top: -4px;
}
.page-quick-sidebar-wrapper .page-quick-sidebar .page-quick-sidebar-settings .page-quick-sidebar-settings-list .list-items li select.form-control {
padding: 4px 0 !important;
}
.page-on-load {
background: #fefefe;
}
.page-on-load .page-container,.page-on-load .page-footer,.page-on-load .page-header,.page-on-load>.clearfix {
display: none;
transition: all 2s;
}
|
Opfer/ButterflyHub
|
butterflyhub/public/css/layout.css
|
CSS
|
apache-2.0
| 65,206
|
package com.cool.api;
import java.util.List;
import com.cool.base.BaseService;
import com.cool.model.SysUserMenu;
public interface SysUserMenuService extends BaseService<SysUserMenu>{
}
|
pcjone/cool
|
cool-api/src/main/java/com/cool/api/SysUserMenuService.java
|
Java
|
apache-2.0
| 190
|
import django_filters
from django_filters import rest_framework as filters
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy_chapter import SpiritProphecyChapter, SpiritProphecyChapterLanguage
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy import SpiritProphecy
from django_rv_apps.apps.believe_his_prophets.models.language import Language
from django.utils import timezone
class SpiritProphecyChapterLanguageFilter(django_filters.FilterSet):
code_iso = filters.ModelMultipleChoiceFilter(
queryset=Language.objects.all(),
field_name='language__code_iso',
to_field_name='code_iso'
)
start_date = filters.CharFilter(method='filter_date')
class Meta:
model = SpiritProphecyChapterLanguage
fields = ('id' ,'code_iso','start_date')
def filter_date(self, queryset, name, value):
t = timezone.localtime(timezone.now())
return queryset.filter(
spirit_prophecy_chapter__start_date__year = t.year,
spirit_prophecy_chapter__start_date__month = t.month, spirit_prophecy_chapter__start_date__day = t.day,
)
|
davrv93/creed-en-sus-profetas-backend
|
django_rv_apps/apps/believe_his_prophets_api/views/spirit_prophecy_chapter_language/filters.py
|
Python
|
apache-2.0
| 1,155
|
import logging
from django.core import management
from django.core.management.base import BaseCommand
from awx.main.models import OAuth2AccessToken
from oauth2_provider.models import RefreshToken
class Command(BaseCommand):
def init_logging(self):
log_levels = dict(enumerate([logging.ERROR, logging.INFO,
logging.DEBUG, 0]))
self.logger = logging.getLogger('awx.main.commands.cleanup_tokens')
self.logger.setLevel(log_levels.get(self.verbosity, 0))
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(message)s'))
self.logger.addHandler(handler)
self.logger.propagate = False
def execute(self, *args, **options):
self.verbosity = int(options.get('verbosity', 1))
self.init_logging()
total_accesstokens = OAuth2AccessToken.objects.all().count()
total_refreshtokens = RefreshToken.objects.all().count()
management.call_command('cleartokens')
self.logger.info("Expired OAuth 2 Access Tokens deleted: {}".format(total_accesstokens - OAuth2AccessToken.objects.all().count()))
self.logger.info("Expired OAuth 2 Refresh Tokens deleted: {}".format(total_refreshtokens - RefreshToken.objects.all().count()))
|
GoogleCloudPlatform/sap-deployment-automation
|
third_party/github.com/ansible/awx/awx/main/management/commands/cleanup_tokens.py
|
Python
|
apache-2.0
| 1,286
|
package com.prado.cerveja.controller;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class SegurancaController {
@GetMapping("/login")
public String login(@AuthenticationPrincipal User user){
if(user != null){
return "redirect:/cerveja/novo";
}
return "Login";
}
@GetMapping("/403")
public String acessoNegado(){
return("403");
}
}
|
Rafael-Prado/Fabrica_Cerveja
|
src/main/java/com/prado/cerveja/controller/SegurancaController.java
|
Java
|
apache-2.0
| 574
|
# Halocharis vesiculosa Moq. SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Chenopodiaceae/Halarchon/Halarchon vesiculosus/ Syn. Halocharis vesiculosa/README.md
|
Markdown
|
apache-2.0
| 183
|
# Telipogon medusae Dressler 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/Asparagales/Orchidaceae/Telipogon/Telipogon medusae/README.md
|
Markdown
|
apache-2.0
| 184
|
# Multilepidina Hanzawa, 1932 GENUS
#### Status
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
Proc. Imp. Acad. Tokyo, 8, 446.
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/incertae sedis/Multilepidina/README.md
|
Markdown
|
apache-2.0
| 218
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.