text
stringlengths 7
1.01M
|
|---|
/**
* Copyright © 2016-2021 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.thingsboard.server.common.data.oauth2;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.thingsboard.server.common.data.HasName;
import org.thingsboard.server.common.data.SearchTextBasedWithAdditionalInfo;
import org.thingsboard.server.common.data.id.OAuth2ClientRegistrationInfoId;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(exclude = {"clientSecret"})
@NoArgsConstructor
public class OAuth2ClientRegistrationInfo extends SearchTextBasedWithAdditionalInfo<OAuth2ClientRegistrationInfoId> implements HasName {
private boolean enabled;
private OAuth2MapperConfig mapperConfig;
private String clientId;
private String clientSecret;
private String authorizationUri;
private String accessTokenUri;
private List<String> scope;
private String userInfoUri;
private String userNameAttributeName;
private String jwkSetUri;
private String clientAuthenticationMethod;
private String loginButtonLabel;
private String loginButtonIcon;
public OAuth2ClientRegistrationInfo(OAuth2ClientRegistrationInfo clientRegistration) {
super(clientRegistration);
this.enabled = clientRegistration.enabled;
this.mapperConfig = clientRegistration.mapperConfig;
this.clientId = clientRegistration.clientId;
this.clientSecret = clientRegistration.clientSecret;
this.authorizationUri = clientRegistration.authorizationUri;
this.accessTokenUri = clientRegistration.accessTokenUri;
this.scope = clientRegistration.scope;
this.userInfoUri = clientRegistration.userInfoUri;
this.userNameAttributeName = clientRegistration.userNameAttributeName;
this.jwkSetUri = clientRegistration.jwkSetUri;
this.clientAuthenticationMethod = clientRegistration.clientAuthenticationMethod;
this.loginButtonLabel = clientRegistration.loginButtonLabel;
this.loginButtonIcon = clientRegistration.loginButtonIcon;
}
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public String getName() {
return loginButtonLabel;
}
@Override
public String getSearchText() {
return getName();
}
}
|
package org.jgroups.protocols;
import org.jgroups.Address;
import org.jgroups.Global;
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.protocols.pbcast.GMS;
import org.jgroups.protocols.pbcast.NAKACK2;
import org.jgroups.stack.Protocol;
import org.jgroups.util.MyReceiver;
import org.jgroups.util.Util;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.List;
/**
* Tests UNICAST2. Created to test the last-message-dropped problem, see https://issues.jboss.org/browse/JGRP-1548.
* @author Bela Ban
* @since 3.3
*/
@Test(groups=Global.FUNCTIONAL,singleThreaded=true)
public class UNICAST_DropFirstAndLastTest {
protected JChannel a, b;
protected MyReceiver<Integer> rb;
protected DISCARD discard; // on A
protected void setup(Class<? extends Protocol> unicast_class) throws Exception {
a=createChannel(unicast_class, "A");
discard=(DISCARD)a.getProtocolStack().findProtocol(DISCARD.class);
assert discard != null;
a.connect("UNICAST_DropFirstAndLastTest");
rb=new MyReceiver<Integer>().name("B").verbose(true);
b=createChannel(unicast_class, "B").receiver(rb);
b.connect("UNICAST_DropFirstAndLastTest");
Util.waitUntilAllChannelsHaveSameSize(10000, 500, a, b);
}
@AfterMethod protected void destroy() {setLevel("warn", a, b); Util.close(b, a); rb.reset();}
@DataProvider
static Object[][] configProvider() {
return new Object[][]{
{UNICAST.class},
{UNICAST2.class},
{UNICAST3.class}
};
}
/**
* A sends unicast messages 1-5 to B, but we drop message 5. The code in
* https://issues.jboss.org/browse/JGRP-1548 now needs to make sure message 5 is retransmitted to B
* within a short time period, and we don't have to rely on the stable task to kick in.
*/
@Test(dataProvider="configProvider")
public void testLastMessageDropped(Class<? extends Protocol> unicast_class) throws Exception {
setup(unicast_class);
setLevel("trace", a, b);
Address dest=b.getAddress();
for(int i=1; i <= 5; i++) {
Message msg=new Message(dest, i);
if(i == 5)
discard.setDropDownUnicasts(1); // drops the next unicast
a.send(msg);
}
List<Integer> msgs=rb.list();
Util.waitUntilListHasSize(msgs, 5, 5000, 500);
System.out.println("list=" + msgs);
}
/**
* A sends unicast message 1 to B, but we drop message 1. The code in
* https://issues.jboss.org/browse/JGRP-1563 now needs to make sure message 1 is retransmitted to B
* within a short time period, and we don't have to rely on the stable task to kick in.
*/
@Test(dataProvider="configProvider")
public void testFirstMessageDropped(Class<? extends Protocol> unicast_class) throws Exception {
setup(unicast_class);
System.out.println("**** closing all connections ****");
// close all connections, so we can start from scratch and send message A1 to B
for(JChannel ch: Arrays.asList(a,b)) {
Protocol unicast=ch.getProtocolStack().findProtocol(Util.getUnicastProtocols());
removeAllConnections(unicast);
}
setLevel("trace", a, b);
System.out.println("--> A sending first message to B (dropped before it reaches B)");
discard.setDropDownUnicasts(1); // drops the next unicast
a.send(new Message(b.getAddress(), 1));
List<Integer> msgs=rb.list();
try {
Util.waitUntilListHasSize(msgs, 1, 500000, 500);
}
catch(AssertionError err) {
printConnectionTables(a, b);
throw err;
}
System.out.println("list=" + msgs);
printConnectionTables(a, b);
// assert ((UNICAST2)a.getProtocolStack().findProtocol(UNICAST2.class)).connectionEstablished(b.getAddress());
}
protected JChannel createChannel(Class<? extends Protocol> unicast_class, String name) throws Exception {
Protocol unicast=unicast_class.newInstance();
if(unicast instanceof UNICAST2)
unicast.setValue("stable_interval", 1000);
return new JChannel(new SHARED_LOOPBACK().setValue("enable_batching", true),
new PING().setValue("timeout", 1000),
new NAKACK2().setValue("use_mcast_xmit", false),
new DISCARD(),
unicast.setValue("xmit_interval", 500),
new GMS().setValue("print_local_addr", false))
.name(name);
}
protected void printConnectionTables(JChannel ... channels) {
System.out.println("**** CONNECTIONS:");
for(JChannel ch: channels) {
Protocol ucast=ch.getProtocolStack().findProtocol(Util.getUnicastProtocols());
System.out.println(ch.getName() + ":\n" + printConnections(ucast) + "\n");
}
}
protected void setLevel(String level, JChannel ... channels) {
for(JChannel ch: channels)
ch.getProtocolStack().findProtocol(Util.getUnicastProtocols()).level(level);
}
protected String printConnections(Protocol prot) {
if(prot instanceof UNICAST) {
UNICAST unicast=(UNICAST)prot;
return unicast.printConnections();
}
else if(prot instanceof UNICAST2) {
UNICAST2 unicast=(UNICAST2)prot;
return unicast.printConnections();
}
else if(prot instanceof UNICAST3) {
UNICAST3 unicast=(UNICAST3)prot;
return unicast.printConnections();
}
else
throw new IllegalArgumentException("prot (" + prot + ") needs to be UNICAST, UNICAST2 or UNICAST3");
}
protected void removeAllConnections(Protocol prot) {
if(prot instanceof UNICAST) {
UNICAST unicast=(UNICAST)prot;
unicast.removeAllConnections();
}
else if(prot instanceof UNICAST2) {
UNICAST2 unicast=(UNICAST2)prot;
unicast.removeAllConnections();
}
else if(prot instanceof UNICAST3) {
UNICAST3 unicast=(UNICAST3)prot;
unicast.removeAllConnections();
}
else
throw new IllegalArgumentException("prot (" + prot + ") needs to be UNICAST, UNICAST2 or UNICAST3");
}
}
|
/*
* 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.flink.storm.exclamation.util;
/**
* Expected output of Exclamation programs.
*/
public class ExclamationData {
public static final String TEXT_WITH_EXCLAMATIONS =
"Goethe - Faust: Der Tragoedie erster Teil!!!!!!\n"
+ "Prolog im Himmel.!!!!!!\n"
+ "Der Herr. Die himmlischen Heerscharen. Nachher Mephistopheles. Die drei!!!!!!\n"
+ "Erzengel treten vor.!!!!!!\n"
+ "RAPHAEL: Die Sonne toent, nach alter Weise, In Brudersphaeren Wettgesang,!!!!!!\n"
+ "Und ihre vorgeschriebne Reise Vollendet sie mit Donnergang. Ihr Anblick!!!!!!\n"
+ "gibt den Engeln Staerke, Wenn keiner Sie ergruenden mag; die unbegreiflich!!!!!!\n"
+ "hohen Werke Sind herrlich wie am ersten Tag.!!!!!!\n"
+ "GABRIEL: Und schnell und unbegreiflich schnelle Dreht sich umher der Erde!!!!!!\n"
+ "Pracht; Es wechselt Paradieseshelle Mit tiefer, schauervoller Nacht. Es!!!!!!\n"
+ "schaeumt das Meer in breiten Fluessen Am tiefen Grund der Felsen auf, Und!!!!!!\n"
+ "Fels und Meer wird fortgerissen Im ewig schnellem Sphaerenlauf.!!!!!!\n"
+ "MICHAEL: Und Stuerme brausen um die Wette Vom Meer aufs Land, vom Land!!!!!!\n"
+ "aufs Meer, und bilden wuetend eine Kette Der tiefsten Wirkung rings umher.!!!!!!\n"
+ "Da flammt ein blitzendes Verheeren Dem Pfade vor des Donnerschlags. Doch!!!!!!\n"
+ "deine Boten, Herr, verehren Das sanfte Wandeln deines Tags.!!!!!!\n"
+ "ZU DREI: Der Anblick gibt den Engeln Staerke, Da keiner dich ergruenden!!!!!!\n"
+ "mag, Und alle deine hohen Werke Sind herrlich wie am ersten Tag.!!!!!!\n"
+ "MEPHISTOPHELES: Da du, o Herr, dich einmal wieder nahst Und fragst, wie!!!!!!\n"
+ "alles sich bei uns befinde, Und du mich sonst gewoehnlich gerne sahst, So!!!!!!\n"
+ "siehst du mich auch unter dem Gesinde. Verzeih, ich kann nicht hohe Worte!!!!!!\n"
+ "machen, Und wenn mich auch der ganze Kreis verhoehnt; Mein Pathos braechte!!!!!!\n"
+ "dich gewiss zum Lachen, Haettst du dir nicht das Lachen abgewoehnt. Von!!!!!!\n"
+ "Sonn' und Welten weiss ich nichts zu sagen, Ich sehe nur, wie sich die!!!!!!\n"
+ "Menschen plagen. Der kleine Gott der Welt bleibt stets von gleichem!!!!!!\n"
+ "Schlag, Und ist so wunderlich als wie am ersten Tag. Ein wenig besser!!!!!!\n"
+ "wuerd er leben, Haettst du ihm nicht den Schein des Himmelslichts gegeben;!!!!!!\n"
+ "Er nennt's Vernunft und braucht's allein, Nur tierischer als jedes Tier!!!!!!\n"
+ "zu sein. Er scheint mir, mit Verlaub von euer Gnaden, Wie eine der!!!!!!\n"
+ "langbeinigen Zikaden, Die immer fliegt und fliegend springt Und gleich im!!!!!!\n"
+ "Gras ihr altes Liedchen singt; Und laeg er nur noch immer in dem Grase! In!!!!!!\n"
+ "jeden Quark begraebt er seine Nase.!!!!!!\n"
+ "DER HERR: Hast du mir weiter nichts zu sagen? Kommst du nur immer!!!!!!\n"
+ "anzuklagen? Ist auf der Erde ewig dir nichts recht?!!!!!!\n"
+ "MEPHISTOPHELES: Nein Herr! ich find es dort, wie immer, herzlich!!!!!!\n"
+ "schlecht. Die Menschen dauern mich in ihren Jammertagen, Ich mag sogar!!!!!!\n"
+ "die armen selbst nicht plagen.!!!!!!\n" + "DER HERR: Kennst du den Faust?!!!!!!\n"
+ "MEPHISTOPHELES: Den Doktor?!!!!!!\n"
+ "DER HERR: Meinen Knecht!!!!!!!\n"
+ "MEPHISTOPHELES: Fuerwahr! er dient Euch auf besondre Weise. Nicht irdisch!!!!!!\n"
+ "ist des Toren Trank noch Speise. Ihn treibt die Gaerung in die Ferne, Er!!!!!!\n"
+ "ist sich seiner Tollheit halb bewusst; Vom Himmel fordert er die schoensten!!!!!!\n"
+ "Sterne Und von der Erde jede hoechste Lust, Und alle Naeh und alle Ferne!!!!!!\n"
+ "Befriedigt nicht die tiefbewegte Brust.!!!!!!\n"
+ "DER HERR: Wenn er mir auch nur verworren dient, So werd ich ihn bald in!!!!!!\n"
+ "die Klarheit fuehren. Weiss doch der Gaertner, wenn das Baeumchen gruent, Das!!!!!!\n"
+ "Bluet und Frucht die kuenft'gen Jahre zieren.!!!!!!\n"
+ "MEPHISTOPHELES: Was wettet Ihr? den sollt Ihr noch verlieren! Wenn Ihr!!!!!!\n"
+ "mir die Erlaubnis gebt, Ihn meine Strasse sacht zu fuehren.!!!!!!\n"
+ "DER HERR: Solang er auf der Erde lebt, So lange sei dir's nicht verboten,!!!!!!\n"
+ "Es irrt der Mensch so lang er strebt.!!!!!!\n"
+ "MEPHISTOPHELES: Da dank ich Euch; denn mit den Toten Hab ich mich niemals!!!!!!\n"
+ "gern befangen. Am meisten lieb ich mir die vollen, frischen Wangen. Fuer!!!!!!\n"
+ "einem Leichnam bin ich nicht zu Haus; Mir geht es wie der Katze mit der Maus.!!!!!!\n"
+ "DER HERR: Nun gut, es sei dir ueberlassen! Zieh diesen Geist von seinem!!!!!!\n"
+ "Urquell ab, Und fuehr ihn, kannst du ihn erfassen, Auf deinem Wege mit!!!!!!\n"
+ "herab, Und steh beschaemt, wenn du bekennen musst: Ein guter Mensch, in!!!!!!\n"
+ "seinem dunklen Drange, Ist sich des rechten Weges wohl bewusst.!!!!!!\n"
+ "MEPHISTOPHELES: Schon gut! nur dauert es nicht lange. Mir ist fuer meine!!!!!!\n"
+ "Wette gar nicht bange. Wenn ich zu meinem Zweck gelange, Erlaubt Ihr mir!!!!!!\n"
+ "Triumph aus voller Brust. Staub soll er fressen, und mit Lust, Wie meine!!!!!!\n"
+ "Muhme, die beruehmte Schlange.!!!!!!\n"
+ "DER HERR: Du darfst auch da nur frei erscheinen; Ich habe deinesgleichen!!!!!!\n"
+ "nie gehasst. Von allen Geistern, die verneinen, ist mir der Schalk am!!!!!!\n"
+ "wenigsten zur Last. Des Menschen Taetigkeit kann allzu leicht erschlaffen,!!!!!!\n"
+ "er liebt sich bald die unbedingte Ruh; Drum geb ich gern ihm den Gesellen!!!!!!\n"
+ "zu, Der reizt und wirkt und muss als Teufel schaffen. Doch ihr, die echten!!!!!!\n"
+ "Goettersoehne, Erfreut euch der lebendig reichen Schoene! Das Werdende, das!!!!!!\n"
+ "ewig wirkt und lebt, Umfass euch mit der Liebe holden Schranken, Und was!!!!!!\n"
+ "in schwankender Erscheinung schwebt, Befestigt mit dauernden Gedanken!!!!!!!\n"
+ "(Der Himmel schliesst, die Erzengel verteilen sich.)!!!!!!\n"
+ "MEPHISTOPHELES (allein): Von Zeit zu Zeit seh ich den Alten gern, Und!!!!!!\n"
+ "huete mich, mit ihm zu brechen. Es ist gar huebsch von einem grossen Herrn,!!!!!!\n"
+ "So menschlich mit dem Teufel selbst zu sprechen.!!!!!!";
}
|
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.cme.v20191029.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class VideoTrackItem extends AbstractModel{
/**
* 视频媒体来源类型,取值有:
<ul>
<li>VOD :媒体来源于云点播文件 。</li>
<li>CME :视频来源制作云媒体文件。</li>
<li>EXTERNAL :视频来源于媒资绑定。</li>
</ul>
*/
@SerializedName("SourceType")
@Expose
private String SourceType;
/**
* 视频片段的媒体文件来源,取值为:
<ul>
<li>当 SourceType 为 VOD 时,为云点播的媒体文件 FileId ,会默认将该 FileId 导入到项目中;</li>
<li>当 SourceType 为 CME 时,为制作云的媒体 ID,项目归属者必须对该云媒资有访问权限;</li>
<li>当 SourceType 为 EXTERNAL 时,为媒资绑定的 Definition 与 MediaKey 中间用冒号分隔合并后的字符串,格式为 Definition:MediaKey 。</li>
</ul>
*/
@SerializedName("SourceMedia")
@Expose
private String SourceMedia;
/**
* 视频片段取自媒体文件的起始时间,单位为秒。默认为0。
*/
@SerializedName("SourceMediaStartTime")
@Expose
private Float SourceMediaStartTime;
/**
* 视频片段时长,单位为秒。默认取视频媒体文件本身长度,表示截取全部媒体文件。如果源文件是图片,Duration需要大于0。
*/
@SerializedName("Duration")
@Expose
private Float Duration;
/**
* 视频片段原点距离画布原点的水平位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 XPos 为画布宽度指定百分比的位置,如 10% 表示 XPos 为画布口宽度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 XPos 单位为像素,如 100px 表示 XPos 为100像素。</li>
默认值:0px。
*/
@SerializedName("XPos")
@Expose
private String XPos;
/**
* 视频片段原点距离画布原点的垂直位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 YPos 为画布高度指定百分比的位置,如 10% 表示 YPos 为画布高度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 YPos 单位为像素,如 100px 表示 YPos 为100像素。</li>
默认值:0px。
*/
@SerializedName("YPos")
@Expose
private String YPos;
/**
* 视频原点位置,取值有:
<li>Center:坐标原点为中心位置,如画布中心。</li>
默认值 :Center。
*/
@SerializedName("CoordinateOrigin")
@Expose
private String CoordinateOrigin;
/**
* 视频片段的高度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Height 为画布高度的百分比大小,如 10% 表示 Height 为画布高度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Height 单位为像素,如 100px 表示 Height 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
*/
@SerializedName("Height")
@Expose
private String Height;
/**
* 视频片段的宽度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Width 为画布宽度的百分比大小,如 10% 表示 Width 为画布宽度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Width 单位为像素,如 100px 表示 Width 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
*/
@SerializedName("Width")
@Expose
private String Width;
/**
* Get 视频媒体来源类型,取值有:
<ul>
<li>VOD :媒体来源于云点播文件 。</li>
<li>CME :视频来源制作云媒体文件。</li>
<li>EXTERNAL :视频来源于媒资绑定。</li>
</ul>
* @return SourceType 视频媒体来源类型,取值有:
<ul>
<li>VOD :媒体来源于云点播文件 。</li>
<li>CME :视频来源制作云媒体文件。</li>
<li>EXTERNAL :视频来源于媒资绑定。</li>
</ul>
*/
public String getSourceType() {
return this.SourceType;
}
/**
* Set 视频媒体来源类型,取值有:
<ul>
<li>VOD :媒体来源于云点播文件 。</li>
<li>CME :视频来源制作云媒体文件。</li>
<li>EXTERNAL :视频来源于媒资绑定。</li>
</ul>
* @param SourceType 视频媒体来源类型,取值有:
<ul>
<li>VOD :媒体来源于云点播文件 。</li>
<li>CME :视频来源制作云媒体文件。</li>
<li>EXTERNAL :视频来源于媒资绑定。</li>
</ul>
*/
public void setSourceType(String SourceType) {
this.SourceType = SourceType;
}
/**
* Get 视频片段的媒体文件来源,取值为:
<ul>
<li>当 SourceType 为 VOD 时,为云点播的媒体文件 FileId ,会默认将该 FileId 导入到项目中;</li>
<li>当 SourceType 为 CME 时,为制作云的媒体 ID,项目归属者必须对该云媒资有访问权限;</li>
<li>当 SourceType 为 EXTERNAL 时,为媒资绑定的 Definition 与 MediaKey 中间用冒号分隔合并后的字符串,格式为 Definition:MediaKey 。</li>
</ul>
* @return SourceMedia 视频片段的媒体文件来源,取值为:
<ul>
<li>当 SourceType 为 VOD 时,为云点播的媒体文件 FileId ,会默认将该 FileId 导入到项目中;</li>
<li>当 SourceType 为 CME 时,为制作云的媒体 ID,项目归属者必须对该云媒资有访问权限;</li>
<li>当 SourceType 为 EXTERNAL 时,为媒资绑定的 Definition 与 MediaKey 中间用冒号分隔合并后的字符串,格式为 Definition:MediaKey 。</li>
</ul>
*/
public String getSourceMedia() {
return this.SourceMedia;
}
/**
* Set 视频片段的媒体文件来源,取值为:
<ul>
<li>当 SourceType 为 VOD 时,为云点播的媒体文件 FileId ,会默认将该 FileId 导入到项目中;</li>
<li>当 SourceType 为 CME 时,为制作云的媒体 ID,项目归属者必须对该云媒资有访问权限;</li>
<li>当 SourceType 为 EXTERNAL 时,为媒资绑定的 Definition 与 MediaKey 中间用冒号分隔合并后的字符串,格式为 Definition:MediaKey 。</li>
</ul>
* @param SourceMedia 视频片段的媒体文件来源,取值为:
<ul>
<li>当 SourceType 为 VOD 时,为云点播的媒体文件 FileId ,会默认将该 FileId 导入到项目中;</li>
<li>当 SourceType 为 CME 时,为制作云的媒体 ID,项目归属者必须对该云媒资有访问权限;</li>
<li>当 SourceType 为 EXTERNAL 时,为媒资绑定的 Definition 与 MediaKey 中间用冒号分隔合并后的字符串,格式为 Definition:MediaKey 。</li>
</ul>
*/
public void setSourceMedia(String SourceMedia) {
this.SourceMedia = SourceMedia;
}
/**
* Get 视频片段取自媒体文件的起始时间,单位为秒。默认为0。
* @return SourceMediaStartTime 视频片段取自媒体文件的起始时间,单位为秒。默认为0。
*/
public Float getSourceMediaStartTime() {
return this.SourceMediaStartTime;
}
/**
* Set 视频片段取自媒体文件的起始时间,单位为秒。默认为0。
* @param SourceMediaStartTime 视频片段取自媒体文件的起始时间,单位为秒。默认为0。
*/
public void setSourceMediaStartTime(Float SourceMediaStartTime) {
this.SourceMediaStartTime = SourceMediaStartTime;
}
/**
* Get 视频片段时长,单位为秒。默认取视频媒体文件本身长度,表示截取全部媒体文件。如果源文件是图片,Duration需要大于0。
* @return Duration 视频片段时长,单位为秒。默认取视频媒体文件本身长度,表示截取全部媒体文件。如果源文件是图片,Duration需要大于0。
*/
public Float getDuration() {
return this.Duration;
}
/**
* Set 视频片段时长,单位为秒。默认取视频媒体文件本身长度,表示截取全部媒体文件。如果源文件是图片,Duration需要大于0。
* @param Duration 视频片段时长,单位为秒。默认取视频媒体文件本身长度,表示截取全部媒体文件。如果源文件是图片,Duration需要大于0。
*/
public void setDuration(Float Duration) {
this.Duration = Duration;
}
/**
* Get 视频片段原点距离画布原点的水平位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 XPos 为画布宽度指定百分比的位置,如 10% 表示 XPos 为画布口宽度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 XPos 单位为像素,如 100px 表示 XPos 为100像素。</li>
默认值:0px。
* @return XPos 视频片段原点距离画布原点的水平位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 XPos 为画布宽度指定百分比的位置,如 10% 表示 XPos 为画布口宽度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 XPos 单位为像素,如 100px 表示 XPos 为100像素。</li>
默认值:0px。
*/
public String getXPos() {
return this.XPos;
}
/**
* Set 视频片段原点距离画布原点的水平位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 XPos 为画布宽度指定百分比的位置,如 10% 表示 XPos 为画布口宽度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 XPos 单位为像素,如 100px 表示 XPos 为100像素。</li>
默认值:0px。
* @param XPos 视频片段原点距离画布原点的水平位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 XPos 为画布宽度指定百分比的位置,如 10% 表示 XPos 为画布口宽度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 XPos 单位为像素,如 100px 表示 XPos 为100像素。</li>
默认值:0px。
*/
public void setXPos(String XPos) {
this.XPos = XPos;
}
/**
* Get 视频片段原点距离画布原点的垂直位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 YPos 为画布高度指定百分比的位置,如 10% 表示 YPos 为画布高度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 YPos 单位为像素,如 100px 表示 YPos 为100像素。</li>
默认值:0px。
* @return YPos 视频片段原点距离画布原点的垂直位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 YPos 为画布高度指定百分比的位置,如 10% 表示 YPos 为画布高度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 YPos 单位为像素,如 100px 表示 YPos 为100像素。</li>
默认值:0px。
*/
public String getYPos() {
return this.YPos;
}
/**
* Set 视频片段原点距离画布原点的垂直位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 YPos 为画布高度指定百分比的位置,如 10% 表示 YPos 为画布高度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 YPos 单位为像素,如 100px 表示 YPos 为100像素。</li>
默认值:0px。
* @param YPos 视频片段原点距离画布原点的垂直位置。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 YPos 为画布高度指定百分比的位置,如 10% 表示 YPos 为画布高度的 10%。</li>
<li>当字符串以 px 结尾,表示视频片段 YPos 单位为像素,如 100px 表示 YPos 为100像素。</li>
默认值:0px。
*/
public void setYPos(String YPos) {
this.YPos = YPos;
}
/**
* Get 视频原点位置,取值有:
<li>Center:坐标原点为中心位置,如画布中心。</li>
默认值 :Center。
* @return CoordinateOrigin 视频原点位置,取值有:
<li>Center:坐标原点为中心位置,如画布中心。</li>
默认值 :Center。
*/
public String getCoordinateOrigin() {
return this.CoordinateOrigin;
}
/**
* Set 视频原点位置,取值有:
<li>Center:坐标原点为中心位置,如画布中心。</li>
默认值 :Center。
* @param CoordinateOrigin 视频原点位置,取值有:
<li>Center:坐标原点为中心位置,如画布中心。</li>
默认值 :Center。
*/
public void setCoordinateOrigin(String CoordinateOrigin) {
this.CoordinateOrigin = CoordinateOrigin;
}
/**
* Get 视频片段的高度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Height 为画布高度的百分比大小,如 10% 表示 Height 为画布高度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Height 单位为像素,如 100px 表示 Height 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
* @return Height 视频片段的高度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Height 为画布高度的百分比大小,如 10% 表示 Height 为画布高度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Height 单位为像素,如 100px 表示 Height 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
*/
public String getHeight() {
return this.Height;
}
/**
* Set 视频片段的高度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Height 为画布高度的百分比大小,如 10% 表示 Height 为画布高度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Height 单位为像素,如 100px 表示 Height 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
* @param Height 视频片段的高度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Height 为画布高度的百分比大小,如 10% 表示 Height 为画布高度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Height 单位为像素,如 100px 表示 Height 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
*/
public void setHeight(String Height) {
this.Height = Height;
}
/**
* Get 视频片段的宽度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Width 为画布宽度的百分比大小,如 10% 表示 Width 为画布宽度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Width 单位为像素,如 100px 表示 Width 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
* @return Width 视频片段的宽度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Width 为画布宽度的百分比大小,如 10% 表示 Width 为画布宽度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Width 单位为像素,如 100px 表示 Width 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
*/
public String getWidth() {
return this.Width;
}
/**
* Set 视频片段的宽度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Width 为画布宽度的百分比大小,如 10% 表示 Width 为画布宽度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Width 单位为像素,如 100px 表示 Width 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
* @param Width 视频片段的宽度。支持 %、px 两种格式:
<li>当字符串以 % 结尾,表示视频片段 Width 为画布宽度的百分比大小,如 10% 表示 Width 为画布宽度的 10%;</li>
<li>当字符串以 px 结尾,表示视频片段 Width 单位为像素,如 100px 表示 Width 为100像素;</li>
<li>当 Width、Height 均为空,则 Width 和 Height 取视频媒体文件本身的 Width、Height;</li>
<li>当 Width 为空,Height 非空,则 Width 按比例缩放;</li>
<li>当 Width 非空,Height 为空,则 Height 按比例缩放。</li>
*/
public void setWidth(String Width) {
this.Width = Width;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "SourceType", this.SourceType);
this.setParamSimple(map, prefix + "SourceMedia", this.SourceMedia);
this.setParamSimple(map, prefix + "SourceMediaStartTime", this.SourceMediaStartTime);
this.setParamSimple(map, prefix + "Duration", this.Duration);
this.setParamSimple(map, prefix + "XPos", this.XPos);
this.setParamSimple(map, prefix + "YPos", this.YPos);
this.setParamSimple(map, prefix + "CoordinateOrigin", this.CoordinateOrigin);
this.setParamSimple(map, prefix + "Height", this.Height);
this.setParamSimple(map, prefix + "Width", this.Width);
}
}
|
package com.google.android.gms.internal.ads;
public final class sy extends ez {
public sy(tx txVar, String str, String str2, xp xpVar, int i2, int i3) {
super(txVar, str, str2, xpVar, i2, 3);
}
/* access modifiers changed from: protected */
@Override // com.google.android.gms.internal.ads.ez
public final void a() {
synchronized (this.f4244e) {
gx gxVar = new gx((String) this.f4245f.invoke(null, this.f4241b.a()));
synchronized (this.f4244e) {
this.f4244e.f6028e = Long.valueOf(gxVar.f4456b);
this.f4244e.d0 = Long.valueOf(gxVar.f4457c);
}
}
}
}
|
/*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.webservices;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
/**
* Tests for {@link WebServicesProperties}.
*
* @author Madhura Bhave
*/
public class WebServicesPropertiesTests {
@Rule
public ExpectedException thrown = ExpectedException.none();
private WebServicesProperties properties;
@Test
public void pathMustNotBeEmpty() {
this.properties = new WebServicesProperties();
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Path must have length greater than 1");
this.properties.setPath("");
}
@Test
public void pathMustHaveLengthGreaterThanOne() {
this.properties = new WebServicesProperties();
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Path must have length greater than 1");
this.properties.setPath("/");
}
@Test
public void customPathMustBeginWithASlash() {
this.properties = new WebServicesProperties();
this.thrown.expect(IllegalArgumentException.class);
this.thrown.expectMessage("Path must start with '/'");
this.properties.setPath("custom");
}
}
|
package com.watson.propert.tycoon.game.bord;
import com.watson.propert.tycoon.game.entitys.Player;
/** Action that from Cards and Square need implement this interface */
public interface Action {
void run(Player player);
}
|
package com.battlelancer.seriesguide.jobs.episodes;
import android.content.Context;
import androidx.annotation.NonNull;
import com.battlelancer.seriesguide.R;
import com.battlelancer.seriesguide.provider.SgEpisode2Numbers;
import com.battlelancer.seriesguide.provider.SgRoomDatabase;
import java.util.List;
public class ShowCollectedJob extends ShowBaseJob {
private final boolean isCollected;
public ShowCollectedJob(long showId, boolean isCollected) {
super(showId, isCollected ? 1 : 0, JobAction.EPISODE_COLLECTION);
this.isCollected = isCollected;
}
@Override
protected boolean applyDatabaseChanges(@NonNull Context context) {
int rowsUpdated = SgRoomDatabase.getInstance(context).sgEpisode2Helper()
.updateCollectedOfShowExcludeSpecials(getShowId(), isCollected);
return rowsUpdated >= 0; // -1 means error.
}
@NonNull
@Override
protected List<SgEpisode2Numbers> getEpisodesForNetworkJob(@NonNull Context context) {
return SgRoomDatabase.getInstance(context).sgEpisode2Helper()
.getEpisodeNumbersOfShow(getShowId());
}
@Override
protected int getPlaysForNetworkJob(int plays) {
return plays; // Collected change does not change plays.
}
@NonNull
@Override
public String getConfirmationText(Context context) {
return context.getString(isCollected
? R.string.action_collection_add : R.string.action_collection_remove);
}
}
|
/*******************************************************************************
*
* This file is part of iBioSim. Please visit <http://www.async.ece.utah.edu/ibiosim>
* for the latest version of iBioSim.
*
* Copyright (C) 2017 University of Utah
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the Apache License. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution
* and also available online at <http://www.async.ece.utah.edu/ibiosim/License>.
*
*******************************************************************************/
package edu.utah.ece.async.ibiosim.gui.modelEditor.gcm;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.sbml.jsbml.LocalParameter;
import org.sbml.jsbml.Model;
import org.sbml.jsbml.Reaction;
import org.sbml.jsbml.SBase;
import org.sbml.jsbml.Species;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.AnnotationUtility;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.annotation.SBOLAnnotation;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.parser.BioModel;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.SBMLutilities;
import edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility;
import edu.utah.ece.async.ibiosim.dataModels.util.GlobalConstants;
import edu.utah.ece.async.ibiosim.dataModels.util.exceptions.BioSimException;
import edu.utah.ece.async.ibiosim.gui.Gui;
import edu.utah.ece.async.ibiosim.gui.modelEditor.sbmlcore.MySpecies;
import edu.utah.ece.async.ibiosim.gui.modelEditor.sbol.SBOLField2;
import edu.utah.ece.async.ibiosim.gui.modelEditor.schematic.ModelEditor;
import edu.utah.ece.async.ibiosim.gui.modelEditor.schematic.Utils;
import edu.utah.ece.async.ibiosim.gui.modelEditor.util.PropertyField;
import edu.utah.ece.async.ibiosim.gui.modelEditor.util.PropertyList;
/**
*
* @author Chris Myers
* @author <a href="http://www.async.ece.utah.edu/ibiosim#Credits"> iBioSim Contributors </a>
* @version %I%
*/
public class PromoterPanel extends JPanel implements ActionListener {
private static final long serialVersionUID = 5873800942710657929L;
private String[] options = { "Ok", "Cancel" };
private HashMap<String, PropertyField> fields = null;
private SBOLField2 sbolField;
private String selected = "";
private BioModel bioModel = null;
private boolean paramsOnly;
private ModelEditor modelEditor = null;
private Species promoter = null;
private Reaction production = null;
private PropertyList speciesList;
private JComboBox compartBox = null;
private JTextField iIndex = null;
public PromoterPanel(String selected, BioModel bioModel, PropertyList speciesList, boolean paramsOnly, BioModel refGCM,
ModelEditor modelEditor) {
super(new GridLayout(paramsOnly?7:13, 1));
this.selected = selected;
this.bioModel = bioModel;
this.paramsOnly = paramsOnly;
this.modelEditor = modelEditor;
this.speciesList = speciesList;
fields = new HashMap<String, PropertyField>();
Model model = bioModel.getSBMLDocument().getModel();
promoter = model.getSpecies(selected);
PropertyField field = null;
// ID field
String dimInID = SBMLutilities.getDimensionString(promoter);
field = new PropertyField(GlobalConstants.ID, promoter.getId() + dimInID, null, null, Utility.IDDimString, paramsOnly, "default", false);
fields.put(GlobalConstants.ID, field);
if (!paramsOnly) add(field);
// Name field
field = new PropertyField(GlobalConstants.NAME, promoter.getName(), null, null, Utility.NAMEstring, paramsOnly, "default", false);
fields.put(GlobalConstants.NAME, field);
if (!paramsOnly) add(field);
// Type field
JPanel tempPanel = new JPanel();
JLabel tempLabel = new JLabel(GlobalConstants.PORTTYPE);
typeBox = new JComboBox(types);
//typeBox.addActionListener(this);
tempPanel.setLayout(new GridLayout(1, 2));
tempPanel.add(tempLabel);
tempPanel.add(typeBox);
if (!paramsOnly) add(tempPanel);
if (bioModel.isInput(promoter.getId())) {
typeBox.setSelectedItem(GlobalConstants.INPUT);
} else if (bioModel.isOutput(promoter.getId())) {
typeBox.setSelectedItem(GlobalConstants.OUTPUT);
} else {
typeBox.setSelectedItem(GlobalConstants.INTERNAL);
}
production = bioModel.getProductionReaction(selected);
// compartment field
tempPanel = new JPanel();
tempLabel = new JLabel("Compartment");
compartBox = MySpecies.createCompartmentChoices(bioModel);
compartBox.setSelectedItem(promoter.getCompartment());
compartBox.addActionListener(this);
tempPanel.setLayout(new GridLayout(1, 2));
tempPanel.add(tempLabel);
tempPanel.add(compartBox);
if (!paramsOnly) add(tempPanel);
// indices field
tempPanel = new JPanel(new GridLayout(1, 2));
iIndex = new JTextField(20);
String freshIndex = SBMLutilities.getIndicesString(promoter, "compartment");
iIndex.setText(freshIndex);
tempPanel.add(new JLabel("Compartment Indices"));
tempPanel.add(iIndex);
if (!paramsOnly) add(tempPanel);
// promoter count
String origString = "default";
String defaultValue = bioModel.getParameter(GlobalConstants.PROMOTER_COUNT_STRING);
String formatString = Utility.NUMstring;
if (paramsOnly) {
if (refGCM.getSBMLDocument().getModel().getSpecies(promoter.getId()).getInitialAmount() !=
model.getParameter(GlobalConstants.PROMOTER_COUNT_STRING).getValue()) {
defaultValue = ""+refGCM.getSBMLDocument().getModel().getSpecies(promoter.getId()).getInitialAmount();
origString = "custom";
}
formatString = Utility.SWEEPstring;
}
field = new PropertyField(GlobalConstants.PROMOTER_COUNT_STRING,
bioModel.getParameter(GlobalConstants.PROMOTER_COUNT_STRING), origString,
defaultValue, formatString, paramsOnly, origString, false);
String sweep = AnnotationUtility.parseSweepAnnotation(promoter);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (!defaultValue.equals(""+promoter.getInitialAmount())) {
field.setValue(""+promoter.getInitialAmount());
field.setCustom();
}
fields.put(GlobalConstants.PROMOTER_COUNT_STRING, field);
add(field);
// RNAP binding
origString = "default";
defaultValue = bioModel.getParameter(GlobalConstants.FORWARD_RNAP_BINDING_STRING) + "/" +
bioModel.getParameter(GlobalConstants.REVERSE_RNAP_BINDING_STRING);
formatString = Utility.SLASHstring;
if (paramsOnly) {
/*
defaultValue = refGCM.getParameter(GlobalConstants.FORWARD_RNAP_BINDING_STRING)+"/"+
refGCM.getParameter(GlobalConstants.REVERSE_RNAP_BINDING_STRING); */
if (production != null) {
Reaction refProd = refGCM.getSBMLDocument().getModel().getReaction(production.getId());
LocalParameter ko_f = refProd.getKineticLaw().getLocalParameter(GlobalConstants.FORWARD_RNAP_BINDING_STRING);
LocalParameter ko_r = refProd.getKineticLaw().getLocalParameter(GlobalConstants.REVERSE_RNAP_BINDING_STRING);
if (ko_f != null && ko_r != null) {
defaultValue = ko_f.getValue()+"/"+ko_r.getValue();
origString = "custom";
}
}
formatString = Utility.SLASHSWEEPstring;
}
field = new PropertyField(GlobalConstants.RNAP_BINDING_STRING, defaultValue, origString, defaultValue, formatString, paramsOnly,
origString, false);
if (production != null) {
LocalParameter ko_f = production.getKineticLaw().getLocalParameter(GlobalConstants.FORWARD_RNAP_BINDING_STRING);
LocalParameter ko_r = production.getKineticLaw().getLocalParameter(GlobalConstants.REVERSE_RNAP_BINDING_STRING);
sweep = AnnotationUtility.parseSweepAnnotation(ko_f);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (ko_f != null && ko_r != null && !defaultValue.equals(ko_f.getValue()+"/"+ko_r.getValue())) {
field.setValue(ko_f.getValue()+"/"+ko_r.getValue());
field.setCustom();
}
}
fields.put(GlobalConstants.RNAP_BINDING_STRING, field);
add(field);
// Activated RNAP binding
origString = "default";
defaultValue = bioModel.getParameter(GlobalConstants.FORWARD_ACTIVATED_RNAP_BINDING_STRING) + "/" +
bioModel.getParameter(GlobalConstants.REVERSE_ACTIVATED_RNAP_BINDING_STRING);
formatString = Utility.SLASHstring;
if (paramsOnly) {
/*
defaultValue = refGCM.getParameter(GlobalConstants.FORWARD_ACTIVATED_RNAP_BINDING_STRING) + "/" +
refGCM.getParameter(GlobalConstants.REVERSE_ACTIVATED_RNAP_BINDING_STRING); */
if (production != null) {
Reaction refProd = refGCM.getSBMLDocument().getModel().getReaction(production.getId());
LocalParameter kao_f = refProd.getKineticLaw().getLocalParameter(GlobalConstants.FORWARD_ACTIVATED_RNAP_BINDING_STRING);
LocalParameter kao_r = refProd.getKineticLaw().getLocalParameter(GlobalConstants.REVERSE_ACTIVATED_RNAP_BINDING_STRING);
if (kao_f != null && kao_r != null) {
defaultValue = kao_f.getValue()+"/"+kao_r.getValue();
origString = "custom";
}
}
formatString = Utility.SLASHSWEEPstring;
}
field = new PropertyField(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING, defaultValue, origString, defaultValue,
formatString, paramsOnly, origString, false);
if (production != null) {
LocalParameter kao_f = production.getKineticLaw().getLocalParameter(GlobalConstants.FORWARD_ACTIVATED_RNAP_BINDING_STRING);
LocalParameter kao_r = production.getKineticLaw().getLocalParameter(GlobalConstants.REVERSE_ACTIVATED_RNAP_BINDING_STRING);
sweep = AnnotationUtility.parseSweepAnnotation(kao_f);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (kao_f != null && kao_r != null && !defaultValue.equals(kao_f.getValue()+"/"+kao_r.getValue())) {
field.setValue(kao_f.getValue()+"/"+kao_r.getValue());
field.setCustom();
}
}
fields.put(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING, field);
add(field);
// kocr
origString = "default";
defaultValue = bioModel.getParameter(GlobalConstants.OCR_STRING);
formatString = Utility.NUMstring;
if (paramsOnly) {
//defaultValue = refGCM.getParameter(GlobalConstants.OCR_STRING);
if (production != null) {
Reaction refProd = refGCM.getSBMLDocument().getModel().getReaction(production.getId());
LocalParameter ko = refProd.getKineticLaw().getLocalParameter(GlobalConstants.OCR_STRING);
if (ko != null) {
defaultValue = ko.getValue()+"";
origString = "custom";
}
}
formatString = Utility.SWEEPstring;
}
field = new PropertyField(GlobalConstants.OCR_STRING, bioModel.getParameter(GlobalConstants.OCR_STRING),
origString, defaultValue, formatString, paramsOnly, origString, false);
if (production != null) {
LocalParameter ko = production.getKineticLaw().getLocalParameter(GlobalConstants.OCR_STRING);
sweep = AnnotationUtility.parseSweepAnnotation(ko);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (ko != null && !defaultValue.equals(ko.getValue()+"")) {
field.setValue(ko.getValue()+"");
field.setCustom();
}
}
fields.put(GlobalConstants.OCR_STRING, field);
add(field);
// kbasal
origString = "default";
defaultValue = bioModel.getParameter(GlobalConstants.KBASAL_STRING);
formatString = Utility.NUMstring;
if (paramsOnly) {
if (production != null) {
Reaction refProd = refGCM.getSBMLDocument().getModel().getReaction(production.getId());
LocalParameter kb = refProd.getKineticLaw().getLocalParameter(GlobalConstants.KBASAL_STRING);
if (kb != null) {
defaultValue = kb.getValue()+"";
origString = "custom";
}
}
formatString = Utility.SWEEPstring;
}
field = new PropertyField(GlobalConstants.KBASAL_STRING, bioModel.getParameter(GlobalConstants.KBASAL_STRING),
origString, defaultValue, Utility.SWEEPstring, paramsOnly, origString, false);
if (production != null) {
LocalParameter kb = production.getKineticLaw().getLocalParameter(GlobalConstants.KBASAL_STRING);
sweep = AnnotationUtility.parseSweepAnnotation(kb);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (kb != null && !defaultValue.equals(kb.getValue()+"")) {
field.setValue(kb.getValue()+"");
field.setCustom();
}
}
fields.put(GlobalConstants.KBASAL_STRING, field);
add(field);
// kactived production
origString = "default";
defaultValue = bioModel.getParameter(GlobalConstants.ACTIVATED_STRING);
formatString = Utility.NUMstring;
if (paramsOnly) {
if (production != null) {
Reaction refProd = refGCM.getSBMLDocument().getModel().getReaction(production.getId());
LocalParameter ka = refProd.getKineticLaw().getLocalParameter(GlobalConstants.ACTIVATED_STRING);
if (ka != null) {
defaultValue = ka.getValue()+"";
origString = "custom";
}
}
formatString = Utility.SWEEPstring;
}
field = new PropertyField(GlobalConstants.ACTIVATED_STRING, bioModel.getParameter(GlobalConstants.ACTIVATED_STRING),
origString, defaultValue, formatString, paramsOnly, origString, false);
if (production != null) {
LocalParameter ka = production.getKineticLaw().getLocalParameter(GlobalConstants.ACTIVATED_STRING);
sweep = AnnotationUtility.parseSweepAnnotation(ka);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (ka != null && !defaultValue.equals(ka.getValue()+"")) {
field.setValue(ka.getValue()+"");
field.setCustom();
}
}
fields.put(GlobalConstants.ACTIVATED_STRING, field);
add(field);
// stoichiometry
origString = "default";
defaultValue = bioModel.getParameter(GlobalConstants.STOICHIOMETRY_STRING);
formatString = Utility.NUMstring;
if (paramsOnly) {
if (production != null) {
Reaction refProd = refGCM.getSBMLDocument().getModel().getReaction(production.getId());
LocalParameter np = refProd.getKineticLaw().getLocalParameter(GlobalConstants.STOICHIOMETRY_STRING);
if (np != null) {
defaultValue = np.getValue()+"";
origString = "custom";
}
}
formatString = Utility.SWEEPstring;
}
field = new PropertyField(GlobalConstants.STOICHIOMETRY_STRING, bioModel.getParameter(GlobalConstants.STOICHIOMETRY_STRING),
origString, defaultValue, formatString, paramsOnly, origString, false);
if (production != null) {
LocalParameter np = production.getKineticLaw().getLocalParameter(GlobalConstants.STOICHIOMETRY_STRING);
sweep = AnnotationUtility.parseSweepAnnotation(np);
if (sweep != null) {
field.setValue(sweep);
field.setCustom();
} else if (np != null && !defaultValue.equals(np.getValue()+"")) {
field.setValue(np.getValue()+"");
field.setCustom();
}
}
fields.put(GlobalConstants.STOICHIOMETRY_STRING, field);
add(field);
// Parse out SBOL annotations and add to SBOL field
if (!paramsOnly) {
// Field for annotating promoter with SBOL DNA components
List<URI> sbolURIs = new LinkedList<URI>();
String sbolStrand = AnnotationUtility.parseSBOLAnnotation(production, sbolURIs);
if (sbolURIs.size()>0 && sbolField.getSBOLObjSBOTerm().equals(GlobalConstants.SBO_DNA_SEGMENT))
{
SBOLAnnotation sbolAnnot = new SBOLAnnotation(selected, sbolURIs, sbolStrand);
sbolAnnot.createSBOLElementsDescription(GlobalConstants.SBOL_COMPONENTDEFINITION,
sbolField.getSBOLURIs().iterator().next());
if(!AnnotationUtility.setSBOLAnnotation(promoter, sbolAnnot))
{
JOptionPane.showMessageDialog(Gui.frame,
"Invalid XML in SBML file",
"Error occurred while annotating SBML element " + SBMLutilities.getId(promoter) + " with SBOL.",
JOptionPane.ERROR_MESSAGE);
}
else
{
AnnotationUtility.removeSBOLAnnotation(production);
}
}
else
{
sbolStrand = AnnotationUtility.parseSBOLAnnotation(promoter, sbolURIs);
}
sbolField = new SBOLField2(sbolURIs, sbolStrand, GlobalConstants.SBOL_COMPONENTDEFINITION, modelEditor,
3, false);
add(sbolField);
}
String oldName = null;
oldName = selected;
boolean display = false;
while (!display) {
display = openGui(oldName);
}
}
private boolean checkValues() {
for (PropertyField f : fields.values()) {
if (!f.isValidValue()) {
return false;
}
}
return true;
}
private boolean openGui(String oldName) {
int value = JOptionPane.showOptionDialog(Gui.frame, this,
"Promoter Editor", JOptionPane.YES_NO_OPTION,
JOptionPane.PLAIN_MESSAGE, null, options, options[0]);
if (value == JOptionPane.YES_OPTION) {
boolean valueCheck = checkValues();
if (!valueCheck) {
JOptionPane.showMessageDialog(Gui.frame, "Illegal values entered.", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
String[] idDims = new String[]{""};
String[] dimensionIds = new String[]{""};
String[] dex = new String[]{""};
idDims = Utils.checkSizeParameters(bioModel.getSBMLDocument(),
fields.get(GlobalConstants.ID).getValue(), false);
if(idDims==null)return false;
dimensionIds = SBMLutilities.getDimensionIds("",idDims.length-1);
String id = selected;
if (!paramsOnly) {
if (oldName == null) {
if (bioModel.isSIdInUse(idDims[0])) {
JOptionPane.showMessageDialog(Gui.frame, "Id already exists.", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
}
else if (!oldName.equals(idDims[0])) {
if (bioModel.isSIdInUse(idDims[0])) {
JOptionPane.showMessageDialog(Gui.frame, "Id already exists.", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
}
id = idDims[0];
promoter.setName(fields.get(GlobalConstants.NAME).getValue());
SBMLutilities.createDimensions(promoter, dimensionIds, idDims);
SBase variable = SBMLutilities.getElementBySId(bioModel.getSBMLDocument(), (String)compartBox.getSelectedItem());
dex = Utils.checkIndices(iIndex.getText(), variable, bioModel.getSBMLDocument(), dimensionIds, "compartment", idDims, null, null);
if(dex==null)return false;
SBMLutilities.addIndices(promoter, "compartment", dex, 1);
SBMLutilities.addIndices(production, "compartment", dex, 1);
}
promoter.setCompartment((String)compartBox.getSelectedItem());
production.setCompartment((String)compartBox.getSelectedItem());
String speciesType = typeBox.getSelectedItem().toString();
boolean onPort = (speciesType.equals(GlobalConstants.INPUT)||speciesType.equals(GlobalConstants.OUTPUT));
promoter.setSBOTerm(GlobalConstants.SBO_PROMOTER_BINDING_REGION);
PropertyField f = fields.get(GlobalConstants.PROMOTER_COUNT_STRING);
if (f.getValue().startsWith("(")) {
promoter.setInitialAmount(1.0);
if(!AnnotationUtility.setSweepAnnotation(promoter, f.getValue()))
{
JOptionPane.showMessageDialog(Gui.frame, "Invalid XML Operation", "Error occurred while annotating SBML element "
+ SBMLutilities.getId(promoter), JOptionPane.ERROR_MESSAGE);
}
} else {
promoter.setInitialAmount(Double.parseDouble(f.getValue()));
}
String kaStr = null;
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.STOICHIOMETRY_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.OCR_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.KBASAL_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.ACTIVATED_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.FORWARD_RNAP_BINDING_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.REVERSE_RNAP_BINDING_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.FORWARD_ACTIVATED_RNAP_BINDING_STRING);
production.getKineticLaw().getListOfLocalParameters().remove(GlobalConstants.REVERSE_ACTIVATED_RNAP_BINDING_STRING);
f = fields.get(GlobalConstants.ACTIVATED_STRING);
if (f.getState() == null || f.getState().equals(f.getStates()[1])) {
kaStr = f.getValue();
}
String npStr = null;
f = fields.get(GlobalConstants.STOICHIOMETRY_STRING);
if (f.getState() == null || f.getState().equals(f.getStates()[1])) {
npStr = f.getValue();
}
String koStr = null;
f = fields.get(GlobalConstants.OCR_STRING);
if (f.getState() == null || f.getState().equals(f.getStates()[1])) {
koStr = f.getValue();
}
String kbStr = null;
f = fields.get(GlobalConstants.KBASAL_STRING);
if (f.getState() == null || f.getState().equals(f.getStates()[1])) {
kbStr = f.getValue();
}
String KoStr = null;
f = fields.get(GlobalConstants.RNAP_BINDING_STRING);
if (f.getState() == null || f.getState().equals(f.getStates()[1])) {
KoStr = f.getValue();
}
String KaoStr = null;
f = fields.get(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING);
if (f.getState() == null || f.getState().equals(f.getStates()[1])) {
KaoStr = f.getValue();
}
bioModel.createProductionReaction(selected,kaStr,npStr,koStr,kbStr,KoStr,KaoStr,onPort,idDims);
if (!paramsOnly) {
// rename all the influences that use this promoter if name was changed
if (selected != null && oldName != null && !oldName.equals(id)) {
try {
bioModel.changePromoterId(oldName, id);
} catch (BioSimException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getTitle(), e.getMessage(),
JOptionPane.ERROR_MESSAGE);
}
this.secondToLastUsedPromoter = oldName;
promoterNameChange = true;
}
// Add SBOL annotation to promoter
if (sbolField.getSBOLURIs().size() > 0)
{
if(sbolField.isSBOLSBOSet() && !sbolField.getSBOLObjSBOTerm().equals(GlobalConstants.SBO_DNA_SEGMENT))
{
JOptionPane.showMessageDialog(Gui.frame,
"You are not allowed to annotate a promoter that does not have SBOL component type DNA.",
"Prohibited SBOL Annotation Type",
JOptionPane.WARNING_MESSAGE);
}
else
{
if (!production.isSetMetaId() || production.getMetaId().equals(""))
SBMLutilities.setDefaultMetaID(bioModel.getSBMLDocument(), production,
bioModel.getMetaIDIndex());
//try
//{
// TODO: removed this since changing id based on SBOL field could cause name conflicts
//bioModel.changePromoterId(id, SBMLutilities.getUniqueSBMLId(sbolField.getSBOLObjID(), bioModel));
setSBOLAnnotation(promoter);
//}
//catch (BioSimException e)
//{
// JOptionPane.showMessageDialog(Gui.frame, e.getTitle(), e.getMessage(),
// JOptionPane.ERROR_MESSAGE);
//}
}
} else
AnnotationUtility.removeSBOLAnnotation(promoter);
bioModel.createDirPort(promoter.getId(),speciesType);
this.lastUsedPromoter = id;
}
speciesList.removeItem(selected);
speciesList.removeItem(selected + " Modified");
speciesList.addItem(id);
speciesList.setSelectedValue(id, true);
modelEditor.refresh();
modelEditor.setDirty(true);
} else if (value == JOptionPane.NO_OPTION) {
return true;
}
return true;
}
/**
* Perform annotation on the SBML element with the SBOL object that was selected from SBOL association.
* @param sbmlElement - The SBML element to set the SBOL annotation on.
*/
private void setSBOLAnnotation(SBase sbmlElement)
{
SBOLAnnotation sbolAnnot = new SBOLAnnotation(sbmlElement.getMetaId(),
sbolField.getSBOLURIs(), sbolField.getSBOLStrand());
sbolAnnot.createSBOLElementsDescription(GlobalConstants.SBOL_COMPONENTDEFINITION,
sbolField.getSBOLURIs().iterator().next());
if(!AnnotationUtility.setSBOLAnnotation(sbmlElement, sbolAnnot))
{
JOptionPane.showMessageDialog(Gui.frame,
"Error occurred while annotating SBML element " + sbmlElement.getId() + " with SBOL.",
"Invalid XML in SBML file",
JOptionPane.ERROR_MESSAGE);
}
if(sbolField.isSBOLNameSet())
{
sbmlElement.setName(sbolField.getSBOLObjName());
}
if(sbolField.isSBOLSBOSet())
{
sbmlElement.setSBOTerm(sbolField.getSBOLObjSBOTerm());
}
}
public String updates() {
String updates = "";
if (paramsOnly) {
if (fields.get(GlobalConstants.PROMOTER_COUNT_STRING).getState().equals(fields.get(GlobalConstants.PROMOTER_COUNT_STRING).getStates()[1])) {
updates += selected + "/" + GlobalConstants.PROMOTER_COUNT_STRING + " "
+ fields.get(GlobalConstants.PROMOTER_COUNT_STRING).getValue();
}
if (fields.get(GlobalConstants.RNAP_BINDING_STRING).getState()
.equals(fields.get(GlobalConstants.RNAP_BINDING_STRING).getStates()[1])) {
if (!updates.equals("")) {
updates += "\n";
}
updates += selected + "/" + GlobalConstants.RNAP_BINDING_STRING + " "
+ fields.get(GlobalConstants.RNAP_BINDING_STRING).getValue();
}
if (fields.get(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING).getState()
.equals(fields.get(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING).getStates()[1])) {
if (!updates.equals("")) {
updates += "\n";
}
updates += selected + "/" + GlobalConstants.ACTIVATED_RNAP_BINDING_STRING + " "
+ fields.get(GlobalConstants.ACTIVATED_RNAP_BINDING_STRING).getValue();
}
if (fields.get(GlobalConstants.OCR_STRING).getState().equals(fields.get(GlobalConstants.OCR_STRING).getStates()[1])) {
if (!updates.equals("")) {
updates += "\n";
}
updates += selected + "/" + GlobalConstants.OCR_STRING + " "
+ fields.get(GlobalConstants.OCR_STRING).getValue();
}
if (fields.get(GlobalConstants.STOICHIOMETRY_STRING).getState().equals(fields.get(GlobalConstants.STOICHIOMETRY_STRING).getStates()[1])) {
if (!updates.equals("")) {
updates += "\n";
}
updates += selected + "/" + GlobalConstants.STOICHIOMETRY_STRING + " "
+ fields.get(GlobalConstants.STOICHIOMETRY_STRING).getValue();
}
if (fields.get(GlobalConstants.KBASAL_STRING).getState().equals(fields.get(GlobalConstants.KBASAL_STRING).getStates()[1])) {
if (!updates.equals("")) {
updates += "\n";
}
updates += selected + "/" + GlobalConstants.KBASAL_STRING + " "
+ fields.get(GlobalConstants.KBASAL_STRING).getValue();
}
if (fields.get(GlobalConstants.ACTIVATED_STRING).getState().equals(fields.get(GlobalConstants.ACTIVATED_STRING).getStates()[1])) {
if (!updates.equals("")) {
updates += "\n";
}
updates += selected + "/" + GlobalConstants.ACTIVATED_STRING + " "
+ fields.get(GlobalConstants.ACTIVATED_STRING).getValue();
}
if (updates.equals("")) {
updates += selected + "/";
}
}
return updates;
}
// Provide a public way to query what the last used (or created) promoter was.
private String lastUsedPromoter;
public String getLastUsedPromoter(){return lastUsedPromoter;}
private String secondToLastUsedPromoter;
public String getSecondToLastUsedPromoter(){return secondToLastUsedPromoter;}
private boolean promoterNameChange = false;
public boolean wasPromoterNameChanged(){return promoterNameChange;}
private static final String[] types = new String[] { GlobalConstants.INPUT, GlobalConstants.INTERNAL,
GlobalConstants.OUTPUT};
private JComboBox typeBox = null;
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == compartBox){
if (bioModel.isArray((String)compartBox.getSelectedItem())) {
iIndex.setEnabled(true);
} else {
iIndex.setText("");
iIndex.setEnabled(false);
}
}
}
}
|
package org.basex.query.value.item;
import static org.basex.data.DataText.*;
import org.basex.query.expr.*;
import org.basex.query.value.type.*;
import org.basex.util.*;
import org.basex.util.list.*;
/**
* String item ({@code xs:string}, {@code xs:normalizedString}, {@code xs:language},
* etc.).
*
* @author BaseX Team 2005-12, BSD License
* @author Christian Gruen
*/
public class Str extends AStr {
/** Zero-length string. */
public static final Str ZERO = new Str(Token.EMPTY);
/** String data. */
final byte[] val;
/**
* Constructor.
* @param v value
*/
private Str(final byte[] v) {
this(v, AtomType.STR);
}
/**
* Constructor.
* @param v value
* @param t data type
*/
public Str(final byte[] v, final AtomType t) {
super(t);
val = v;
}
/**
* Returns an instance of this class.
* @param v value
* @return instance
*/
public static Str get(final byte[] v) {
return v.length == 0 ? ZERO : new Str(v);
}
/**
* Returns an instance of this class.
* @param v object (will be converted to token)
* @return instance
*/
public static Str get(final Object v) {
return get(Token.token(v.toString()));
}
@Override
public final byte[] string(final InputInfo ii) {
return val;
}
/**
* Returns the string value.
* @return string value
*/
public final byte[] string() {
return val;
}
@Override
public final boolean sameAs(final Expr cmp) {
if(!(cmp instanceof Str)) return false;
final Str i = (Str) cmp;
return type == i.type && Token.eq(val, i.val);
}
@Override
public final String toJava() {
return Token.string(val);
}
@Override
public final String toString() {
final ByteList tb = new ByteList();
tb.add('"');
for(final byte v : val) {
if(v == '&') tb.add(E_AMP);
else tb.add(v);
if(v == '"') tb.add(v);
}
return tb.add('"').toString();
}
}
|
package senntyou.sbs.mbg.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class AdminRolePermissionRelation implements Serializable {
private Long id;
private Long roleId;
private Long permissionId;
/**
* 创建时间
*
* @mbg.generated
*/
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新时间
*
* @mbg.generated
*/
@ApiModelProperty(value = "更新时间")
private Date updateTime;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getPermissionId() {
return permissionId;
}
public void setPermissionId(Long permissionId) {
this.permissionId = permissionId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", roleId=").append(roleId);
sb.append(", permissionId=").append(permissionId);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
|
package top.jfunc.http.component;
import top.jfunc.http.request.HttpRequest;
import java.io.IOException;
/**
* 封装真正执行的一步
* @see RequestExecutor
* @author xiongshiyan at 2020/1/6 , contact me with email yanshixiong@126.com or phone 15208384257
*/
@Deprecated
public interface RequestSender<Request , Response> {
/**
* Request发起请求,得到响应Response
* @param request Request
* @param httpRequest HttpRequest
* @return Response
* @throws IOException IOException
*/
Response send(Request request , HttpRequest httpRequest) throws IOException;
}
|
package org.gradle.fairy.tale.formula;
import org.gradle.actors.Actor;
import org.gradle.actors.Group;
import org.gradle.fairy.tale.Tale;
import org.gradle.fairy.tale.formula.events.Event;
import org.gradle.fairy.tale.formula.events.IntransativeEvent;
import org.gradle.fairy.tale.formula.events.TransitiveEvent;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Represents a fairy tale.
*/
public class FairyTale implements Tale {
private final List<Actor> actors;
private final List<Event> events;
private FairyTale(List<Actor> actors, List<Event> events) {
this.actors = actors;
this.events = events;
}
@Override
public void tell() {
StringBuilder builder = new StringBuilder("Once upon a time, there lived ");
for (int i=0; i < actors.size(); i++) {
if (i == actors.size() - 1 && i != 0) {
builder.append("and ");
}
builder.append(actors.get(i));
if (i != actors.size() - 1 && actors.size() > 1) {
builder.append(", ");
}
}
builder.append(".").append(System.getProperty("line.separator"));
for (Event event : events) {
builder.append(event).append(System.getProperty("line.separator"));
}
builder.append("And they all lived happily ever after.")
.append(System.getProperty("line.separator"))
.append(System.getProperty("line.separator"));
System.out.print(builder.toString());
}
public static Weaver getWeaver() {
return new Weaver(new HashSet<>(), new HashSet<>(), new ArrayList<>());
}
public static class Weaver {
private final Set<Actor> actorSet;
private final Set<Actor> groupActors;
private final List<Event> events;
private Weaver(Set<Actor> actorSet, Set<Actor> groupActors, List<Event> events) {
this.actorSet = actorSet;
this.groupActors = groupActors;
this.events = events;
}
public Tale weave() {
List<Actor> actors = new ArrayList<>();
actors.addAll(actorSet);
return new FairyTale(actors, events);
}
public Weaver record(Actor actor, String action) {
addActorOrGroup(actor);
events.add(new IntransativeEvent(actor, action));
return this;
}
public Weaver record(Actor actor, String action, Actor object) {
addActorOrGroup(actor);
addActorOrGroup(object);
events.add(new TransitiveEvent(actor, action, object));
return this;
}
private void addActorOrGroup(Actor actor) {
if (actor instanceof Group) {
for(Actor a : (Group) actor) {
actorSet.remove(a);
groupActors.add(a);
}
}
if (!groupActors.contains(actor)) {
actorSet.add(actor);
}
}
}
}
|
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.directconnect.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.directconnect.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DirectConnectGatewayAttachment JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DirectConnectGatewayAttachmentJsonUnmarshaller implements Unmarshaller<DirectConnectGatewayAttachment, JsonUnmarshallerContext> {
public DirectConnectGatewayAttachment unmarshall(JsonUnmarshallerContext context) throws Exception {
DirectConnectGatewayAttachment directConnectGatewayAttachment = new DirectConnectGatewayAttachment();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("directConnectGatewayId", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setDirectConnectGatewayId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("virtualInterfaceId", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setVirtualInterfaceId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("virtualInterfaceRegion", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setVirtualInterfaceRegion(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("virtualInterfaceOwnerAccount", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setVirtualInterfaceOwnerAccount(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("attachmentState", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setAttachmentState(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("attachmentType", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setAttachmentType(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("stateChangeError", targetDepth)) {
context.nextToken();
directConnectGatewayAttachment.setStateChangeError(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return directConnectGatewayAttachment;
}
private static DirectConnectGatewayAttachmentJsonUnmarshaller instance;
public static DirectConnectGatewayAttachmentJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DirectConnectGatewayAttachmentJsonUnmarshaller();
return instance;
}
}
|
// Template Source: IBaseEntityReferenceRequestBuilder.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.extensions;
import com.microsoft.graph.http.IRequestBuilder;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.models.extensions.AndroidForWorkTrustedRootCertificate;
import java.util.Arrays;
import java.util.EnumSet;
import com.microsoft.graph.models.extensions.AndroidForWorkTrustedRootCertificate;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The interface for the Android For Work Trusted Root Certificate Reference Request Builder.
*/
public interface IAndroidForWorkTrustedRootCertificateReferenceRequestBuilder extends IRequestBuilder {
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IAndroidForWorkTrustedRootCertificateReferenceRequest instance
*/
IAndroidForWorkTrustedRootCertificateReferenceRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions);
/**
* Creates the request with specific options instead of the existing options
*
* @param requestOptions the options for this request
* @return the IAndroidForWorkTrustedRootCertificateReferenceRequest instance
*/
IAndroidForWorkTrustedRootCertificateReferenceRequest buildRequest(final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions);
}
|
/**************************************************************
*
* 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 storagetesting;
public interface StorageTest
{
boolean test();
}
|
/*
* MIT License
*
* Copyright (c) 2018 octopusdownloader
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.octopus.dialogs.newdownload;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.stage.Stage;
import org.octopus.alerts.CommonAlerts;
import org.octopus.downloads.DownloadInfo;
public class AddNewDownloadDialog extends Dialog<DownloadInfo> {
private ButtonType downloadButtonType;
private AddNewDownloadController controller;
public AddNewDownloadDialog() {
setTitle("Add new download");
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/scenes/dialogs/new-download-dialog.fxml"));
Parent root = loader.load();
controller = loader.getController();
controller.setRoot((Stage) getDialogPane().getScene().getWindow());
downloadButtonType = new ButtonType("Download", ButtonBar.ButtonData.OK_DONE);
ButtonType cancelButtonType = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
getDialogPane().getButtonTypes().addAll(downloadButtonType, cancelButtonType);
getDialogPane().setContent(root);
} catch (Exception e) {
Alert alert = CommonAlerts.StackTraceAlert("Error", "Something went wrong", e.getMessage(), e);
alert.showAndWait();
System.exit(1);
}
// TODO validation
setResultConverter(buttonType -> {
if (buttonType == downloadButtonType) {
return new DownloadInfo(controller.getAddress(), controller.getBaseDirectory(), controller.getName());
}
return null;
});
}
}
|
/*
* 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.hive.ql.exec.vector.expressions;
import java.util.Arrays;
import org.apache.hadoop.hive.ql.exec.vector.ColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
import org.apache.hadoop.hive.ql.metadata.HiveException;
/**
* This expression evaluates to true if the given input columns is null.
* The boolean output is stored in the specified output column.
*/
public class IsNull extends VectorExpression {
private static final long serialVersionUID = 1L;
private final int colNum;
public IsNull(int colNum, int outputColumnNum) {
super(outputColumnNum);
this.colNum = colNum;
}
public IsNull() {
super();
// Dummy final assignments.
colNum = -1;
}
@Override
public void evaluate(VectorizedRowBatch batch) throws HiveException {
if (childExpressions != null) {
super.evaluateChildren(batch);
}
ColumnVector inputColVector = batch.cols[colNum];
int[] sel = batch.selected;
boolean[] inputIsNull = inputColVector.isNull;
int n = batch.size;
LongColumnVector outputColVector = (LongColumnVector) batch.cols[outputColumnNum];
long[] outputVector = outputColVector.vector;
boolean[] outputIsNull = outputColVector.isNull;
if (n <= 0) {
// Nothing to do, this is EOF
return;
}
// We do not need to do a column reset since we are carefully changing the output.
outputColVector.isRepeating = false;
if (inputColVector.noNulls) {
outputColVector.isRepeating = true;
outputIsNull[0] = false;
outputVector[0] = 0;
} else if (inputColVector.isRepeating) {
outputColVector.isRepeating = true;
outputIsNull[0] = false;
outputVector[0] = inputIsNull[0] ? 1 : 0;
} else {
/*
* Since we have a result for all rows, we don't need to do conditional NULL maintenance or
* turn off noNulls..
*/
if (batch.selectedInUse) {
for (int j = 0; j != n; j++) {
int i = sel[j];
outputIsNull[i] = false;
outputVector[i] = inputIsNull[i] ? 1 : 0;
}
} else {
Arrays.fill(outputIsNull, 0, n, false);
for (int i = 0; i != n; i++) {
outputVector[i] = inputIsNull[i] ? 1 : 0;
}
}
}
}
@Override
public String vectorExpressionParameters() {
return getColumnParamString(0, colNum);
}
@Override
public VectorExpressionDescriptor.Descriptor getDescriptor() {
VectorExpressionDescriptor.Builder b = new VectorExpressionDescriptor.Builder();
b.setMode(VectorExpressionDescriptor.Mode.PROJECTION)
.setNumArguments(1)
.setArgumentTypes(
VectorExpressionDescriptor.ArgumentType.ALL_FAMILY)
.setInputExpressionTypes(
VectorExpressionDescriptor.InputExpressionType.COLUMN);
return b.build();
}
}
|
package ink.cashflow.abstractfactory.abztract;
public abstract class AbstractWhiteHuman implements Human {
@Override
public void cry() {
System.out.println("白色人种会哭");
}
@Override
public void laugh() {
System.out.println("白色人种会大笑,侵略的笑声");
}
@Override
public void talk() {
System.out.println("白色人种会说话,一般都是但是单字节!");
}
}
|
/*
* Copyright (c) 2020, 2021 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Amadeus - initial API and implementation
*
*/
package org.eclipse.dataspaceconnector.iam.daps;
import org.eclipse.dataspaceconnector.common.annotations.IntegrationTest;
import org.eclipse.dataspaceconnector.core.security.fs.FsCertificateResolver;
import org.eclipse.dataspaceconnector.core.security.fs.FsPrivateKeyResolver;
import org.eclipse.dataspaceconnector.junit.launcher.EdcExtension;
import org.eclipse.dataspaceconnector.junit.launcher.MockVault;
import org.eclipse.dataspaceconnector.spi.EdcException;
import org.eclipse.dataspaceconnector.spi.iam.IdentityService;
import org.eclipse.dataspaceconnector.spi.security.CertificateResolver;
import org.eclipse.dataspaceconnector.spi.security.PrivateKeyResolver;
import org.eclipse.dataspaceconnector.spi.security.Vault;
import org.eclipse.dataspaceconnector.spi.system.ConfigurationExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import java.io.FileInputStream;
import java.security.KeyStore;
import java.util.Map;
import java.util.Objects;
import static org.assertj.core.api.Assertions.assertThat;
@IntegrationTest
@ExtendWith(EdcExtension.class)
class DapsIntegrationTest {
private static final String AUDIENCE_IDS_CONNECTORS_ALL = "idsc:IDS_CONNECTORS_ALL";
private static final String CLIENT_ID = "68:99:2E:D4:13:2D:FD:3A:66:6B:85:DE:FB:98:2E:2D:FD:E7:83:D7";
private static final String CLIENT_KEYSTORE_KEY_ALIAS = "1";
private static final String CLIENT_KEYSTORE_PASSWORD = "1234";
private static final String DAPS_URL = "http://localhost:4567";
private final Map<String, String> configuration = Map.of(
"edc.oauth.token.url", DAPS_URL + "/token",
"edc.oauth.client.id", CLIENT_ID,
"edc.oauth.provider.audience", AUDIENCE_IDS_CONNECTORS_ALL,
"edc.oauth.provider.jwks.url", DAPS_URL + "/.well-known/jwks.json",
"edc.oauth.public.key.alias", CLIENT_KEYSTORE_KEY_ALIAS,
"edc.oauth.private.key.alias", CLIENT_KEYSTORE_KEY_ALIAS
);
private static KeyStore readKeystoreFromResources(String fileName, String type, String password) {
var url = Thread.currentThread().getContextClassLoader().getResource(fileName);
Objects.requireNonNull(url);
try {
var ks = KeyStore.getInstance(type);
var fis = new FileInputStream(url.getFile());
ks.load(fis, password.toCharArray());
return ks;
} catch (Exception e) {
throw new EdcException("Failed to load keystore: " + e);
}
}
@Test
void retrieveTokenAndValidate(IdentityService identityService) {
var tokenResult = identityService.obtainClientCredentials("idsc:IDS_CONNECTOR_ATTRIBUTES_ALL");
assertThat(tokenResult.succeeded()).isTrue();
var verificationResult = identityService.verifyJwtToken(tokenResult.getContent().getToken(), AUDIENCE_IDS_CONNECTORS_ALL);
assertThat(verificationResult.succeeded()).isTrue();
}
@BeforeEach
protected void before(EdcExtension extension) {
KeyStore clientKeystore = readKeystoreFromResources("keystore.p12", "PKCS12", CLIENT_KEYSTORE_PASSWORD);
extension.registerSystemExtension(ConfigurationExtension.class, (ConfigurationExtension) configuration::get);
extension.registerServiceMock(Vault.class, new MockVault());
extension.registerServiceMock(PrivateKeyResolver.class, new FsPrivateKeyResolver(CLIENT_KEYSTORE_PASSWORD, clientKeystore));
extension.registerServiceMock(CertificateResolver.class, new FsCertificateResolver(clientKeystore));
}
}
|
package pl.allegro.tech.hermes.integration.auth;
import avro.shaded.com.google.common.collect.Lists;
import com.google.common.io.Files;
import io.undertow.security.impl.BasicAuthenticationMechanism;
import io.undertow.util.StatusCodes;
import org.assertj.core.description.Description;
import org.assertj.core.description.TextDescription;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import pl.allegro.tech.hermes.api.Topic;
import pl.allegro.tech.hermes.common.config.ConfigFactory;
import pl.allegro.tech.hermes.common.config.Configs;
import pl.allegro.tech.hermes.frontend.HermesFrontend;
import pl.allegro.tech.hermes.frontend.server.auth.AuthenticationConfiguration;
import pl.allegro.tech.hermes.integration.IntegrationTest;
import pl.allegro.tech.hermes.test.helper.builder.TopicBuilder;
import pl.allegro.tech.hermes.test.helper.config.MutableConfigFactory;
import pl.allegro.tech.hermes.test.helper.endpoint.HermesPublisher;
import pl.allegro.tech.hermes.test.helper.message.TestMessage;
import pl.allegro.tech.hermes.test.helper.util.Ports;
import javax.ws.rs.core.Response;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import static javax.ws.rs.core.Response.Status.Family.SUCCESSFUL;
import static pl.allegro.tech.hermes.integration.auth.SingleUserAwareIdentityManager.getHeadersWithAuthentication;
import static pl.allegro.tech.hermes.integration.test.HermesAssertions.assertThat;
public class TopicAuthorisationTest extends IntegrationTest {
public static final int FRONTEND_PORT = Ports.nextAvailable();
public static final String FRONTEND_URL = "http://127.0.0.1:" + FRONTEND_PORT;
private static final String USERNAME = "someUser";
private static final String PASSWORD = "somePassword123";
private static final String MESSAGE = TestMessage.of("hello", "world").body();
private static final String USERNAME2 = "foobar";
protected HermesPublisher publisher;
private HermesFrontend hermesFrontend;
@BeforeClass
public void setup() throws Exception {
ConfigFactory configFactory = new MutableConfigFactory()
.overrideProperty(Configs.FRONTEND_PORT, FRONTEND_PORT)
.overrideProperty(Configs.FRONTEND_SSL_ENABLED, false)
.overrideProperty(Configs.FRONTEND_AUTHENTICATION_MODE, "pro_active")
.overrideProperty(Configs.FRONTEND_AUTHENTICATION_ENABLED, true)
.overrideProperty(Configs.MESSAGES_LOCAL_STORAGE_DIRECTORY, Files.createTempDir().getAbsolutePath());
AuthenticationConfiguration authConfig = new AuthenticationConfiguration(
exchange -> false,
Lists.newArrayList(new BasicAuthenticationMechanism("basicAuthRealm")),
new SingleUserAwareIdentityManager(USERNAME, PASSWORD));
hermesFrontend = HermesFrontend.frontend()
.withBinding(configFactory, ConfigFactory.class)
.withAuthenticationConfiguration(authConfig)
.build();
hermesFrontend.start();
publisher = new HermesPublisher(FRONTEND_URL);
operations.buildTopic("someGroup", "topicWithAuthorization");
}
@AfterClass
public void tearDown() throws InterruptedException {
hermesFrontend.stop();
}
@Test
public void shouldPublishWhenAuthenticated() {
// given
List<Topic> topics = Arrays.asList(
TopicBuilder.topic("disabled.authenticated")
.build(),
TopicBuilder.topic("enabled.authenticated_1Publisher")
.withPublisher(USERNAME)
.withAuthEnabled()
.build(),
TopicBuilder.topic("enabled.authenticated_2Publishers")
.withPublisher(USERNAME)
.withPublisher(USERNAME2)
.withAuthEnabled()
.build(),
TopicBuilder.topic("required.authenticated_1Publisher")
.withPublisher(USERNAME)
.withAuthEnabled()
.withUnauthenticatedAccessDisabled()
.build(),
TopicBuilder.topic("required.authenticated_2Publishers")
.withPublisher(USERNAME)
.withPublisher(USERNAME2)
.withAuthEnabled()
.withUnauthenticatedAccessDisabled()
.build()
);
topics.forEach(operations::buildTopic);
Map<String, String> headers = getHeadersWithAuthentication(USERNAME, PASSWORD);
topics.forEach(topic -> {
// when
Response response = publisher.publish(topic.getQualifiedName(), MESSAGE, headers);
// then
assertThat(response.getStatusInfo().getFamily()).as(description(topic)).isEqualTo(SUCCESSFUL);
});
}
@Test
public void shouldPublishAsGuestWhenAuthIsNotRequired() {
// given
List<Topic> topics = Arrays.asList(
TopicBuilder.topic("disabled.guest")
.build(),
TopicBuilder.topic("enabled.guest_0Publishers")
.withAuthEnabled()
.build(),
TopicBuilder.topic("enabled.guest_1Publisher")
.withPublisher(USERNAME2)
.withAuthEnabled()
.build()
);
topics.forEach(operations::buildTopic);
topics.forEach(topic -> {
// when
Response response = publisher.publish(topic.getQualifiedName(), MESSAGE);
// then
assertThat(response.getStatusInfo().getFamily()).as(description(topic)).isEqualTo(SUCCESSFUL);
});
}
@Test
public void shouldNotPublishAsGuestWhenAuthIsRequired() {
// given
List<Topic> topics = Arrays.asList(
TopicBuilder.topic("required.guest_0Publishers")
.withAuthEnabled()
.withUnauthenticatedAccessDisabled()
.build(),
TopicBuilder.topic("required.guest_1Publisher")
.withPublisher(USERNAME2)
.withAuthEnabled()
.withUnauthenticatedAccessDisabled()
.build()
);
topics.forEach(operations::buildTopic);
topics.forEach(topic -> {
// when
Response response = publisher.publish(topic.getQualifiedName(), MESSAGE);
// then
assertThat(response.getStatus()).as(description(topic)).isEqualTo(StatusCodes.FORBIDDEN);
});
}
@Test
public void shouldNotPublishWithoutPermissionWhenAuthenticated() {
// given
List<Topic> topics = Arrays.asList(
TopicBuilder.topic("enabled.authenticated_no_permission_0Publishers")
.withAuthEnabled()
.build(),
TopicBuilder.topic("enabled.authenticated_no_permission_1Publisher")
.withPublisher(USERNAME2)
.withAuthEnabled()
.build(),
TopicBuilder.topic("required.authenticated_no_permission_0Publishers")
.withAuthEnabled()
.withUnauthenticatedAccessDisabled()
.build(),
TopicBuilder.topic("required.authenticated_no_permission_1Publisher")
.withPublisher(USERNAME2)
.withAuthEnabled()
.withUnauthenticatedAccessDisabled()
.build()
);
topics.forEach(operations::buildTopic);
Map<String, String> headers = getHeadersWithAuthentication(USERNAME, PASSWORD);
topics.forEach(topic -> {
// when
Response response = publisher.publish(topic.getQualifiedName(), MESSAGE, headers);
// then
assertThat(response.getStatus()).as(description(topic)).isEqualTo(StatusCodes.FORBIDDEN);
});
}
private Description description(Topic topic) {
return new TextDescription("topic=%s", topic.getQualifiedName());
}
}
|
/*
* Copyright 2013, The Sporting Exchange Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
*/
// Originally from UpdatedComponentTests/StandardValidation/REST/Rest_Post_MissingMandatory_ListOfComplex_JSON.xls;
package com.betfair.cougar.tests.updatedcomponenttests.standardvalidation.rest;
import com.betfair.testing.utils.cougar.misc.XMLHelpers;
import com.betfair.testing.utils.cougar.assertions.AssertionUtils;
import com.betfair.testing.utils.cougar.beans.HttpCallBean;
import com.betfair.testing.utils.cougar.beans.HttpResponseBean;
import com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum;
import com.betfair.testing.utils.cougar.manager.AccessLogRequirement;
import com.betfair.testing.utils.cougar.manager.CougarManager;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
/**
* Ensure that the correct fault is returned when, a Rest(JSON) Post operation is performed against Cougar, passing a List of complex object in the post body, where the complex object contained in the list has a mandatory field missing
*/
public class RestPostMissingMandatoryListOfComplexJSONTest {
@Test
public void doTest() throws Exception {
// Set up the Http Call Bean to make the request
CougarManager cougarManager1 = CougarManager.getInstance();
HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean("87.248.113.14");
cougarManager1 = cougarManager1;
// Turn detailed faults off
cougarManager1.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");
getNewHttpCallBean1.setOperationName("listOfComplexOperation");
getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");
getNewHttpCallBean1.setVersion("v2");
// Set the body param to a list of complex objects where one of the entries is missing mandatory fields
Map map2 = new HashMap();
map2.put("RESTJSON","{\"inputList\": [{\"ComplexObject\":{}}]}");
getNewHttpCallBean1.setPostQueryObjects(map2);
// Get current time for getting log entries later
Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());
// Make REST JSON call to the operation requesting an XML response
cougarManager1.makeRestCougarHTTPCall(getNewHttpCallBean1, com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON, com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);
// Make REST JSON call to the operation requesting a JSON response
cougarManager1.makeRestCougarHTTPCall(getNewHttpCallBean1, com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON, com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.JSON);
// Create the expected response as an XML document (Fault)
XMLHelpers xMLHelpers4 = new XMLHelpers();
Document createAsDocument12 = xMLHelpers4.getXMLObjectFromString("<fault><faultcode>Client</faultcode><faultstring>DSC-0018</faultstring><detail/></fault>");
// Convert the expected response to REST types for comparison with actual responses
Map<CougarMessageProtocolRequestTypeEnum, Object> convertResponseToRestTypes13 = cougarManager1.convertResponseToRestTypes(createAsDocument12, getNewHttpCallBean1);
// Check the 2 responses are as expected (Bad Request)
HttpResponseBean response5 = getNewHttpCallBean1.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTJSONXML);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes13.get(CougarMessageProtocolRequestTypeEnum.RESTXML), response5.getResponseObject());
AssertionUtils.multiAssertEquals((int) 400, response5.getHttpStatusCode());
AssertionUtils.multiAssertEquals("Bad Request", response5.getHttpStatusText());
HttpResponseBean response6 = getNewHttpCallBean1.getResponseObjectsByEnum(com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.RESTJSONJSON);
AssertionUtils.multiAssertEquals(convertResponseToRestTypes13.get(CougarMessageProtocolRequestTypeEnum.RESTJSON), response6.getResponseObject());
AssertionUtils.multiAssertEquals((int) 400, response6.getHttpStatusCode());
AssertionUtils.multiAssertEquals("Bad Request", response6.getHttpStatusText());
// generalHelpers.pauseTest(500L);
// Check the log entries are as expected
cougarManager1.verifyAccessLogEntriesAfterDate(getTimeAsTimeStamp7, new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/listOfComplexOperation", "BadRequest"),new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/listOfComplexOperation", "BadRequest") );
}
}
|
package com.tamsiree.rxkit;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.util.TypedValue;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import com.readystatesoftware.systembartint.SystemBarTintManager;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
* @author tamsiree
* @date 2016/1/24
*/
public class RxBarTool {
/**
* 隐藏状态栏
* <p>也就是设置全屏,一定要在setContentView之前调用,否则报错</p>
* <p>此方法Activity可以继承AppCompatActivity</p>
* <p>启动的时候状态栏会显示一下再隐藏,比如QQ的欢迎界面</p>
* <p>在配置文件中Activity加属性android:theme="@android:style/Theme.NoTitleBar.Fullscreen"</p>
* <p>如加了以上配置Activity不能继承AppCompatActivity,会报错</p>
*
* @param activity activity
*/
public static void hideStatusBar(Activity activity) {
noTitle(activity);
FLAG_FULLSCREEN(activity);
}
/**
* 设置透明状态栏(api大于19方可使用)
* <p>可在Activity的onCreat()中调用</p>
* <p>需在顶部控件布局中加入以下属性让内容出现在状态栏之下</p>
* <p>android:clipToPadding="true"</p>
* <p>android:fitsSystemWindows="true"</p>
*
* @param activity activity
*/
public static void setTransparentStatusBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //透明状态栏
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); //透明导航栏
}
}
/**
* 隐藏Title
* 一定要在setContentView之前调用,否则报错
*
* @param activity
*/
public static void setNoTitle(Activity activity) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
public static void noTitle(Activity activity) {
setNoTitle(activity);
}
/**
* 全屏
* 也就是设置全屏,一定要在setContentView之前调用,否则报错
*
* @param activity
*/
public static void FLAG_FULLSCREEN(Activity activity) {
activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
/**
* 获取状态栏高度
*
* @param context 上下文
* @return 状态栏高度
*/
public static int getStatusBarHeight(Context context) {
int result = 0;
int resourceId = context.getResources()
.getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
/**
* 判断状态栏是否存在
*
* @param activity activity
* @return {@code true}: 存在<br>{@code false}: 不存在
*/
public static boolean isStatusBarExists(Activity activity) {
WindowManager.LayoutParams params = activity.getWindow().getAttributes();
return (params.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != WindowManager.LayoutParams.FLAG_FULLSCREEN;
}
/**
* 获取ActionBar高度
*
* @param activity activity
* @return ActionBar高度
*/
public static int getActionBarHeight(Activity activity) {
TypedValue tv = new TypedValue();
if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
return TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics());
}
return 0;
}
/**
* 显示通知栏
* <p>需添加权限 {@code <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>}</p>
*
* @param context 上下文
* @param isSettingPanel {@code true}: 打开设置<br>{@code false}: 打开通知
*/
public static void showNotificationBar(Context context, boolean isSettingPanel) {
String methodName = (Build.VERSION.SDK_INT <= 16) ? "expand"
: (isSettingPanel ? "expandSettingsPanel" : "expandNotificationsPanel");
invokePanels(context, methodName);
}
/**
* 隐藏通知栏
* <p>需添加权限 {@code <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>}</p>
*
* @param context 上下文
*/
public static void hideNotificationBar(Context context) {
String methodName = (Build.VERSION.SDK_INT <= 16) ? "collapse" : "collapsePanels";
invokePanels(context, methodName);
}
/**
* 反射唤醒通知栏
*
* @param context 上下文
* @param methodName 方法名
*/
private static void invokePanels(Context context, String methodName) {
try {
Object service = context.getSystemService("statusbar");
Class<?> statusBarManager = Class.forName("android.app.StatusBarManager");
Method expand = statusBarManager.getMethod(methodName);
expand.invoke(service);
} catch (Exception e) {
e.printStackTrace();
}
}
//==============================================================================================以下设置状态栏相关
/**
* 需要在布局中加入
android:clipToPadding="true"
android:fitsSystemWindows="true"
* 这两行属性
*/
/**
* 修改状态栏为全透明
*
* @param activity
*/
@TargetApi(19)
public static void transparencyBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = activity.getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
/**
* 修改状态栏颜色,支持4.4以上版本
*
* @param activity
* @param colorId
*/
public static void setStatusBarColor(Activity activity, int colorId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(activity.getResources().getColor(colorId));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//使用SystemBarTint库使4.4版本状态栏变色,需要先将状态栏设置为透明
transparencyBar(activity);
SystemBarTintManager tintManager = new SystemBarTintManager(activity);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintResource(colorId);
}
}
/**
* 设置状态栏黑色字体图标,
* 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
*
* @param activity
* @return 1:MIUUI 2:Flyme 3:android6.0
*/
public static int StatusBarLightMode(Activity activity) {
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
if (MIUISetStatusBarLightMode(activity.getWindow(), true)) {
result = 1;
} else if (FlymeSetStatusBarLightMode(activity.getWindow(), true)) {
result = 2;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
result = 3;
}
}
return result;
}
/**
* 已知系统类型时,设置状态栏黑色字体图标。
* 适配4.4以上版本MIUIV、Flyme和6.0以上版本其他Android
*
* @param activity
* @param type 1:MIUUI 2:Flyme 3:android6.0
*/
public static void StatusBarLightMode(Activity activity, int type) {
if (type == 1) {
MIUISetStatusBarLightMode(activity.getWindow(), true);
} else if (type == 2) {
FlymeSetStatusBarLightMode(activity.getWindow(), true);
} else if (type == 3) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
/**
* 清除MIUI或flyme或6.0以上版本状态栏黑色字体
*/
public static void StatusBarDarkMode(Activity activity, int type) {
if (type == 1) {
MIUISetStatusBarLightMode(activity.getWindow(), false);
} else if (type == 2) {
FlymeSetStatusBarLightMode(activity.getWindow(), false);
} else if (type == 3) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}
}
/**
* 设置状态栏图标为深色和魅族特定的文字风格
* 可以用来判断是否为Flyme用户
*
* @param window 需要设置的窗口
* @param dark 是否把状态栏字体及图标颜色设置为深色
* @return boolean 成功执行返回true
*/
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
boolean result = false;
if (window != null) {
try {
WindowManager.LayoutParams lp = window.getAttributes();
Field darkFlag = WindowManager.LayoutParams.class
.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
Field meizuFlags = WindowManager.LayoutParams.class
.getDeclaredField("meizuFlags");
darkFlag.setAccessible(true);
meizuFlags.setAccessible(true);
int bit = darkFlag.getInt(null);
int value = meizuFlags.getInt(lp);
if (dark) {
value |= bit;
} else {
value &= ~bit;
}
meizuFlags.setInt(lp, value);
window.setAttributes(lp);
result = true;
} catch (Exception e) {
}
}
return result;
}
/**
* 设置状态栏字体图标为深色,需要MIUIV6以上
*
* @param window 需要设置的窗口
* @param dark 是否把状态栏字体及图标颜色设置为深色
* @return boolean 成功执行返回true
*/
public static boolean MIUISetStatusBarLightMode(Window window, boolean dark) {
boolean result = false;
if (window != null) {
Class clazz = window.getClass();
try {
int darkModeFlag = 0;
Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
darkModeFlag = field.getInt(layoutParams);
Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
if (dark) {
extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
} else {
extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
}
result = true;
} catch (Exception e) {
}
}
return result;
}
//==============================================================================================以上为设置状态栏相关
}
|
/*
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.provisioning.impl.shadows;
import static com.evolveum.midpoint.util.MiscUtil.stateCheck;
import javax.xml.namespace.QName;
import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import com.evolveum.midpoint.schema.processor.ShadowCoordinatesQualifiedObjectDelta;
import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.query.PropertyValueFilter;
import com.evolveum.midpoint.provisioning.impl.ProvisioningContext;
import com.evolveum.midpoint.provisioning.impl.ProvisioningContextFactory;
import com.evolveum.midpoint.provisioning.impl.ShadowCaretaker;
import com.evolveum.midpoint.provisioning.impl.shadows.manager.ShadowManager;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.schema.ResourceShadowCoordinates;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectQueryUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.annotation.Experimental;
import com.evolveum.midpoint.util.exception.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;
/**
* Implements various methods of `applyDefinition` kind.
*/
@Experimental
@Component
class DefinitionsHelper {
@Autowired
@Qualifier("cacheRepositoryService")
private RepositoryService repositoryService;
@Autowired private ShadowCaretaker shadowCaretaker;
@Autowired protected ShadowManager shadowManager;
@Autowired private ProvisioningContextFactory ctxFactory;
public void applyDefinition(ObjectDelta<ShadowType> delta, @Nullable ShadowType repoShadow,
Task task, OperationResult result) throws SchemaException, ObjectNotFoundException,
CommunicationException, ConfigurationException, ExpressionEvaluationException {
PrismObject<ShadowType> shadow = null;
ResourceShadowCoordinates coordinates = null;
if (delta.isAdd()) {
shadow = delta.getObjectToAdd();
} else if (delta.isModify()) {
if (delta instanceof ShadowCoordinatesQualifiedObjectDelta) {
// This one does not have OID, it has to be specially processed
coordinates = ((ShadowCoordinatesQualifiedObjectDelta<?>) delta).getCoordinates();
} else {
String shadowOid = delta.getOid();
if (shadowOid == null) {
if (repoShadow == null) {
throw new IllegalArgumentException("No OID in object delta " + delta
+ " and no externally-supplied shadow is present as well.");
}
shadow = repoShadow.asPrismObject();
} else {
// TODO consider fetching only when really necessary
shadow = repositoryService.getObject(delta.getObjectTypeClass(), shadowOid, null, result);
}
}
} else {
// Delete delta, nothing to do at all
return;
}
ProvisioningContext ctx;
if (shadow == null) {
stateCheck(coordinates != null, "No shadow nor coordinates");
ctx = ctxFactory.createForCoordinates(coordinates, task, result);
} else {
ctx = ctxFactory.createForShadow(shadow, task, result);
}
shadowCaretaker.applyAttributesDefinition(ctx, delta);
}
public void applyDefinition(PrismObject<ShadowType> shadow, Task task, OperationResult parentResult)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
ExpressionEvaluationException {
ProvisioningContext ctx = ctxFactory.createForShadow(shadow, task, parentResult);
shadowCaretaker.applyAttributesDefinition(ctx, shadow);
}
public void applyDefinition(ObjectQuery query, Task task, OperationResult result)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException,
ExpressionEvaluationException {
ProvisioningContext ctx = ctxFactory.createForCoordinates(
ObjectQueryUtil.getCoordinates(query.getFilter()),
task, result);
applyDefinition(ctx, query);
}
void applyDefinition(ProvisioningContext ctx, ObjectQuery query)
throws SchemaException {
if (query == null) {
return;
}
ObjectFilter filter = query.getFilter();
if (filter == null) {
return;
}
com.evolveum.midpoint.prism.query.Visitor visitor = subFilter -> {
if (subFilter instanceof PropertyValueFilter) {
PropertyValueFilter<?> valueFilter = (PropertyValueFilter<?>) subFilter;
ItemDefinition<?> definition = valueFilter.getDefinition();
if (definition instanceof ResourceAttributeDefinition) {
return; // already has a resource-related definition
}
if (!ShadowType.F_ATTRIBUTES.equivalent(valueFilter.getParentPath())) {
return;
}
QName attributeName = valueFilter.getElementName();
ResourceAttributeDefinition<?> attributeDefinition =
ctx.getObjectDefinitionRequired().findAttributeDefinition(attributeName);
if (attributeDefinition == null) {
throw new TunnelException(
new SchemaException("No definition for attribute " + attributeName + " in query " + query));
}
//noinspection unchecked,rawtypes
valueFilter.setDefinition((ResourceAttributeDefinition) attributeDefinition);
}
};
try {
filter.accept(visitor);
} catch (TunnelException te) {
throw (SchemaException) te.getCause();
}
}
}
|
package Chapter03.P74_CalculatingAge.src.modern.challenge;
import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;
public class Main {
public static void main(String[] args) {
System.out.println("Before JDK 8:");
Calendar startDate = Calendar.getInstance();
startDate.set(1977, 10, 2);
Calendar endDate = Calendar.getInstance();
endDate.setTime(new Date());
int yearsc = endDate.get(Calendar.YEAR) - startDate.get(Calendar.YEAR);
if (yearsc > 0) {
if (startDate.get(Calendar.MONTH) > endDate.get(Calendar.MONTH)
|| (startDate.get(Calendar.MONTH) == endDate.get(Calendar.MONTH)
&& startDate.get(Calendar.DAY_OF_MONTH) > endDate.get(Calendar.DAY_OF_MONTH))) {
yearsc--;
}
}
System.out.println(yearsc + "y");
System.out.println("\nStarting with JDK 8");
LocalDate startLocalDate = LocalDate.of(1977, 11, 2);
LocalDate endLocalDate = LocalDate.now();
long years = ChronoUnit.YEARS.between(startLocalDate, endLocalDate);
System.out.println(years + "y ");
Period periodBetween = Period.between(startLocalDate, endLocalDate);
System.out.println(periodBetween.getYears() + "y "
+ periodBetween.getMonths() + "m "
+ periodBetween.getDays() + "d");
}
}
|
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
public class Consumer implements Runnable {
private List<String> buffer;
private String color;
private ReentrantLock queue;
public Consumer(List<String> buffer, String color,ReentrantLock queue){
this.buffer = buffer;
this.color = color;
this.queue = queue;
}
@Override
public void run(){
while (true){
queue.lock();
try{
if (buffer.isEmpty())
continue;
if (buffer.get(0).equals("EOF")) {
System.out.println(color + "Exiting...");
break;
}
else
System.out.println(color + "Removed " + buffer.remove(0));
} finally{
queue.unlock();
}
}
}
}
|
package egree4j.http;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.http.NameValuePair;
/**
* Class that unwraps a map into usable lists to be sent as request headers
* or URL parameters in a GET or POST.
*
* @author Johan
*
*/
public class RequestParameterMapper {
/**
* Unwraps the given Map of key-value pairs into an array of NameValuePairs
* that can be sent in a GET or POST.
*
* @param map Map with key value pairs.
* @return Array of parameters extracted from the map.
*/
public static NameValuePair[] unwrap(Map<String, String> map) {
if (map == null) {
return new NameValuePair[0];
}
NameValuePair[] parameters = new NameValuePair[map.size()];
int idx = 0;
Iterator<Entry<String, String>> values = map.entrySet().iterator();
while (values.hasNext()) {
Entry<String, String> value = values.next();
parameters[idx++] = new RequestParameter(
value.getKey(), value.getValue());
}
return parameters;
}
}
|
// Copyright 2018 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.rules.cpp;
import static com.google.devtools.build.lib.packages.BuildType.NODEP_LABEL;
import static com.google.devtools.build.lib.packages.Type.BOOLEAN;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.actions.Actions;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.Allowlist;
import com.google.devtools.build.lib.analysis.FileProvider;
import com.google.devtools.build.lib.analysis.LicensesProvider;
import com.google.devtools.build.lib.analysis.LicensesProvider.TargetLicense;
import com.google.devtools.build.lib.analysis.LicensesProviderImpl;
import com.google.devtools.build.lib.analysis.MiddlemanProvider;
import com.google.devtools.build.lib.analysis.PackageSpecificationProvider;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.TransitionMode;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.platform.ToolchainInfo;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.packages.BuildType;
import com.google.devtools.build.lib.packages.License;
import com.google.devtools.build.lib.packages.NativeProvider;
import com.google.devtools.build.lib.packages.Type;
import com.google.devtools.build.lib.rules.cpp.CcToolchain.AdditionalBuildVariablesComputer;
import com.google.devtools.build.lib.syntax.Location;
/**
* Provider encapsulating all the information from the cc_toolchain rule that affects creation of
* {@link CcToolchainProvider}
*/
public class CcToolchainAttributesProvider extends ToolchainInfo implements HasCcToolchainLabel {
public static final NativeProvider<CcToolchainAttributesProvider> PROVIDER =
new NativeProvider<CcToolchainAttributesProvider>(
CcToolchainAttributesProvider.class, "CcToolchainAttributesInfo") {};
private final boolean supportsParamFiles;
private final boolean supportsHeaderParsing;
private final NestedSet<Artifact> allFiles;
private final NestedSet<Artifact> allFilesMiddleman;
private final NestedSet<Artifact> compilerFiles;
private final NestedSet<Artifact> compilerFilesWithoutIncludes;
private final NestedSet<Artifact> stripFiles;
private final NestedSet<Artifact> objcopyFiles;
private final NestedSet<Artifact> asFiles;
private final NestedSet<Artifact> arFiles;
private final NestedSet<Artifact> linkerFiles;
private final NestedSet<Artifact> dwpFiles;
private final Label libcTopAttribute;
private final NestedSet<Artifact> libc;
private final NestedSet<Artifact> libcMiddleman;
private final TransitiveInfoCollection libcTop;
private final NestedSet<Artifact> targetLibc;
private final NestedSet<Artifact> targetLibcMiddleman;
private final TransitiveInfoCollection targetLibcTop;
private final NestedSet<Artifact> fullInputsForCrosstool;
private final NestedSet<Artifact> fullInputsForLink;
private final NestedSet<Artifact> coverage;
private final String compiler;
private final String cpu;
private final Artifact ifsoBuilder;
private final Artifact linkDynamicLibraryTool;
private final TransitiveInfoCollection fdoOptimize;
private final ImmutableList<Artifact> fdoOptimizeArtifacts;
private final FdoPrefetchHintsProvider fdoPrefetch;
private final TransitiveInfoCollection moduleMap;
private final Artifact moduleMapArtifact;
private final Artifact zipper;
private final String purposePrefix;
private final String runtimeSolibDirBase;
private final LicensesProvider licensesProvider;
private final Label toolchainType;
private final AdditionalBuildVariablesComputer additionalBuildVariablesComputer;
private final CcToolchainConfigInfo ccToolchainConfigInfo;
private final String toolchainIdentifier;
private final FdoProfileProvider fdoOptimizeProvider;
private final FdoProfileProvider fdoProfileProvider;
private final FdoProfileProvider csFdoProfileProvider;
private final FdoProfileProvider xfdoProfileProvider;
private final Label ccToolchainLabel;
private final TransitiveInfoCollection staticRuntimeLib;
private final TransitiveInfoCollection dynamicRuntimeLib;
private final PackageSpecificationProvider allowlistForLayeringCheck;
public CcToolchainAttributesProvider(
RuleContext ruleContext,
boolean isAppleToolchain,
AdditionalBuildVariablesComputer additionalBuildVariablesComputer) {
super(ImmutableMap.of(), Location.BUILTIN);
this.ccToolchainLabel = ruleContext.getLabel();
this.toolchainIdentifier = ruleContext.attributes().get("toolchain_identifier", Type.STRING);
if (ruleContext.getFragment(CppConfiguration.class).removeCpuCompilerCcToolchainAttributes()
&& (ruleContext.attributes().isAttributeValueExplicitlySpecified("cpu")
|| ruleContext.attributes().isAttributeValueExplicitlySpecified("compiler"))) {
ruleContext.ruleError(
"attributes 'cpu' and 'compiler' have been deprecated, please remove them. See "
+ "https://github.com/bazelbuild/bazel/issues/7075 for details.");
}
this.cpu = ruleContext.attributes().get("cpu", Type.STRING);
this.compiler = ruleContext.attributes().get("compiler", Type.STRING);
this.supportsParamFiles = ruleContext.attributes().get("supports_param_files", BOOLEAN);
this.supportsHeaderParsing = ruleContext.attributes().get("supports_header_parsing", BOOLEAN);
this.allFiles =
ruleContext
.getPrerequisite("all_files", TransitionMode.HOST)
.getProvider(FileProvider.class)
.getFilesToBuild();
this.allFilesMiddleman = getMiddlemanOrFiles(ruleContext, "all_files");
this.compilerFiles = getMiddlemanOrFiles(ruleContext, "compiler_files");
this.compilerFilesWithoutIncludes =
getOptionalMiddlemanOrFiles(ruleContext, "compiler_files_without_includes");
this.stripFiles = getMiddlemanOrFiles(ruleContext, "strip_files");
this.objcopyFiles = getMiddlemanOrFiles(ruleContext, "objcopy_files");
this.asFiles = getOptionalMiddlemanOrFiles(ruleContext, "as_files");
this.arFiles = getOptionalMiddlemanOrFiles(ruleContext, "ar_files");
this.linkerFiles = getMiddlemanOrFiles(ruleContext, "linker_files");
this.dwpFiles = getMiddlemanOrFiles(ruleContext, "dwp_files");
this.libcMiddleman =
getOptionalMiddlemanOrFiles(
ruleContext, CcToolchainRule.LIBC_TOP_ATTR, TransitionMode.TARGET);
this.libc = getOptionalFiles(ruleContext, CcToolchainRule.LIBC_TOP_ATTR, TransitionMode.TARGET);
this.libcTop =
ruleContext.getPrerequisite(CcToolchainRule.LIBC_TOP_ATTR, TransitionMode.TARGET);
this.targetLibcMiddleman =
getOptionalMiddlemanOrFiles(
ruleContext, CcToolchainRule.TARGET_LIBC_TOP_ATTR, TransitionMode.TARGET);
this.targetLibc =
getOptionalFiles(ruleContext, CcToolchainRule.TARGET_LIBC_TOP_ATTR, TransitionMode.TARGET);
this.targetLibcTop =
ruleContext.getPrerequisite(CcToolchainRule.TARGET_LIBC_TOP_ATTR, TransitionMode.TARGET);
this.libcTopAttribute = ruleContext.attributes().get("libc_top", BuildType.LABEL);
this.fullInputsForCrosstool =
NestedSetBuilder.<Artifact>stableOrder()
.addTransitive(allFilesMiddleman)
.addTransitive(libcMiddleman)
.build();
this.fullInputsForLink =
fullInputsForLink(ruleContext, linkerFiles, libcMiddleman, isAppleToolchain);
NestedSet<Artifact> coverageFiles = getOptionalMiddlemanOrFiles(ruleContext, "coverage_files");
if (coverageFiles.isEmpty()) {
this.coverage = Preconditions.checkNotNull(this.allFiles);
} else {
this.coverage = coverageFiles;
}
this.ifsoBuilder =
ruleContext.getPrerequisiteArtifact("$interface_library_builder", TransitionMode.HOST);
this.linkDynamicLibraryTool =
ruleContext.getPrerequisiteArtifact("$link_dynamic_library_tool", TransitionMode.HOST);
this.fdoProfileProvider =
ruleContext.getPrerequisite(
CcToolchainRule.FDO_PROFILE_ATTR, TransitionMode.TARGET, FdoProfileProvider.PROVIDER);
this.csFdoProfileProvider =
ruleContext.getPrerequisite(
CcToolchainRule.CSFDO_PROFILE_ATTR, TransitionMode.TARGET, FdoProfileProvider.PROVIDER);
this.xfdoProfileProvider =
ruleContext.getPrerequisite(
CcToolchainRule.XFDO_PROFILE_ATTR, TransitionMode.TARGET, FdoProfileProvider.PROVIDER);
this.fdoOptimizeProvider =
ruleContext.getPrerequisite(
CcToolchainRule.FDO_OPTIMIZE_ATTR, TransitionMode.TARGET, FdoProfileProvider.PROVIDER);
this.fdoOptimize =
ruleContext.getPrerequisite(CcToolchainRule.FDO_OPTIMIZE_ATTR, TransitionMode.TARGET);
this.fdoOptimizeArtifacts =
ruleContext
.getPrerequisiteArtifacts(CcToolchainRule.FDO_OPTIMIZE_ATTR, TransitionMode.TARGET)
.list();
this.fdoPrefetch =
ruleContext.getPrerequisite(
":fdo_prefetch_hints", TransitionMode.TARGET, FdoPrefetchHintsProvider.PROVIDER);
this.moduleMap = ruleContext.getPrerequisite("module_map", TransitionMode.HOST);
this.moduleMapArtifact = ruleContext.getPrerequisiteArtifact("module_map", TransitionMode.HOST);
this.zipper = ruleContext.getPrerequisiteArtifact(":zipper", TransitionMode.HOST);
this.purposePrefix = Actions.escapeLabel(ruleContext.getLabel()) + "_";
this.runtimeSolibDirBase = "_solib_" + "_" + Actions.escapeLabel(ruleContext.getLabel());
this.staticRuntimeLib =
ruleContext.getPrerequisite("static_runtime_lib", TransitionMode.TARGET);
this.dynamicRuntimeLib =
ruleContext.getPrerequisite("dynamic_runtime_lib", TransitionMode.TARGET);
this.ccToolchainConfigInfo =
ruleContext.getPrerequisite(
CcToolchainRule.TOOLCHAIN_CONFIG_ATTR,
TransitionMode.TARGET,
CcToolchainConfigInfo.PROVIDER);
// If output_license is specified on the cc_toolchain rule, override the transitive licenses
// with that one. This is necessary because cc_toolchain is used in the target configuration,
// but it is sort-of-kind-of a tool, but various parts of it are linked into the output...
// ...so we trust the judgment of the author of the cc_toolchain rule to figure out what
// licenses should be propagated to C++ targets.
// TODO(elenairina): Remove this and use Attribute.Builder.useOutputLicenses() on the
// :cc_toolchain attribute instead.
final License outputLicense =
ruleContext.getRule().getToolOutputLicense(ruleContext.attributes());
if (outputLicense != null && !outputLicense.equals(License.NO_LICENSE)) {
final NestedSet<TargetLicense> license =
NestedSetBuilder.create(
Order.STABLE_ORDER, new TargetLicense(ruleContext.getLabel(), outputLicense));
this.licensesProvider =
new LicensesProviderImpl(
license, new TargetLicense(ruleContext.getLabel(), outputLicense));
} else {
this.licensesProvider = null;
}
// TODO(b/65835260): Remove this conditional once j2objc can learn the toolchain type.
if (ruleContext.attributes().has(CcToolchain.CC_TOOLCHAIN_TYPE_ATTRIBUTE_NAME)) {
this.toolchainType =
ruleContext.attributes().get(CcToolchain.CC_TOOLCHAIN_TYPE_ATTRIBUTE_NAME, NODEP_LABEL);
} else {
this.toolchainType = null;
}
this.additionalBuildVariablesComputer = additionalBuildVariablesComputer;
this.allowlistForLayeringCheck =
Allowlist.fetchPackageSpecificationProvider(
ruleContext, CcToolchain.ALLOWED_LAYERING_CHECK_FEATURES_ALLOWLIST);
}
public String getCpu() {
return cpu;
}
public boolean isSupportsParamFiles() {
return supportsParamFiles;
}
public String getPurposePrefix() {
return purposePrefix;
}
public String getRuntimeSolibDirBase() {
return runtimeSolibDirBase;
}
public FdoPrefetchHintsProvider getFdoPrefetch() {
return fdoPrefetch;
}
public String getToolchainIdentifier() {
return toolchainIdentifier;
}
public Label getToolchainType() {
return toolchainType;
}
public CcToolchainConfigInfo getCcToolchainConfigInfo() {
return ccToolchainConfigInfo;
}
public ImmutableList<Artifact> getFdoOptimizeArtifacts() {
return fdoOptimizeArtifacts;
}
public LicensesProvider getLicensesProvider() {
return licensesProvider;
}
public TransitiveInfoCollection getStaticRuntimeLib() {
return staticRuntimeLib;
}
public TransitiveInfoCollection getDynamicRuntimeLib() {
return dynamicRuntimeLib;
}
public boolean isSupportsHeaderParsing() {
return supportsHeaderParsing;
}
public AdditionalBuildVariablesComputer getAdditionalBuildVariablesComputer() {
return additionalBuildVariablesComputer;
}
public NestedSet<Artifact> getAllFiles() {
return allFiles;
}
public NestedSet<Artifact> getAllFilesMiddleman() {
return allFilesMiddleman;
}
public NestedSet<Artifact> getCompilerFiles() {
return compilerFiles;
}
public NestedSet<Artifact> getStripFiles() {
return stripFiles;
}
public NestedSet<Artifact> getObjcopyFiles() {
return objcopyFiles;
}
public TransitiveInfoCollection getFdoOptimize() {
return fdoOptimize;
}
public Artifact getLinkDynamicLibraryTool() {
return linkDynamicLibraryTool;
}
public TransitiveInfoCollection getModuleMap() {
return moduleMap;
}
public NestedSet<Artifact> getAsFiles() {
return asFiles;
}
public NestedSet<Artifact> getArFiles() {
return arFiles;
}
public TransitiveInfoCollection getLibcTop() {
return libcTop;
}
public NestedSet<Artifact> getLinkerFiles() {
return linkerFiles;
}
public NestedSet<Artifact> getDwpFiles() {
return dwpFiles;
}
public FdoProfileProvider getFdoOptimizeProvider() {
return fdoOptimizeProvider;
}
public Artifact getModuleMapArtifact() {
return moduleMapArtifact;
}
public NestedSet<Artifact> getFullInputsForCrosstool() {
return fullInputsForCrosstool;
}
public FdoProfileProvider getFdoProfileProvider() {
return fdoProfileProvider;
}
public FdoProfileProvider getCSFdoProfileProvider() {
return csFdoProfileProvider;
}
public FdoProfileProvider getXFdoProfileProvider() {
return xfdoProfileProvider;
}
public Artifact getZipper() {
return zipper;
}
public NestedSet<Artifact> getFullInputsForLink() {
return fullInputsForLink;
}
public Label getCcToolchainLabel() {
return ccToolchainLabel;
}
public NestedSet<Artifact> getCoverage() {
return coverage;
}
public NestedSet<Artifact> getCompilerFilesWithoutIncludes() {
return compilerFilesWithoutIncludes;
}
public NestedSet<Artifact> getLibc() {
return libc;
}
public NestedSet<Artifact> getTargetLibc() {
return targetLibc;
}
public TransitiveInfoCollection getTargetLibcTop() {
return targetLibcTop;
}
public Label getLibcTopLabel() {
return getLibcTop() == null ? null : getLibcTop().getLabel();
}
public Label getTargetLibcTopLabel() {
return getTargetLibcTop() == null ? null : getTargetLibcTop().getLabel();
}
public Label getLibcTopAttribute() {
return libcTopAttribute;
}
public String getCompiler() {
return compiler;
}
public Artifact getIfsoBuilder() {
return ifsoBuilder;
}
public PackageSpecificationProvider getAllowlistForLayeringCheck() {
return allowlistForLayeringCheck;
}
private static NestedSet<Artifact> getMiddlemanOrFiles(RuleContext context, String attribute) {
return getMiddlemanOrFiles(context, attribute, TransitionMode.HOST);
}
private static NestedSet<Artifact> getMiddlemanOrFiles(
RuleContext context, String attribute, TransitionMode mode) {
TransitiveInfoCollection dep = context.getPrerequisite(attribute, mode);
MiddlemanProvider middlemanProvider = dep.getProvider(MiddlemanProvider.class);
// We use the middleman if we can (if the dep is a filegroup), otherwise, just the regular
// filesToBuild (e.g. if it is a simple input file)
return middlemanProvider != null
? middlemanProvider.getMiddlemanArtifact()
: dep.getProvider(FileProvider.class).getFilesToBuild();
}
private static NestedSet<Artifact> getOptionalMiddlemanOrFiles(
RuleContext context, String attribute) {
return getOptionalMiddlemanOrFiles(context, attribute, TransitionMode.HOST);
}
private static NestedSet<Artifact> getOptionalMiddlemanOrFiles(
RuleContext context, String attribute, TransitionMode mode) {
TransitiveInfoCollection dep = context.getPrerequisite(attribute, mode);
return dep != null
? getMiddlemanOrFiles(context, attribute, mode)
: NestedSetBuilder.emptySet(Order.STABLE_ORDER);
}
private static NestedSet<Artifact> getOptionalFiles(
RuleContext ruleContext, String attribute, TransitionMode mode) {
TransitiveInfoCollection dep = ruleContext.getPrerequisite(attribute, mode);
return dep != null
? dep.getProvider(FileProvider.class).getFilesToBuild()
: NestedSetBuilder.emptySet(Order.STABLE_ORDER);
}
/**
* Returns the allFiles-derived link action inputs for a given rule. Adds the given set of
* artifacts as extra inputs.
*/
private static NestedSet<Artifact> fullInputsForLink(
RuleContext ruleContext,
NestedSet<Artifact> link,
NestedSet<Artifact> libcMiddleman,
boolean isAppleToolchain) {
NestedSetBuilder<Artifact> builder =
NestedSetBuilder.<Artifact>stableOrder().addTransitive(link).addTransitive(libcMiddleman);
if (!isAppleToolchain) {
builder
.add(
ruleContext.getPrerequisiteArtifact(
"$interface_library_builder", TransitionMode.HOST))
.add(
ruleContext.getPrerequisiteArtifact(
"$link_dynamic_library_tool", TransitionMode.HOST));
}
return builder.build();
}
}
/**
* Temporary interface to cover common interface of {@link CcToolchainAttributesProvider} and {@link
* CcToolchainProvider}.
*/
// TODO(b/113849758): Remove once behavior is migrated.
interface HasCcToolchainLabel {
Label getCcToolchainLabel();
}
|
package com.mine.violet.controller.front;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mine.violet.commonutils.R;
import com.mine.violet.entity.Blog;
import com.mine.violet.entity.vo.BlogQuery;
import com.mine.violet.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/adminservice/front/blog")
public class FrontBlogController {
@Autowired
private BlogService blogService; //博客
@PostMapping("/updateViews/{id}")
public R updateViews(@PathVariable String id){
Blog blog = blogService.getById(id);
blog.setViews(blog.getViews()+1);
blogService.updateById(blog);
return R.ok();
}
//1 前台分页查询博客
@GetMapping("/pageList/{current}/{limit}")
public R pageList(@PathVariable long current, @PathVariable long limit){
// 创建page对象
Page<Blog> blogPage = new Page<>(current,limit);
//构建条件
QueryWrapper<Blog> wrapper = new QueryWrapper<>();
//排序
wrapper.orderByDesc("gmt_create");
blogService.page(blogPage,wrapper);
long total = blogPage.getTotal(); //总记录数
List<Blog> records = blogPage.getRecords();
Map map = new HashMap<>();
map.put("total",total);
map.put("rows",records);
return R.ok().data(map);
}
//2 根据id查询博客内容
@GetMapping("/getBlogById/{id}")
public R getBlogById(@PathVariable String id){
Blog blog = blogService.getById(id);
return R.ok().data("blog",blog);
}
//3 前台查询作者自己的博客
@PostMapping("/pageListById/{current}/{limit}/{id}")
public R pageListById(@PathVariable long current, @PathVariable long limit,
@PathVariable String id,
@RequestBody(required = false) BlogQuery blogQuery){
// 创建page对象
Page<Blog> blogPage = new Page<>(current,limit);
//构建条件
QueryWrapper<Blog> wrapper = new QueryWrapper<>();
String title = blogQuery.getTitle();
String status = blogQuery.getStatus();
if(!StringUtils.isEmpty(title)){
// 构建条件
wrapper.like("title",title);
}
if(!StringUtils.isEmpty(status)){
// 构建条件
wrapper.eq("status",status);
}
wrapper.eq("author_id",id);
//排序
wrapper.orderByDesc("gmt_create");
blogService.page(blogPage,wrapper);
long total = blogPage.getTotal(); //总记录数
List<Blog> records = blogPage.getRecords();
Map map = new HashMap<>();
map.put("total",total);
map.put("rows",records);
System.out.println("=========");
System.out.println(id);
System.out.println(map);
return R.ok().data(map);
}
//4 根据博客id删除博客
@DeleteMapping("/{blogId}")
public R deleteBlog(@PathVariable String blogId){
blogService.removeById(blogId);
return R.ok();
}
}
|
/*
* Licensed to the Hipparchus project under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The Hipparchus project 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.hipparchus.ode.nonstiff;
import org.hipparchus.ode.EquationsMapper;
import org.hipparchus.ode.ODEStateAndDerivative;
/**
* This class implements the 3/8 fourth order Runge-Kutta
* integrator for Ordinary Differential Equations.
*
* <p>This method is an explicit Runge-Kutta method, its Butcher-array
* is the following one :
* <pre>
* 0 | 0 0 0 0
* 1/3 | 1/3 0 0 0
* 2/3 |-1/3 1 0 0
* 1 | 1 -1 1 0
* |--------------------
* | 1/8 3/8 3/8 1/8
* </pre>
* </p>
*
* @see EulerIntegrator
* @see ClassicalRungeKuttaIntegrator
* @see GillIntegrator
* @see MidpointIntegrator
* @see LutherIntegrator
*/
public class ThreeEighthesIntegrator extends RungeKuttaIntegrator {
/** Simple constructor.
* Build a 3/8 integrator with the given step.
* @param step integration step
*/
public ThreeEighthesIntegrator(final double step) {
super("3/8", step);
}
/** {@inheritDoc} */
@Override
public double[] getC() {
return new double[] {
1.0 / 3.0, 2.0 / 3.0, 1.0
};
}
/** {@inheritDoc} */
@Override
public double[][] getA() {
return new double[][] {
{ 1.0 / 3.0 },
{ -1.0 / 3.0, 1.0 },
{ 1.0, -1.0, 1.0 }
};
}
/** {@inheritDoc} */
@Override
public double[] getB() {
return new double[] {
1.0 / 8.0, 3.0 / 8.0, 3.0 / 8.0, 1.0 / 8.0
};
}
/** {@inheritDoc} */
@Override
protected ThreeEighthesStateInterpolator
createInterpolator(final boolean forward, double[][] yDotK,
final ODEStateAndDerivative globalPreviousState,
final ODEStateAndDerivative globalCurrentState,
final EquationsMapper mapper) {
return new ThreeEighthesStateInterpolator(forward, yDotK,
globalPreviousState, globalCurrentState,
globalPreviousState, globalCurrentState,
mapper);
}
}
|
/**
* 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.oozie.local;
import org.apache.oozie.CoordinatorEngine;
import org.apache.oozie.DagEngine;
import org.apache.oozie.LocalOozieClient;
import org.apache.oozie.LocalOozieClientCoord;
import org.apache.oozie.client.OozieClient;
import org.apache.oozie.service.CallbackService;
import org.apache.oozie.service.CoordinatorEngineService;
import org.apache.oozie.service.DagEngineService;
import org.apache.oozie.service.Services;
import org.apache.oozie.service.XLogService;
import org.apache.oozie.servlet.CallbackServlet;
import org.apache.oozie.test.EmbeddedServletContainer;
import org.apache.oozie.util.ParamChecker;
import org.apache.oozie.util.XLog;
/**
* LocalOozie runs workflows in an embedded Oozie instance . <p/> LocalOozie is meant for development/debugging purposes
* only.
*/
public class LocalOozie {
private static EmbeddedServletContainer container;
private static boolean localOozieActive = false;
/**
* Start LocalOozie.
*
* @throws Exception if LocalOozie could not be started.
*/
public synchronized static void start() throws Exception {
if (localOozieActive) {
throw new IllegalStateException("LocalOozie is already initialized");
}
String log4jFile = System.getProperty(XLogService.LOG4J_FILE, null);
String oozieLocalLog = System.getProperty("oozielocal.log", null);
if (log4jFile == null) {
System.setProperty(XLogService.LOG4J_FILE, "localoozie-log4j.properties");
}
if (oozieLocalLog == null) {
System.setProperty("oozielocal.log", "./oozielocal.log");
}
localOozieActive = true;
new Services().init();
if (log4jFile != null) {
System.setProperty(XLogService.LOG4J_FILE, log4jFile);
}
else {
System.getProperties().remove(XLogService.LOG4J_FILE);
}
if (oozieLocalLog != null) {
System.setProperty("oozielocal.log", oozieLocalLog);
}
else {
System.getProperties().remove("oozielocal.log");
}
container = new EmbeddedServletContainer("oozie");
container.addServletEndpoint("/callback", CallbackServlet.class);
container.start();
String callbackUrl = container.getServletURL("/callback");
Services.get().getConf().set(CallbackService.CONF_BASE_URL, callbackUrl);
XLog.getLog(LocalOozie.class).info("LocalOozie started callback set to [{0}]", callbackUrl);
}
/**
* Stop LocalOozie.
*/
public synchronized static void stop() {
RuntimeException thrown = null;
try {
if (container != null) {
container.stop();
}
}
catch (RuntimeException ex) {
thrown = ex;
}
container = null;
XLog.getLog(LocalOozie.class).info("LocalOozie stopped");
try {
Services.get().destroy();
}
catch (RuntimeException ex) {
if (thrown != null) {
thrown = ex;
}
}
localOozieActive = false;
if (thrown != null) {
throw thrown;
}
}
/**
* Return a {@link org.apache.oozie.client.OozieClient} for LocalOozie. <p/> The returned instance is configured
* with the user name of the JVM (the value of the system property 'user.name'). <p/> The following methods of the
* client are NOP in the returned instance: {@link org.apache.oozie.client.OozieClient#validateWSVersion}, {@link
* org.apache.oozie.client.OozieClient#setHeader}, {@link org.apache.oozie.client.OozieClient#getHeader}, {@link
* org.apache.oozie.client.OozieClient#removeHeader}, {@link org.apache.oozie.client.OozieClient#getHeaderNames} and
* {@link org.apache.oozie.client.OozieClient#setSafeMode}.
*
* @return a {@link org.apache.oozie.client.OozieClient} for LocalOozie.
*/
public static OozieClient getClient() {
return getClient(System.getProperty("user.name"));
}
/**
* Return a {@link org.apache.oozie.client.OozieClient} for LocalOozie.
* <p/>
* The returned instance is configured with the user name of the JVM (the
* value of the system property 'user.name').
* <p/>
* The following methods of the client are NOP in the returned instance:
* {@link org.apache.oozie.client.OozieClient#validateWSVersion},
* {@link org.apache.oozie.client.OozieClient#setHeader},
* {@link org.apache.oozie.client.OozieClient#getHeader},
* {@link org.apache.oozie.client.OozieClient#removeHeader},
* {@link org.apache.oozie.client.OozieClient#getHeaderNames} and
* {@link org.apache.oozie.client.OozieClient#setSafeMode}.
*
* @return a {@link org.apache.oozie.client.OozieClient} for LocalOozie.
*/
public static OozieClient getCoordClient() {
return getClientCoord(System.getProperty("user.name"));
}
/**
* Return a {@link org.apache.oozie.client.OozieClient} for LocalOozie configured for a given user.
* <p/>
* The following methods of the client are NOP in the returned instance: {@link org.apache.oozie.client.OozieClient#validateWSVersion},
* {@link org.apache.oozie.client.OozieClient#setHeader}, {@link org.apache.oozie.client.OozieClient#getHeader}, {@link org.apache.oozie.client.OozieClient#removeHeader},
* {@link org.apache.oozie.client.OozieClient#getHeaderNames} and {@link org.apache.oozie.client.OozieClient#setSafeMode}.
*
* @param user user name to use in LocalOozie for running workflows.
* @return a {@link org.apache.oozie.client.OozieClient} for LocalOozie configured for the given user.
*/
public static OozieClient getClient(String user) {
if (!localOozieActive) {
throw new IllegalStateException("LocalOozie is not initialized");
}
ParamChecker.notEmpty(user, "user");
DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user, "undef");
return new LocalOozieClient(dagEngine);
}
/**
* Return a {@link org.apache.oozie.client.OozieClient} for LocalOozie
* configured for a given user.
* <p/>
* The following methods of the client are NOP in the returned instance:
* {@link org.apache.oozie.client.OozieClient#validateWSVersion},
* {@link org.apache.oozie.client.OozieClient#setHeader},
* {@link org.apache.oozie.client.OozieClient#getHeader},
* {@link org.apache.oozie.client.OozieClient#removeHeader},
* {@link org.apache.oozie.client.OozieClient#getHeaderNames} and
* {@link org.apache.oozie.client.OozieClient#setSafeMode}.
*
* @param user user name to use in LocalOozie for running coordinator.
* @return a {@link org.apache.oozie.client.OozieClient} for LocalOozie
* configured for the given user.
*/
public static OozieClient getClientCoord(String user) {
if (!localOozieActive) {
throw new IllegalStateException("LocalOozie is not initialized");
}
ParamChecker.notEmpty(user, "user");
CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(user,
"undef");
return new LocalOozieClientCoord(coordEngine);
}
}
|
/*
Copyright 2021 Terrarier2111
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.terrarier.netlistening.internal;
import de.terrarier.netlistening.api.compression.VarIntUtil;
import de.terrarier.netlistening.impl.ApplicationImpl;
import de.terrarier.netlistening.util.ByteBufUtilExtension;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.ApiStatus;
/**
* @author Terrarier2111
* @since 1.0
*/
@ApiStatus.Internal
public final class InternalUtil {
private InternalUtil() {
throw new UnsupportedOperationException("This class may not be instantiated!");
}
public static void writeInt(@AssumeNotNull ApplicationImpl application, @AssumeNotNull ByteBuf buffer, int value) {
ByteBufUtilExtension.correctSize(buffer, getSize(application, value), application.getBuffer());
writeIntUnchecked(application, buffer, value);
}
public static void writeIntUnchecked(@AssumeNotNull ApplicationImpl application, @AssumeNotNull ByteBuf buffer,
int value) {
if (application.getCompressionSetting().isVarIntCompression()) {
VarIntUtil.writeVarInt(value, buffer);
} else {
buffer.writeInt(value);
}
}
public static int readInt(@AssumeNotNull ApplicationImpl application, @AssumeNotNull ByteBuf buffer)
throws CancelReadSignal {
if (application.getCompressionSetting().isVarIntCompression()) {
return VarIntUtil.getVarInt(buffer);
}
if (buffer.readableBytes() < 4) {
throw VarIntUtil.FOUR_BYTES;
}
return buffer.readInt();
}
static int getSize(@AssumeNotNull ApplicationImpl application, int value) {
return application.getCompressionSetting().isVarIntCompression() ? VarIntUtil.varIntSize(value) : 4;
}
public static int singleOctetIntSize(@AssumeNotNull ApplicationImpl application) {
return application.getCompressionSetting().isVarIntCompression() ? 1 : 4;
}
}
|
package org.firstinspires.ftc.teamcode.autos;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
@Autonomous
// basic autonomous that moves forward 10 inches, waits 5 seconds, turns around, then drives back
public class ThreeMarkerDuckBlue extends ThreeMarkerDuck {
@Override
public void runOpMode() {
super.coeff = -1;
super.runOpMode();
return;
}
}
|
package org.motechproject.mots.domain.enums;
public enum Status {
DRAFT,
RELEASED,
PREVIOUS_VERSION
}
|
/**
* maps4cim - a real world map generator for CiM 2
* Copyright 2013 Sebastian Straub
*
* 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.nx42.maps4cim.objects;
import java.io.IOException;
import java.io.OutputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Abstract definition of the binary footer to use for the current map.
*
* Contains all objects that are placed on the current map, like roads,
* buildings, trees, etc.
* As with the header, it is also possible to just insert a static footer from
* an empty map with no objects at all. This is implemented in
* {@link StaticGameObjects}.
*
* @author Sebastian Straub <sebastian-straub@gmx.net>
*/
public abstract class GameObjects {
private static Logger log = LoggerFactory.getLogger(GameObjects.class);
/**
* Generates the bytes that shall be written in the file footer.
* @return the footer bytes
* @throws IOException if some stored binaries can't be accessed
*/
public abstract byte[] generateGameObjects() throws IOException;
/**
* Calls the generateGameObjects function and writes the result to the
* specified stream
* @param out the OutputStream to write
* @throws IOException see {@link GameObjects#generateGameObjects()}
*/
public void writeTo(OutputStream out) throws IOException {
byte[] objects = generateGameObjects();
log.info("Writing game objects (postfix)...");
out.write(objects);
}
}
|
package com.alipay.api.response;
import java.util.List;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.internal.mapping.ApiListField;
import com.alipay.api.domain.SimpleShopInfo;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: ant.merchant.expand.shop.batchquery response.
*
* @author auto create
* @since 1.0, 2021-12-22 00:26:33
*/
public class AntMerchantExpandShopBatchqueryResponse extends AlipayResponse {
private static final long serialVersionUID = 3415247688726119456L;
/**
* 当前页码
*/
@ApiField("page_no")
private Long pageNo;
/**
* 分页数量
*/
@ApiField("page_size")
private Long pageSize;
/**
* 线下门店的列表;有可能为空
*/
@ApiListField("shops")
@ApiField("simple_shop_info")
private List<SimpleShopInfo> shops;
/**
* 按照分页数量拆分,分解出来的页数
*/
@ApiField("total_page")
private Long totalPage;
/**
* 所有线下门店数量
*/
@ApiField("total_size")
private Long totalSize;
public void setPageNo(Long pageNo) {
this.pageNo = pageNo;
}
public Long getPageNo( ) {
return this.pageNo;
}
public void setPageSize(Long pageSize) {
this.pageSize = pageSize;
}
public Long getPageSize( ) {
return this.pageSize;
}
public void setShops(List<SimpleShopInfo> shops) {
this.shops = shops;
}
public List<SimpleShopInfo> getShops( ) {
return this.shops;
}
public void setTotalPage(Long totalPage) {
this.totalPage = totalPage;
}
public Long getTotalPage( ) {
return this.totalPage;
}
public void setTotalSize(Long totalSize) {
this.totalSize = totalSize;
}
public Long getTotalSize( ) {
return this.totalSize;
}
}
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class P09StudentsEnrolledIn2014Or2015 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
Map<String, List<Integer>> students = new LinkedHashMap<>();
while (true) {
String line = bf.readLine();
if ("END".equalsIgnoreCase(line)) {
break;
}
List<String> tokens = Arrays.stream(line.split("\\s+"))
.filter(s -> (s != null && !s.isEmpty())).collect(Collectors.toList());
if (tokens.isEmpty()) {
return;
}
String facultyNumber = tokens.get(0);
List<Integer> grades = tokens.subList(1, tokens.size()).stream()
.map(Integer::valueOf).collect(Collectors.toList());
students.put(facultyNumber, grades);
}
students.entrySet().stream()
.filter(s -> (s.getKey().endsWith("14") || s.getKey().endsWith("15")))
.forEach(s -> System.out.println(Arrays.toString(s.getValue().toArray())
.replaceAll("[\\[\\],]", "")));
}
}
|
package neighbors.handler.renting;
import lombok.RequiredArgsConstructor;
import neighbors.entity.Advert;
import neighbors.entity.User;
import neighbors.enums.AdvertType;
import neighbors.enums.CategoryCommand;
import neighbors.enums.bot.State;
import neighbors.enums.bot.Text;
import neighbors.handler.Handler;
import neighbors.repository.UserRepository;
import neighbors.service.AdvertService;
import neighbors.utils.TelegramUtils;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import java.io.Serializable;
import java.util.List;
@Component
@RequiredArgsConstructor
public class RentSetCategoryHandler implements Handler {
private final UserRepository userRepository;
private final AdvertService advertService;
@Override
public List<PartialBotApiMethod<? extends Serializable>> handle(User user, String message) {
SendMessage sendMessage = TelegramUtils.createMessageTemplate(user);
Advert advert = advertService.saveAdvert(user, AdvertType.RENT);
user.setCurrentAdvert(advert.getId());
userRepository.save(user);
advertService.setAdvertCategory(advert, message);
sendMessage.setText(Text.REQUEST_RENTING_OUT_NAME);
user.setState(State.RENTING_SET_NAME);
userRepository.save(user);
return List.of(sendMessage);
}
@Override
public List<State> operatedBotState() {
return List.of(State.RENTING_SELECT_CATEGORY);
}
@Override
public List<String> operatedCallBackQuery() {
return List.of(CategoryCommand.CLOTHES, CategoryCommand.OTHER, CategoryCommand.REPAIR_THINGS);
}
}
|
package ucsal.ed.atividade03;
import java.util.Objects;
import ucsal.ed.atividade02.interfaces.Lista;
public class ListaImpl<T> implements Lista<T> {
private static Object[] objetos = {};
private static final Object[] EMPETY = {};
public ListaImpl(int tamanho) {
if(tamanho < 0) {
throw new RuntimeException("Valor negativo não suportado!");
} else {
objetos = new Object[tamanho];
}
}
public ListaImpl() {
}
@Override
public T consultar(T t) {
for (Object o : objetos) {
if(Objects.nonNull(o) && o.equals(t)) {
return t;
}
}
System.out.println(t.toString() + " não existe!");
return null;
}
@Override
public void incluir(T t) {
if(Objects.isNull(t)) {
throw new RuntimeException("Não é possível incluir um professor que não existe!");
}
if (estaCheio()) crescer();
objetos[obterIndexInclusao()] = t;
}
@Override
public void remover(T t) {
boolean existe = false;
for (int i = 0; i < objetos.length; i++) {
Object o = objetos[i];
if(Objects.nonNull(t) && o.equals(t)) {
objetos[i] = null;
diminuir();
existe = true;
}
}
if(!existe) {
System.out.println(t.toString() + " não existe!");
}
}
@Override
public int obterTamanho() {
return objetos.length;
}
@Override
public void limpar() {
objetos = EMPETY;
}
private static int obterIndexInclusao() {
int index = 0;
for(int i = 0; i < objetos.length; i++) {
if(Objects.isNull(objetos[i])) {
index = i;
break;
}
}
return index;
}
private static boolean estaCheio() {
boolean estaCheio = true;
for(Object o : objetos) {
if(Objects.isNull(o)) {
estaCheio = false;
}
}
return estaCheio;
}
private static void crescer() {
int tamanho = objetos.length;
Object[] novo = new Object[tamanho + 1];
for(int i = 0; i < tamanho; i++) {
novo[i] = objetos[i];
}
objetos = novo;
}
private static void diminuir() {
Object[] novo = new Object[objetos.length - 1];
int index = 0;
for (Object o : objetos) {
if(Objects.nonNull(o)) {
novo[index] = o;
index++;
}
}
objetos = novo;
}
}
|
package com.sunny.mvvmbilibili.ui.login;
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import com.sunny.mvvmbilibili.R;
import com.sunny.mvvmbilibili.databinding.ActivityLoginBinding;
import com.sunny.mvvmbilibili.injection.qualifier.ActivityContext;
import com.sunny.mvvmbilibili.ui.base.BaseActivity;
import com.sunny.mvvmbilibili.ui.home.HomeActivity;
import javax.inject.Inject;
/**
* The type Login activity.
* Created by Zhou zejin on 2017/8/4.
*/
public class LoginActivity extends BaseActivity implements LoginMvvmView {
@Inject @ActivityContext Context mContext;
@Inject LoginViewModel mViewModel;
private ActivityLoginBinding mBinding;
public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, LoginActivity.class);
return intent;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mViewModel.attachView(this);
}
@Override
public void initComponent() {
activityComponent().inject(this);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_login);
mBinding.setViewmodel(mViewModel);
setContentView(mBinding.getRoot());
}
@Override
protected void onDestroy() {
mViewModel.detachView();
super.onDestroy();
}
/*****
* MVVM View methods implementation
*****/
@Override
public void closeView() {
finish();
}
@Override
public void goHomeView() {
startActivity(HomeActivity.getStartIntent(mContext));
}
}
|
/*
* Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.concurrent.lock.operations;
import com.hazelcast.concurrent.lock.LockDataSerializerHook;
import com.hazelcast.concurrent.lock.LockStoreImpl;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.spi.BackupAwareOperation;
import com.hazelcast.spi.Notifier;
import com.hazelcast.spi.ObjectNamespace;
import com.hazelcast.spi.Operation;
import com.hazelcast.spi.WaitNotifyKey;
import com.hazelcast.spi.impl.MutatingOperation;
import java.io.IOException;
import static java.lang.Boolean.TRUE;
public class UnlockOperation extends AbstractLockOperation implements Notifier, BackupAwareOperation, MutatingOperation {
private boolean force;
private boolean shouldNotify;
public UnlockOperation() {
}
public UnlockOperation(ObjectNamespace namespace, Data key, long threadId) {
super(namespace, key, threadId);
}
public UnlockOperation(ObjectNamespace namespace, Data key, long threadId, boolean force) {
super(namespace, key, threadId);
this.force = force;
}
public UnlockOperation(ObjectNamespace namespace, Data key, long threadId, boolean force, long referenceId) {
super(namespace, key, threadId);
this.force = force;
this.setReferenceCallId(referenceId);
}
@Override
public void run() throws Exception {
if (force) {
forceUnlock();
} else {
unlock();
}
}
protected final void unlock() {
LockStoreImpl lockStore = getLockStore();
boolean unlocked = lockStore.unlock(key, getCallerUuid(), threadId, getReferenceCallId());
response = unlocked;
if (!unlocked) {
// we can not check for retry here, hence just throw the exception
String ownerInfo = lockStore.getOwnerInfo(key);
throw new IllegalMonitorStateException("Current thread is not owner of the lock! -> " + ownerInfo);
}
}
protected final void forceUnlock() {
LockStoreImpl lockStore = getLockStore();
response = lockStore.forceUnlock(key);
}
@Override
public void afterRun() throws Exception {
LockStoreImpl lockStore = getLockStore();
AwaitOperation awaitOperation = lockStore.pollExpiredAwaitOp(key);
if (awaitOperation != null) {
awaitOperation.runExpired();
}
shouldNotify = awaitOperation == null;
}
@Override
public Operation getBackupOperation() {
UnlockBackupOperation operation = new UnlockBackupOperation(namespace, key, threadId,
getCallerUuid(), force);
operation.setReferenceCallId(getReferenceCallId());
return operation;
}
@Override
public boolean shouldBackup() {
return TRUE.equals(response);
}
@Override
public boolean shouldNotify() {
return shouldNotify;
}
@Override
public final WaitNotifyKey getNotifiedKey() {
LockStoreImpl lockStore = getLockStore();
return lockStore.getNotifiedKey(key);
}
@Override
public int getId() {
return LockDataSerializerHook.UNLOCK;
}
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeBoolean(force);
}
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
force = in.readBoolean();
}
}
|
package hr.fer.zemris.calcite.rewriter;
import org.apache.calcite.schema.SchemaFactory;
/**
* Hello world!
*
*/
public class JDBCProxy
{
public static void main( String[] args )
{
System.out.println( args[0] );
}
}
|
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package com.jeesite.modules.aa.service;
import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.aa.dao.PaperDao;
import com.jeesite.modules.aa.entity.CarInfo;
import com.jeesite.modules.aa.entity.Paper;
import com.jeesite.modules.aa.vo.HomePageVO;
import com.jeesite.modules.common.entity.Exam;
import com.jeesite.modules.common.service.ExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 试卷Service
* @author lvchangwei
* @version 2019-07-16
*/
@Service
@Transactional(readOnly=true)
public class PaperService extends CrudService<PaperDao, Paper> {
@Autowired
private PaperDao paperDao;
@Autowired
private ExamService examService;
/**
* 获取单条数据
* @param paper
* @return
*/
@Override
public Paper get(Paper paper) {
return super.get(paper);
}
/**
* 查询分页数据
* @param paper 查询条件
* @return
*/
@Override
public Page<Paper> findPage(Paper paper) {
return super.findPage(paper);
}
/**
* 保存数据(插入或更新)
* @param paper
*/
@Override
@Transactional(readOnly=false)
public void save(Paper paper) {
super.save(paper);
}
/**
* 更新状态
* @param paper
*/
@Override
@Transactional(readOnly=false)
public void updateStatus(Paper paper) {
super.updateStatus(paper);
}
/**
* 删除数据
* @param paper
*/
@Override
@Transactional(readOnly=false)
public void delete(Paper paper) {
super.delete(paper);
}
/**
* 查询试卷列表
* @return
*/
public List<Paper> findPaper(Paper paper) {
return paperDao.findPaper(paper);
}
/**
* 加载首页界面(教师端)
*/
public List<CarInfo> loadHomePageTea(HomePageVO homePageVO) {
Map<String,String> hs = new HashMap<>();
hs.put("queryCriteria",homePageVO.getQueryCriteria());
hs.put("sort",homePageVO.getSort());
return paperDao.findPaperBySortTea(hs);
}
/**
* @description: 加载考试信息
* @param: [exam]
* @return: com.jeesite.modules.common.entity.Exam
* @author: Jiangyf
* @date: 2019/8/10
* @time: 16:37
*/
public List<Exam> findExamForCheck(Exam exam) {
return examService.findExamForCheck(exam);
}
public List<Paper> selectExamPaperList(Paper paper) {
return dao.selectExamPaperList(paper);
}
@Transactional
public void deletePaper(String id) {
String[] idList = id.split(",");
dao.deletePaper(idList);
}
}
|
package cc.shinichi.library.view.listener;
import android.view.View;
/**
* @author 工藤
* @email gougou@16fan.com
* cc.shinichi.library.view.listener
* create at 2018/12/19 16:24
* description:
*/
public interface OnBigImageLongClickListener {
/**
* 长按事件
*/
boolean onLongClick(View view, int position);
}
|
/**
*
*/
package com.jeesuite.springboot.starter.cache;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* @description <br>
* @author <a href="mailto:vakinge@gmail.com">vakin</a>
* @date 2016年12月31日
*/
@ConfigurationProperties(prefix="jeesuite.cache")
public class CacheProperties {
private String groupName;
private String mode;
private String servers;
private String password;
private int database;
private int maxPoolSize;
private int maxPoolIdle;
private int minPoolIdle;
private long maxPoolWaitMillis;
private String masterName;
private boolean tenantModeEnabled;
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getServers() {
return servers;
}
public void setServers(String servers) {
this.servers = servers;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getDatabase() {
return database;
}
public void setDatabase(int database) {
this.database = database;
}
public int getMaxPoolSize() {
return maxPoolSize;
}
public void setMaxPoolSize(int maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
public int getMaxPoolIdle() {
return maxPoolIdle;
}
public void setMaxPoolIdle(int maxPoolIdle) {
this.maxPoolIdle = maxPoolIdle;
}
public int getMinPoolIdle() {
return minPoolIdle;
}
public void setMinPoolIdle(int minPoolIdle) {
this.minPoolIdle = minPoolIdle;
}
public long getMaxPoolWaitMillis() {
return maxPoolWaitMillis;
}
public void setMaxPoolWaitMillis(long maxPoolWaitMillis) {
this.maxPoolWaitMillis = maxPoolWaitMillis;
}
public String getMasterName() {
return masterName;
}
public void setMasterName(String masterName) {
this.masterName = masterName;
}
public boolean isTenantModeEnabled() {
return tenantModeEnabled;
}
public void setTenantModeEnabled(boolean tenantModeEnabled) {
this.tenantModeEnabled = tenantModeEnabled;
}
}
|
package edu.stanford.nlp.parser.lexparser;
import edu.stanford.nlp.ling.TaggedWord;
import edu.stanford.nlp.ling.LabeledWord;
import edu.stanford.nlp.io.NumberRangesFileFilter;
import edu.stanford.nlp.io.EncodingPrintWriter;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.Treebank;
import edu.stanford.nlp.trees.DiskTreebank;
import edu.stanford.nlp.trees.TreebankLanguagePack;
import edu.stanford.nlp.stats.ClassicCounter;
import edu.stanford.nlp.stats.Counters;
import edu.stanford.nlp.util.ErasureUtils;
import edu.stanford.nlp.util.Numberer;
import edu.stanford.nlp.util.StringUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.text.NumberFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/**
* This is the default concrete instantiation of the Lexicon interface. It was
* originally built for Penn Treebank English.
*
* @author Dan Klein
* @author Galen Andrew
* @author Christopher Manning
*/
public class BaseLexicon implements Lexicon {
protected UnknownWordModel uwModel;
protected static final boolean DEBUG_LEXICON = false;
protected static final boolean DEBUG_LEXICON_SCORE = false;
protected static final int nullWord = -1;
protected static final short nullTag = -1;
/**
* If a word has been seen more than this many times, then relative
* frequencies of tags are used for POS assignment; if not, they are smoothed
* with tag priors.
*/
protected int smoothInUnknownsThreshold;
/**
* Have tags changeable based on statistics on word types having various
* taggings.
*/
protected boolean smartMutation;
/** An array of Lists of rules (IntTaggedWord), indexed by word. */
public transient List<IntTaggedWord>[] rulesWithWord;
// protected transient Set<IntTaggedWord> rules = new
// HashSet<IntTaggedWord>();
// When it existed, rules somehow held a few less things than rulesWithWord
// I never figured out why [cdm, Dec 2004]
/** Set of all tags as IntTaggedWord. Alive in both train and runtime
* phases, but transient.
*/
protected transient Set<IntTaggedWord> tags = new HashSet<IntTaggedWord>();
protected transient Set<IntTaggedWord> words = new HashSet<IntTaggedWord>();
// protected transient Set<IntTaggedWord> sigs=new HashSet<IntTaggedWord>();
/** Records the number of times word/tag pair was seen in training data.
* Includes word/tag pairs where one is a wildcard not a real word/tag.
*/
public ClassicCounter<IntTaggedWord> seenCounter = new ClassicCounter<IntTaggedWord>();
/**
* We cache the last signature looked up, because it asks for the same one
* many times when an unknown word is encountered! (Note that under the
* current scheme, one unknown word, if seen sentence-initially and
* non-initially, will be parsed with two different signatures....)
*/
protected transient int lastSignatureIndex = -1;
protected transient int lastSentencePosition = -1;
protected transient int lastWordToSignaturize = -1;
double[] smooth = { 1.0, 1.0 };
// these next two are used for smartMutation calculation
transient double[][] m_TT; // = null;
transient double[] m_T; // = null;
private boolean flexiTag;
private boolean useSignatureForKnownSmoothing;
public BaseLexicon() {
this(new Options.LexOptions());
}
public BaseLexicon(Options.LexOptions op) {
flexiTag = op.flexiTag;
useSignatureForKnownSmoothing = op.useSignatureForKnownSmoothing;
this.smoothInUnknownsThreshold = op.smoothInUnknownsThreshold;
this.smartMutation = op.smartMutation;
// Construct UnknownWordModel by reflection -- a right pain
// Lexicons and UnknownWordModels aren't very well encapsulated from each other!
if (op.uwModel == null) {
op.uwModel = "edu.stanford.nlp.parser.lexparser.BaseUnknownWordModel";
}
try {
Class<?> clas = Class.forName(op.uwModel);
Class<?>[] argClasses = new Class<?>[2];
argClasses[0] = Options.LexOptions.class;
argClasses[1] = Lexicon.class;
Object[] args = new Object[2];
args[0] = op;
args[1] = this;
Constructor<?> constr = clas.getConstructor(argClasses);
uwModel = (UnknownWordModel) constr.newInstance(args);
} catch (ClassNotFoundException e) {
System.err.println("Class not found: " + op.uwModel);
e.printStackTrace();
} catch (NoSuchMethodException nsme) {
System.err.println("Can't construct: " + op.uwModel);
nsme.printStackTrace();
} catch (InvocationTargetException ite) {
System.err.println("Can't construct: " + op.uwModel);
ite.printStackTrace();
} catch (InstantiationException e) {
System.err.println("Couldn't instantiate: " + op.uwModel);
e.printStackTrace();
} catch (IllegalAccessException e) {
System.err.println("Illegal access to " + op.uwModel);
e.printStackTrace();
} finally {
if (uwModel == null) {
uwModel = new BaseUnknownWordModel(op, this);
}
}
}
/**
* Checks whether a word is in the lexicon. This version will compile the
* lexicon into the rulesWithWord array, if that hasn't already happened
*
* @param word The word as an int index to a Numberer
* @return Whether the word is in the lexicon
*/
public boolean isKnown(int word) {
if (rulesWithWord == null) {
initRulesWithWord();
}
return (word < rulesWithWord.length && ! rulesWithWord[word].isEmpty());
}
/**
* Checks whether a word is in the lexicon. This version works even while
* compiling lexicon with current counters (rather than using the compiled
* rulesWithWord array).
*
* @param word The word as a String
* @return Whether the word is in the lexicon
*/
public boolean isKnown(String word) {
IntTaggedWord iW = new IntTaggedWord(wordNumberer().number(word), nullTag);
return seenCounter.getCount(iW) > 0.0;
}
/**
* Returns the possible POS taggings for a word.
*
* @param word The word, represented as an integer in Numberer
* @param loc The position of the word in the sentence (counting from 0).
* <i>Implementation note: The BaseLexicon class doesn't actually
* make use of this position information.</i>
* @return An Iterator over a List ofIntTaggedWords, which pair the word with
* possible taggings as integer pairs. (Each can be thought of as a
* <code>tag -> word<code> rule.)
*/
public Iterator<IntTaggedWord> ruleIteratorByWord(String word, int loc) {
return ruleIteratorByWord(wordNumberer().number(word), loc);
}
/** Generate the possible taggings for a word at a sentence position.
* This may either be based on a strict lexicon or an expanded generous
* set of possible taggings. <p>
* <i>Implementation note:</i> Expanded sets of possible taggings are
* calculated dynamically at runtime, so as to reduce the memory used by
* the lexicon (a space/time tradeoff).
*
* @param word The word (as an int)
* @param loc Its index in the sentence (usually only relevant for unknown words)
* @return A list of possible taggings
*/
public Iterator<IntTaggedWord> ruleIteratorByWord(int word, int loc) {
// if (rulesWithWord == null) { // tested in isKnown already
// initRulesWithWord();
// }
List<IntTaggedWord> wordTaggings;
if (isKnown(word)) {
if ( ! flexiTag) {
// Strict lexical tagging for seen items
wordTaggings = rulesWithWord[word];
} else {
/* Allow all tags with same basicCategory */
/* Allow all scored taggings, unless very common */
IntTaggedWord iW = new IntTaggedWord(word, nullTag);
if (seenCounter.getCount(iW) > smoothInUnknownsThreshold) {
return rulesWithWord[word].iterator();
} else {
// give it flexible tagging not just lexicon
wordTaggings = new ArrayList<IntTaggedWord>(40);
for (IntTaggedWord iTW2 : tags) {
IntTaggedWord iTW = new IntTaggedWord(word, iTW2.tag);
if (score(iTW, loc) > Float.NEGATIVE_INFINITY) {
wordTaggings.add(iTW);
}
}
}
}
} else {
// we copy list so we can insert correct word in each item
wordTaggings = new ArrayList<IntTaggedWord>(40);
for (IntTaggedWord iTW : rulesWithWord[wordNumberer.number(UNKNOWN_WORD)]) {
wordTaggings.add(new IntTaggedWord(word, iTW.tag));
}
}
if (DEBUG_LEXICON) {
EncodingPrintWriter.err.println("Lexicon: " + wordNumberer().object(word) + " (" +
(isKnown(word) ? "known": "unknown") + ", loc=" + loc + ", n=" +
(isKnown(word) ? word: wordNumberer.number(UNKNOWN_WORD)) + ") " +
(flexiTag ? "flexi": "lexicon") + " taggings: " + wordTaggings, "UTF-8");
}
return wordTaggings.iterator();
}
protected void initRulesWithWord() {
if (Test.verbose || DEBUG_LEXICON) {
System.err.print("\nInitializing lexicon scores ... ");
}
// int numWords = words.size()+sigs.size()+1;
int unkWord = wordNumberer().number(UNKNOWN_WORD);
int numWords = wordNumberer().total();
rulesWithWord = new List[numWords];
for (int w = 0; w < numWords; w++) {
rulesWithWord[w] = new ArrayList<IntTaggedWord>(1); // most have 1 or 2
// items in them
}
// for (Iterator ruleI = rules.iterator(); ruleI.hasNext();) {
tags = new HashSet<IntTaggedWord>();
for (IntTaggedWord iTW : seenCounter.keySet()) {
if (iTW.word() == nullWord && iTW.tag() != nullTag) {
tags.add(iTW);
}
}
// tags for unknown words
if (DEBUG_LEXICON) {
System.err.println("Lexicon initializing tags for UNKNOWN WORD (" +
Lexicon.UNKNOWN_WORD + ", " + unkWord + ')');
}
if (DEBUG_LEXICON) System.err.println("unSeenCounter is: " + uwModel.unSeenCounter());
if (DEBUG_LEXICON) System.err.println("Train.openClassTypesThreshold is " + Train.openClassTypesThreshold);
for (IntTaggedWord iT : tags) {
if (DEBUG_LEXICON) System.err.println("Entry for " + iT + " is " + uwModel.unSeenCounter().getCount(iT));
double types = uwModel.unSeenCounter().getCount(iT);
if (types > Train.openClassTypesThreshold) {
// Number of types before it's treated as open class
IntTaggedWord iTW = new IntTaggedWord(unkWord, iT.tag);
rulesWithWord[iTW.word].add(iTW);
}
}
if (Test.verbose || DEBUG_LEXICON) {
System.err.print("The " + rulesWithWord[unkWord].size() + " open class tags are: [");
for (IntTaggedWord item : rulesWithWord[unkWord]) {
System.err.print(" " + tagNumberer().object(item.tag()));
if (DEBUG_LEXICON) {
IntTaggedWord iTprint = new IntTaggedWord(nullWord, item.tag);
System.err.print(" (tag " + item.tag() + ", type count is " +
uwModel.unSeenCounter().getCount(iTprint) + ')');
}
}
System.err.println(" ] ");
}
for (IntTaggedWord iTW : seenCounter.keySet()) {
if (iTW.tag() != nullTag && iTW.word() != nullWord) {
rulesWithWord[iTW.word].add(iTW);
}
}
}
protected List<IntTaggedWord> treeToEvents(Tree tree, boolean keepTagsAsLabels) {
if (!keepTagsAsLabels) { return treeToEvents(tree); }
List<LabeledWord> labeledWords = tree.labeledYield();
// for (LabeledWord tw : labeledWords) {
// System.err.println(tw);
// }
return listOfLabeledWordsToEvents(labeledWords);
}
protected List<IntTaggedWord> treeToEvents(Tree tree) {
List<TaggedWord> taggedWords = tree.taggedYield();
return listToEvents(taggedWords);
}
protected List<IntTaggedWord> listToEvents(List<TaggedWord> taggedWords) {
List<IntTaggedWord> itwList = new ArrayList<IntTaggedWord>();
for (TaggedWord tw : taggedWords) {
IntTaggedWord iTW = new IntTaggedWord(wordNumberer().number(tw.word()),
tagNumberer().number(tw.tag()));
itwList.add(iTW);
}
return itwList;
}
protected List<IntTaggedWord> listOfLabeledWordsToEvents(List<LabeledWord> taggedWords) {
List<IntTaggedWord> itwList = new ArrayList<IntTaggedWord>();
for (LabeledWord tw : taggedWords) {
IntTaggedWord iTW = new IntTaggedWord(wordNumberer().number(tw.word()),
tagNumberer().number(tw.tag()));
itwList.add(iTW);
}
return itwList;
}
/** Not yet implemented. */
public void addAll(List<TaggedWord> tagWords) {
addAll(tagWords, 1.0);
}
/** Not yet implemented. */
public void addAll(List<TaggedWord> taggedWords, double weight) {
List<IntTaggedWord> tagWords = listToEvents(taggedWords);
}
/** Not yet implemented. */
public void trainWithExpansion(Collection<TaggedWord> taggedWords) {
}
/**
* Trains this lexicon on the Collection of trees.
*/
public void train(Collection<Tree> trees) {
train(trees, 1.0, false);
}
/**
* Trains this lexicon on the Collection of trees.
*/
public void train(Collection<Tree> trees, boolean keepTagsAsLabels) {
train(trees, 1.0, keepTagsAsLabels);
}
public void train(Collection<Tree> trees, double weight) {
train(trees, weight, false);
}
/**
* Trains this lexicon on the Collection of trees.
* Also trains the unknown word model pointed to by this lexicon.
*/
public void train(Collection<Tree> trees, double weight, boolean keepTagsAsLabels) {
getUnknownWordModel().train(trees);
// scan data
for (Tree tree : trees) {
List<IntTaggedWord> taggedWords = treeToEvents(tree, keepTagsAsLabels);
for (int w = 0, sz = taggedWords.size(); w < sz; w++) {
IntTaggedWord iTW = taggedWords.get(w);
seenCounter.incrementCount(iTW, weight);
IntTaggedWord iT = new IntTaggedWord(nullWord, iTW.tag);
seenCounter.incrementCount(iT, weight);
IntTaggedWord iW = new IntTaggedWord(iTW.word, nullTag);
seenCounter.incrementCount(iW, weight);
IntTaggedWord i = new IntTaggedWord(nullWord, nullTag);
seenCounter.incrementCount(i, weight);
// rules.add(iTW);
tags.add(iT);
words.add(iW);
}
}
// index the possible tags for each word
// numWords = wordNumberer.total();
// unknownWordIndex = Numberer.number("words",Lexicon.UNKNOWN_WORD);
// initRulesWithWord();
tune(trees);
if (DEBUG_LEXICON) {
printLexStats();
}
}
/**
* Adds the tagging with count to the data structures in this Lexicon.
*/
protected void addTagging(boolean seen, IntTaggedWord itw, double count) {
if (seen) {
seenCounter.incrementCount(itw, count);
if (itw.tag() == nullTag) {
words.add(itw);
} else if (itw.word() == nullWord) {
tags.add(itw);
} else {
// rules.add(itw);
}
} else {
uwModel.addTagging(seen, itw, count);
// if (itw.tag() == nullTag) {
// sigs.add(itw);
// }
}
}
/**
* This records how likely it is for a word with one tag to also have another
* tag. This won't work after serialization/deserialization, but that is how
* it is currently called....
*/
void buildPT_T() {
int numTags = tagNumberer().total();
m_TT = new double[numTags][numTags];
m_T = new double[numTags];
double[] tmp = new double[numTags];
for (IntTaggedWord word : words) {
IntTaggedWord iTW = new IntTaggedWord(word.word, nullTag);
double tot = 0.0;
for (int t = 0; t < numTags; t++) {
iTW.tag = (short) t;
tmp[t] = seenCounter.getCount(iTW);
tot += tmp[t];
}
if (tot < 10) {
continue;
}
for (int t = 0; t < numTags; t++) {
for (int t2 = 0; t2 < numTags; t2++) {
if (tmp[t2] > 0.0) {
double c = tmp[t] / tot;
m_T[t] += c;
m_TT[t2][t] += c;
}
}
}
}
}
/**
* Get the score of this word with this tag (as an IntTaggedWord) at this
* location. (Presumably an estimate of P(word | tag).)
* <p>
* <i>Implementation documentation:</i>
* Seen:
* c_W = count(W) c_TW = count(T,W)
* c_T = count(T) c_Tunseen = count(T) among new words in 2nd half
* total = count(seen words) totalUnseen = count("unseen" words)
* p_T_U = Pmle(T|"unseen")
* pb_T_W = P(T|W). If (c_W > smoothInUnknownsThreshold) = c_TW/c_W
* Else (if not smart mutation) pb_T_W = bayes prior smooth[1] with p_T_U
* p_T= Pmle(T) p_W = Pmle(W)
* pb_W_T = log(pb_T_W * p_W / p_T) [Bayes rule]
* Note that this doesn't really properly reserve mass to unknowns.
*
* Unseen:
* c_TS = count(T,Sig|Unseen) c_S = count(Sig) c_T = count(T|Unseen)
* c_U = totalUnseen above
* p_T_U = Pmle(T|Unseen)
* pb_T_S = Bayes smooth of Pmle(T|S) with P(T|Unseen) [smooth[0]]
* pb_W_T = log(P(W|T)) inverted
*
* @param iTW An IntTaggedWord pairing a word and POS tag
* @param loc The position in the sentence. <i>In the default implementation
* this is used only for unknown words to change their probability
* distribution when sentence initial</i>
* @return A float score, usually, log P(word|tag)
*/
public float score(IntTaggedWord iTW, int loc) {
int word = iTW.word;
short tag = iTW.tag;
// both actual
double c_TW = seenCounter.getCount(iTW);
// double x_TW = xferCounter.getCount(iTW);
iTW.tag = nullTag;
// word counts
double c_W = seenCounter.getCount(iTW);
// double x_W = xferCounter.getCount(iTW);
iTW.word = nullWord;
// totals
double total = seenCounter.getCount(iTW);
double totalUnseen = uwModel.unSeenCounter().getCount(iTW);
iTW.tag = tag;
// tag counts
double c_T = seenCounter.getCount(iTW);
double c_Tunseen = uwModel.unSeenCounter().getCount(iTW);
iTW.word = word;
double pb_W_T; // always set below
if (DEBUG_LEXICON) {
// dump info about last word
if (iTW.word != debugLastWord) {
if (debugLastWord >= 0 && debugPrefix != null) {
// the 2nd conjunct in test above handles older serialized files
EncodingPrintWriter.err.println(debugPrefix + debugProbs + debugNoProbs, "UTF-8");
}
}
}
boolean seen = (c_W > 0.0);
if (seen) {
// known word model for P(T|W)
if (DEBUG_LEXICON_SCORE) {
System.err.println("Lexicon.score " + wordNumberer().object(word) + "/" + tagNumberer.object(tag) + " as known word.");
}
// c_TW = Math.sqrt(c_TW); [cdm: funny math scaling? dunno who played with this]
// c_TW += 0.5;
double p_T_U;
if (useSignatureForKnownSmoothing) { // only works for English currently
p_T_U = getUnknownWordModel().scoreProbTagGivenWordSignature(iTW, loc, smooth[0]);
if (DEBUG_LEXICON_SCORE) System.err.println("With useSignatureForKnownSmoothing, P(T|U) is " + p_T_U + " rather than " + (c_Tunseen / totalUnseen));
} else {
p_T_U = c_Tunseen / totalUnseen;
}
double pb_T_W; // always set below
if (DEBUG_LEXICON_SCORE) {
System.err.println("c_W is " + c_W + " mle = " + (c_TW/c_W)+ " smoothInUnknownsThresh is " +
smoothInUnknownsThreshold + " base p_T_U is " + c_Tunseen + "/" + totalUnseen + " = " + p_T_U);
}
if (c_W > smoothInUnknownsThreshold) {
// we've seen the word enough times to have confidence in its tagging
pb_T_W = c_TW / c_W;
} else {
// we haven't seen the word enough times to have confidence in its
// tagging
if (smartMutation) {
int numTags = tagNumberer().total();
if (m_TT == null || numTags != m_T.length) {
buildPT_T();
}
p_T_U *= 0.1;
// System.out.println("Checking "+iTW);
for (int t = 0; t < numTags; t++) {
IntTaggedWord iTW2 = new IntTaggedWord(word, t);
double p_T_W2 = seenCounter.getCount(iTW2) / c_W;
if (p_T_W2 > 0) {
// System.out.println(" Observation of "+tagNumberer.object(t)+"
// ("+seenCounter.getCount(iTW2)+") mutated to
// "+tagNumberer.object(iTW.tag)+" at rate
// "+(m_TT[tag][t]/m_T[t]));
p_T_U += p_T_W2 * m_TT[tag][t] / m_T[t] * 0.9;
}
}
}
if (DEBUG_LEXICON_SCORE) {
System.err.println("c_TW = " + c_TW + " c_W = " + c_W +
" p_T_U = " + p_T_U);
}
// double pb_T_W = (c_TW+smooth[1]*x_TW)/(c_W+smooth[1]*x_W);
pb_T_W = (c_TW + smooth[1] * p_T_U) / (c_W + smooth[1]);
}
double p_T = (c_T / total);
double p_W = (c_W / total);
pb_W_T = Math.log(pb_T_W * p_W / p_T);
if (DEBUG_LEXICON) {
if (iTW.word != debugLastWord) {
debugLastWord = iTW.word;
debugLoc = loc;
debugProbs = new StringBuilder();
debugNoProbs = new StringBuilder("impossible: ");
debugPrefix = "Lexicon: " + wordNumberer().object(debugLastWord) + " (known): ";
}
if (pb_W_T > Double.NEGATIVE_INFINITY) {
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(3);
debugProbs.append(tagNumberer().object(tag) + ": cTW=" + c_TW + " c_T=" + c_T
+ " pb_T_W=" + nf.format(pb_T_W) + " log pb_W_T=" + nf.format(pb_W_T)
+ ", ");
// debugProbs.append("\n" + "smartMutation=" + smartMutation + "
// smoothInUnknownsThreshold=" + smoothInUnknownsThreshold + "
// smooth0=" + smooth[0] + "smooth1=" + smooth[1] + " p_T_U=" + p_T_U
// + " c_W=" + c_W);
} else {
debugNoProbs.append(tagNumberer().object(tag)).append(' ');
}
} // end if (DEBUG_LEXICON)
} else { // when unseen
if (loc >= 0) {
pb_W_T = getUnknownWordModel().score(iTW, loc, c_T, total, smooth[0]);
} else {
// For negative we now do a weighted average for the dependency grammar :-)
double pb_W0_T = getUnknownWordModel().score(iTW, 0, c_T, total, smooth[0]);
double pb_W1_T = getUnknownWordModel().score(iTW, 1, c_T, total, smooth[0]);
pb_W_T = Math.log((Math.exp(pb_W0_T) + 2 * Math.exp(pb_W1_T))/3);
}
}
// Categorical cutoff if score is too low
if (pb_W_T > -100.0) {
return (float) pb_W_T;
}
return Float.NEGATIVE_INFINITY;
} // end score()
private transient int debugLastWord = -1;
private transient int debugLoc = -1;
private transient StringBuilder debugProbs;
private transient StringBuilder debugNoProbs;
private transient String debugPrefix;
public void tune(Collection<Tree> trees) {
double bestScore = Double.NEGATIVE_INFINITY;
double[] bestSmooth = { 0.0, 0.0 };
for (smooth[0] = 1; smooth[0] <= 1; smooth[0] *= 2.0) {// 64
for (smooth[1] = 0.2; smooth[1] <= 0.2; smooth[1] *= 2.0) {// 3
// for (smooth[0]=0.5; smooth[0]<=64; smooth[0] *= 2.0) {//64
// for (smooth[1]=0.1; smooth[1]<=12.8; smooth[1] *= 2.0) {//3
double score = 0.0;
// score = scoreAll(trees);
if (Test.verbose) {
System.out.println("Tuning lexicon: s0 " + smooth[0] + " s1 " + smooth[1] + " is "
+ score + ' ' + trees.size() + " trees.");
}
if (score > bestScore) {
System.arraycopy(smooth, 0, bestSmooth, 0, smooth.length);
bestScore = score;
}
}
}
System.arraycopy(bestSmooth, 0, smooth, 0, bestSmooth.length);
if (smartMutation) {
smooth[0] = 8.0;
// smooth[1] = 1.6;
// smooth[0] = 0.5;
smooth[1] = 0.1;
}
if (Test.unseenSmooth > 0.0) {
smooth[0] = Test.unseenSmooth;
}
if (Test.verbose) {
System.out.println("Tuning selected smoothUnseen " + smooth[0] + " smoothSeen " + smooth[1]
+ " at " + bestScore);
}
}
/**
* Populates data in this Lexicon from the character stream given by the
* Reader r.
*/
public void readData(BufferedReader in) throws IOException {
final String SEEN = "SEEN";
String line;
int lineNum = 1;
// all lines have one tagging with raw count per line
line = in.readLine();
Pattern p = Pattern.compile("^smooth\\[([0-9])\\] = (.*)$");
while (line != null && line.length() > 0) {
try {
Matcher m = p.matcher(line);
if (m.matches()) {
int i = Integer.parseInt(m.group(1));
smooth[i] = Double.parseDouble(m.group(2));
} else {
// split on spaces, quote with doublequote, and escape with backslash
String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\');
// System.out.println("fields:\n" + fields[0] + "\n" + fields[1] +
// "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4]);
boolean seen = fields[3].equals(SEEN);
addTagging(seen, new IntTaggedWord(fields[2], fields[0]), Double.parseDouble(fields[4]));
}
} catch (RuntimeException e) {
throw new IOException("Error on line " + lineNum + ": " + line);
}
lineNum++;
line = in.readLine();
}
}
/**
* Writes out data from this Object to the Writer w. Rules are separated by
* newline, and rule elements are delimited by \t.
*/
public void writeData(Writer w) throws IOException {
PrintWriter out = new PrintWriter(w);
for (IntTaggedWord itw : seenCounter.keySet()) {
out.println(itw.toLexicalEntry() + " SEEN " + seenCounter.getCount(itw));
}
for (IntTaggedWord itw : getUnknownWordModel().unSeenCounter().keySet()) {
out.println(itw.toLexicalEntry() + " UNSEEN " + getUnknownWordModel().unSeenCounter().getCount(itw));
}
for (int i = 0; i < smooth.length; i++) {
out.println("smooth[" + i + "] = " + smooth[i]);
}
out.flush();
}
/** Returns the number of rules (tag rewrites as word) in the Lexicon.
* This method assumes that the lexicon has been initialized.
*/
public int numRules() {
if (rulesWithWord == null) {
initRulesWithWord();
}
int accumulated = 0;
for (List<IntTaggedWord> lis : rulesWithWord) {
accumulated += lis.size();
}
return accumulated;
}
private static final int STATS_BINS = 15;
/** Print some statistics about this lexicon. */
public void printLexStats() {
if (rulesWithWord == null) {
initRulesWithWord();
}
System.out.println("BaseLexicon statistics");
System.out.println("unknownLevel is " + getUnknownWordModel().getUnknownLevel());
// System.out.println("Rules size: " + rules.size());
System.out.println("Sum of rulesWithWord: " + numRules());
System.out.println("Tags size: " + tags.size());
int wsize = words.size();
System.out.println("Words size: " + wsize);
// System.out.println("Unseen Sigs size: " + sigs.size() +
// " [number of unknown equivalence classes]");
System.out.println("rulesWithWord length: " + rulesWithWord.length
+ " [should be sum of words + unknown sigs]");
int[] lengths = new int[STATS_BINS];
ArrayList[] wArr = new ArrayList[STATS_BINS];
for (int j = 0; j < STATS_BINS; j++) {
wArr[j] = new ArrayList();
}
for (int i = 0; i < rulesWithWord.length; i++) {
int num = rulesWithWord[i].size();
if (num > STATS_BINS - 1) {
num = STATS_BINS - 1;
}
lengths[num]++;
if (wsize <= 20 || num >= STATS_BINS / 2) {
wArr[num].add(wordNumberer().object(i));
}
}
System.out.println("Stats on how many taggings for how many words");
for (int j = 0; j < STATS_BINS; j++) {
System.out.print(j + " taggings: " + lengths[j] + " words ");
if (wsize <= 20 || j >= STATS_BINS / 2) {
System.out.print(wArr[j]);
}
System.out.println();
}
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(0);
System.out.println("Unseen counter: " + Counters.toString(uwModel.unSeenCounter(), nf));
if (wsize < 50 && tags.size() < 10) {
nf.setMaximumFractionDigits(3);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("Tagging probabilities log P(word|tag)");
for (int t = 0; t < tags.size(); t++) {
pw.print('\t');
pw.print(tagNumberer.object(t));
}
pw.println();
for (int w = 0; w < wsize; w++) {
pw.print(wordNumberer.object(w));
pw.print('\t');
for (int t = 0; t < tags.size(); t++) {
IntTaggedWord iTW = new IntTaggedWord(w, t);
pw.print(nf.format(score(iTW, 1)));
if (t == tags.size() -1) {
pw.println();
} else
pw.print('\t');
}
}
pw.close();
System.out.println(sw.toString());
}
}
/**
* Evaluates how many words (= terminals) in a collection of trees are
* covered by the lexicon. First arg is the collection of trees; second
* through fourth args get the results. Currently unused; this probably
* only works if train and test at same time so tags and words variables
* are initialized.
*/
public double evaluateCoverage(Collection<Tree> trees, Set<String> missingWords,
Set<String> missingTags, Set<IntTaggedWord> missingTW) {
List<IntTaggedWord> iTW1 = new ArrayList<IntTaggedWord>();
for (Tree t : trees) {
iTW1.addAll(treeToEvents(t));
}
int total = 0;
int unseen = 0;
for (IntTaggedWord itw : iTW1) {
total++;
if (!words.contains(new IntTaggedWord(itw.word(), nullTag))) {
missingWords.add((String) Numberer.object("word", itw.word()));
}
if (!tags.contains(new IntTaggedWord(nullWord, itw.tag()))) {
missingTags.add((String) Numberer.object("tag", itw.tag()));
}
// if (!rules.contains(itw)) {
if (seenCounter.getCount(itw) == 0.0) {
unseen++;
missingTW.add(itw);
}
}
return (double) unseen / total;
}
private static final long serialVersionUID = 40L;
int[] tagsToBaseTags = null;
public int getBaseTag(int tag, TreebankLanguagePack tlp) {
if (tagsToBaseTags == null) {
populateTagsToBaseTags(tlp);
}
return tagsToBaseTags[tag];
}
private void populateTagsToBaseTags(TreebankLanguagePack tlp) {
Numberer tagNumberer = tagNumberer();
int total = tagNumberer.total();
tagsToBaseTags = new int[total];
for (int i = 0; i < total; i++) {
String tag = (String) tagNumberer.object(i);
String baseTag = tlp.basicCategory(tag);
int j = tagNumberer.number(baseTag);
tagsToBaseTags[i] = j;
}
}
/** Provides some testing and opportunities for exploration of the
* probabilities of a BaseLexicon. What's here currently probably
* only works for the English Penn Treeebank, as it uses default
* constructors. Of the words given to test on,
* the first is treated as sentence initial, and the rest as not
* sentence initial.
*
* @param args The command line arguments:
* java BaseLexicon treebankPath fileRange unknownWordModel words*
*/
public static void main(String[] args) {
if (args.length < 3) {
System.err.println("java BaseLexicon treebankPath fileRange unknownWordModel words*");
return;
}
System.out.print("Training BaseLexicon from " + args[0] + ' ' + args[1] + " ... ");
Treebank tb = new DiskTreebank();
tb.loadPath(args[0], new NumberRangesFileFilter(args[1], true));
BaseLexicon lex = new BaseLexicon();
lex.getUnknownWordModel().setUnknownLevel(Integer.parseInt(args[2]));
lex.train(tb);
System.out.println("done.");
System.out.println();
Numberer numb = Numberer.getGlobalNumberer("tags");
Numberer wNumb = Numberer.getGlobalNumberer("words");
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(4);
List<String> impos = new ArrayList<String>();
for (int i = 3; i < args.length; i++) {
if (lex.isKnown(args[i])) {
System.out.println(args[i] + " is a known word. Log probabilities [log P(w|t)] for its taggings are:");
for (Iterator<IntTaggedWord> it = lex.ruleIteratorByWord(wNumb.number(args[i]), i - 3); it.hasNext(); ) {
IntTaggedWord iTW = it.next();
System.out.println(StringUtils.pad(iTW, 24) + nf.format(lex.score(iTW, i - 3)));
}
} else {
String sig = lex.getUnknownWordModel().getSignature(args[i], i-3);
System.out.println(args[i] + " is an unknown word. Signature with uwm " + lex.getUnknownWordModel().getUnknownLevel() + ((i == 3) ? " init": "non-init") + " is: " + sig);
Set<String> tags = ErasureUtils.uncheckedCast(numb.objects());
impos.clear();
List<String> lis = new ArrayList<String>(tags);
Collections.sort(lis);
for (String tStr : lis) {
IntTaggedWord iTW = new IntTaggedWord(args[i], tStr);
double score = lex.score(iTW, 1);
if (score == Float.NEGATIVE_INFINITY) {
impos.add(tStr);
} else {
System.out.println(StringUtils.pad(iTW, 24) + nf.format(score));
}
}
if (impos.size() > 0) {
System.out.println(args[i] + " impossible tags: " + impos);
}
}
System.out.println();
}
}
private transient Numberer tagNumberer;
private Numberer tagNumberer() {
if (tagNumberer == null) {
tagNumberer = Numberer.getGlobalNumberer("tags");
}
return tagNumberer;
}
private transient Numberer wordNumberer;
private Numberer wordNumberer() {
if (wordNumberer == null) {
wordNumberer = Numberer.getGlobalNumberer("words");
}
return wordNumberer;
}
public void setWordNumberer(Numberer wordNumberer) {
this.wordNumberer = wordNumberer;
IntTaggedWord.setWordNumberer(wordNumberer);
}
public void setTagNumberer(Numberer tagNumberer) {
this.tagNumberer = tagNumberer;
IntTaggedWord.setTagNumberer(tagNumberer);
}
public UnknownWordModel getUnknownWordModel() {
return uwModel;
}
public final void setUnknownWordModel(UnknownWordModel uwm) {
this.uwModel = uwm;
}
}
|
package org.apidesign.demo.pythonrubyjs.fromjava;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Source;
public final class Main {
private static void execute(Integer repeat) throws Exception {
// executing ruby currently requires all access flag to be set.
Context vm = Context.newBuilder().allowAllAccess(true).build();
if (repeat != null) {
vm.eval("js", "count=" + repeat);
}
File scriptDir = findScriptDir();
Source python = Source.newBuilder("python", new File(scriptDir, "sieve.py")).build();
Source ruby = Source.newBuilder("ruby", new File(scriptDir, "sieve.rb")).build();
Source js = Source.newBuilder("js", new File(scriptDir, "sieve.js")).build();
vm.eval(python);
vm.eval(ruby);
vm.eval(js);
}
private Main() {
}
public static void main(String[] args) throws Exception {
prologAndEpilog(true);
System.err.println("Setting up PolyglotEngine");
try {
Integer count = null;
if (args.length == 1) {
count = Integer.parseInt(args[0]);
}
execute(count);
} catch (Throwable err) {
System.err.println("Initialization problem " + err.getClass().getName() + ": " + err.getMessage());
System.err.println("Are you running on GraalVM?");
System.err.println("Download from OTN: http://www.oracle.com/technetwork/oracle-labs/program-languages/overview/index.html");
prologAndEpilog(false);
System.exit(1);
}
}
private static void prologAndEpilog(boolean prolog) {
if (!prolog) {
System.err.println("*********************************");
}
System.err.println();
System.err.println();
System.err.println();
System.err.println();
if (prolog) {
System.err.println("*********************************");
}
}
private static File findScriptDir() throws URISyntaxException {
URL url = Main.class.getProtectionDomain().getCodeSource().getLocation();
File local = new File(url.toURI());
for (;;) {
File sieveInRuby = new File(local, "sieve.rb");
if (sieveInRuby.exists()) {
break;
}
local = local.getParentFile();
}
return local;
}
}
|
package com.leetcode;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
/**
* Given a binary tree, determine if it is height-balanced.
*
* @Author: Aaron Yang
* @Date: 9/19/2018 9:21 AM
*/
public class BalancedBinaryTree {
public static TreeNode stringToTreeNode(String input) {
input = input.trim();
input = input.substring(1, input.length() - 1);
if (input.length() == 0) {
return null;
}
String[] parts = input.split(",");
String item = parts[0];
TreeNode root = new TreeNode(Integer.parseInt(item));
Queue<TreeNode> nodeQueue = new LinkedList<>();
nodeQueue.add(root);
int index = 1;
while (!nodeQueue.isEmpty()) {
TreeNode node = nodeQueue.remove();
if (index == parts.length) {
break;
}
item = parts[index++];
item = item.trim();
if (!item.equals("null")) {
int leftNumber = Integer.parseInt(item);
node.left = new TreeNode(leftNumber);
nodeQueue.add(node.left);
}
if (index == parts.length) {
break;
}
item = parts[index++];
item = item.trim();
if (!item.equals("null")) {
int rightNumber = Integer.parseInt(item);
node.right = new TreeNode(rightNumber);
nodeQueue.add(node.right);
}
}
return root;
}
public static String booleanToString(boolean input) {
return input ? "True" : "False";
}
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
while ((line = in.readLine()) != null) {
TreeNode root = stringToTreeNode(line);
boolean ret = new Solution24().isBalanced(root);
String out = booleanToString(ret);
System.out.print(out);
}
}
}
class Solution24 {
public boolean isBalanced(TreeNode root) {
if (null == root) return true;
if (Math.abs(getDepth(root.left, 1) - getDepth(root.right, 1)) > 1) return false;
return isBalanced(root.left) && isBalanced(root.right);
}
private int getDepth(TreeNode root, int depth) {
if (null != root) {
depth += 1;
if (null != root.left) {
int leftDepth = getDepth(root.left, depth);
if (null != root.right) {
return Math.max(leftDepth, getDepth(root.right, depth));
}
return leftDepth;
}
if (null != root.right) return getDepth(root.right, depth);
}
return depth;
}
}
|
/*
* Copyright 2014 Matteo Bernacchia <kikijikispaccaspecchi@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kikijiki.ryukisenga.styles.data;
import android.annotation.SuppressLint;
import com.kikijiki.ryukisenga.content.XMLFormat;
import com.kikijiki.ryukisenga.styles.StyleManager.StyleEntry;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@SuppressLint("DefaultLocale")
public class StyleNameContentHandler extends DefaultHandler {
private StyleEntry _e;
public StyleNameContentHandler(StyleEntry entry) {
_e = entry;
}
@SuppressWarnings("incomplete-switch")
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
XMLFormat.StyleTag tag = XMLFormat.StyleTag.valueOf(qName.toLowerCase());
switch (tag) {
case style:
String name = XMLFormat.styleGetName(attributes);
if (name != null) {
_e.name = name;
}
throw new SAXException("Parsing finished");
}
}
}
|
/*
* Copyright 2017-2018, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.enmasse.systemtest;
import java.util.concurrent.TimeoutException;
public class ConnectTimeoutException extends TimeoutException {
public ConnectTimeoutException(String message) {
super(message);
}
}
|
package net.b07z.sepia.websockets.common;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.websocket.api.Session;
import org.json.simple.JSONObject;
import net.b07z.sepia.server.core.data.Role;
import net.b07z.sepia.server.core.tools.JSON;
import net.b07z.sepia.server.core.users.SharedAccessItem;
import net.b07z.sepia.websockets.server.SepiaClientPingHandler;
import net.b07z.sepia.websockets.server.SepiaClientPingHandler.PingRequest;
/**
* User of the webSocketClient/Server. It's a unique combination of 'userId', 'deviceId' and 'userSession'.
*
* @author Florian Quirin
*
*/
public class SocketUser {
public final static String GUEST = "Guest";
private static AtomicLong nextSessionId = new AtomicLong();
private Session userSession; //connection session
private String userId; //unique user id
private String userName; //self chosen name
private Role role; //role given by system
private String deviceId = ""; //device id to distinguish between same accounts on different devices
private long sessionId = 0; //random id to distinguish between same accounts in general
private String activeChannelId; //currently a user can only be active in one channel at the same time
private boolean isOmnipresent = false; //a user can be active in all channels at the same time
private boolean isActive = false; //when a user connects he is inactive until he broadcasts his welcome. Users can also be deactivated if multiple same accounts are used.
private boolean isAuthenticated = false; //a user can authenticate to use more services (e.g. assistant)
private boolean isClosing = false; //session.close() is async., set this to prevent messages to closing sessions
private Map<String, List<SharedAccessItem>> sharedAccess; //shared access permissions
private JSONObject info; //all kinds of additional (dynamic) info - parts of it may be added to 'getUserListEntry'
/**
* Create a new "user" (can also be an assistant or IoT device)
* @param session - webSocket session
* @param id - unique userId
* @param name - name chosen by user (account settings)
* @param role - role given to user by system (account entry)
* @param deviceId - client device ID
*/
public SocketUser(Session session, String id, String name, Role role, String deviceId){
this.userSession = session;
this.userId = id;
this.userName = name;
this.role = role;
this.deviceId = deviceId;
this.sessionId = nextSessionId.incrementAndGet();
}
@Override
public String toString(){
return ("userId:" + userId + ",userName:" + userName + ",role:" + role.name());
}
public Session getUserSession(){
return userSession;
}
public String getUserId(){
return userId;
}
public String getUserName(){
return userName;
}
/**
* Update the user name, but prevent confusion with guests by modifying anything that starts with 'GUEST'.
*/
public void updateUserName(String newName){
if (newName.startsWith(GUEST)){
newName = "No" + newName;
}
this.userName = newName;
}
/**
* Get name and id as entry for the user list
*/
public JSONObject getUserListEntry(){
JSONObject entry = JSON.make(
"name", userName,
"id", userId,
"isActive", isActive,
"deviceId", deviceId,
"sessionId", sessionId
);
JSON.put(entry, "role", role.name());
if (info != null){
JSONObject infoJson = new JSONObject();
//use this white-list of added info
if (info.containsKey("clientInfo")){
JSON.put(infoJson, "clientInfo", info.get("clientInfo"));
}
if (info.containsKey("lastPing")){
JSON.put(infoJson, "lastPing", info.get("lastPing"));
}
if (info.containsKey("deviceLocalSite")){
JSON.put(infoJson, "deviceLocalSite", info.get("deviceLocalSite"));
}
if (info.containsKey("deviceGlobalLocation")){
JSON.put(infoJson, "deviceGlobalLocation", info.get("deviceGlobalLocation"));
}
if (!infoJson.isEmpty()){
JSON.put(entry, "info", infoJson);
}
}
//TODO: add sharedAccess?
return entry;
}
/**
* Get reduced data e.g. for shared-access list info.
*/
public JSONObject getReducedListEntry(){
JSONObject entry = JSON.make(
"name", userName,
"id", userId,
"isActive", isActive,
"deviceId", deviceId
);
if (info != null){
JSONObject infoJson = new JSONObject();
if (info.containsKey("deviceLocalSite")){
JSON.put(infoJson, "deviceLocalSite", info.get("deviceLocalSite"));
}
if (!infoJson.isEmpty()){
JSON.put(entry, "info", infoJson);
}
}
return entry;
}
public String getActiveChannel(){
return activeChannelId;
}
public void setActiveChannel(String channelId){
activeChannelId = channelId;
}
public boolean isActiveInChannelOrOmnipresent(String channelId){
if (this.isOmnipresent() || (this.getActiveChannel().equals(channelId) && this.isActive())){
return true;
}else{
return false;
}
}
public boolean isOmnipresent(){
return isOmnipresent;
}
public void setOmnipresent(){
this.isOmnipresent = true;
}
public Role getUserRole(){
return role;
}
public String getDeviceId(){
return deviceId;
}
public void setDeviceId(String deviceId){
this.deviceId = deviceId;
}
public boolean isActive(){
return isActive;
}
public void setActive(){
this.isActive = true;
}
public void setInactive(){
this.isActive = false;
}
public boolean isAuthenticated(){
return isAuthenticated;
}
public void setAuthenticated(){
isAuthenticated = true;
}
public boolean isClosing(){
return isClosing;
}
public void setClosing(){
isClosing = true;
}
public void setSharedAccess(Map<String, List<SharedAccessItem>> sharedAccessMap){
sharedAccess = sharedAccessMap;
}
public Map<String, List<SharedAccessItem>> getSharedAccess(){
return sharedAccess;
}
/**
* Get some more info about user or client device.
*/
public JSONObject getInfo(){
return info;
}
/**
* Get a specific field from user or client device info.
*/
public Object getInfoEntryOrNull(String key){
if (info != null){
return info.get(key);
}else{
return null;
}
}
/**
* Set a specific field of the user or client device info.
*/
public void setInfo(String key, Object value){
if (info == null) info = new JSONObject();
JSON.put(info, key, value);
}
//--- stuff called after authentication or close ---
public void closeAllActivities(){
//cancel alive-ping request if any
PingRequest pr = (PingRequest) getInfoEntryOrNull("nextPingRequest");
if (pr != null){
pr.cancelScheduledPing();
}
}
public void registerActivities(){
//start alive-ping requests
if (SocketConfig.useAlivePings && userSession != null && userSession.isOpen()){
//the first ping is sent directly to test if the client supports the feature
SepiaClientPingHandler.scheduleNextUserPing(userSession, 15000);
}
}
}
|
package org.ff4j.springboot;
import org.apache.commons.dbcp2.BasicDataSource;
/*
* #%L
* ff4j-sample-archaius
* %%
* Copyright (C) 2013 - 2016 FF4J
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.ff4j.FF4j;
import org.ff4j.store.FeatureStoreSpringJdbc;
import org.ff4j.store.PropertyStoreSpringJdbc;
import org.ff4j.web.ApiConfig;
import org.ff4j.web.FF4jDispatcherServlet;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FF4jSpringConfig {
@Value("${ff4j.webapi.authentication}")
private boolean authentication = false;
@Value("${ff4j.webapi.authorization}")
private boolean authorization = false;
@Value("${ff4j.jdbc.driverClassName}")
private String jdbcDriverClassName;
@Value("${ff4j.jdbc.url}")
private String jdbcUrl;
@Value("${ff4j.jdbc.user}")
private String jdbcUser;
@Value("${ff4j.jdbc.password}")
private String jdbcPassword;
@Bean
public FF4j getFF4j() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(jdbcDriverClassName);
dataSource.setUrl(jdbcUrl);
dataSource.setUsername(jdbcUser);
dataSource.setPassword(jdbcPassword);
dataSource.setConnectionProperties("useUnicode=yes;characterEncoding=UTF-8;");
FF4j ff4j = new FF4j();
ff4j.setFeatureStore(new FeatureStoreSpringJdbc(dataSource));
ff4j.setPropertiesStore(new PropertyStoreSpringJdbc(dataSource));
ff4j.audit(false);
return ff4j;
}
@Bean
public FF4jDispatcherServlet getFF4jServletBis() {
FF4jDispatcherServlet servlet = new FF4jDispatcherServlet();
servlet.setFf4j(getFF4j());
return servlet;
}
@Bean
public ApiConfig getApiConfig() {
ApiConfig apiConfig = new ApiConfig();
apiConfig.setAuthenticate(authentication);
apiConfig.setAutorize(authorization);
apiConfig.setFF4j(getFF4j());
return apiConfig;
}
}
|
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.carina.demo.mobile.gui.pages.ios;
import org.apache.commons.lang3.RandomStringUtils;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.FindBy;
import com.qaprosoft.carina.core.foundation.utils.factory.DeviceType;
import com.qaprosoft.carina.core.foundation.utils.factory.DeviceType.Type;
import com.qaprosoft.carina.core.foundation.webdriver.decorator.ExtendedWebElement;
import com.qaprosoft.carina.core.foundation.webdriver.decorator.annotations.ClassChain;
import com.qaprosoft.carina.core.foundation.webdriver.decorator.annotations.Predicate;
import ${package}.carina.demo.mobile.gui.pages.common.CarinaDescriptionPageBase;
import ${package}.carina.demo.mobile.gui.pages.common.LoginPageBase;
@DeviceType(pageType = Type.IOS_PHONE, parentClass = LoginPageBase.class)
public class LoginPage extends LoginPageBase {
@FindBy(xpath = "type = 'XCUIElementTypeTextField'")
@Predicate
private ExtendedWebElement nameInputField;
@FindBy(xpath = "type = 'XCUIElementTypeSecureTextField'")
@Predicate
private ExtendedWebElement passwordInputField;
@FindBy(xpath = "name = 'Male' AND type = 'XCUIElementTypeButton'")
@Predicate
private ExtendedWebElement maleRadioBtn;
@FindBy(xpath = "**/XCUIElementTypeButton[`name == 'Female'`]")
@ClassChain
private ExtendedWebElement femaleRadioBtn;
@FindBy(xpath = "**/XCUIElementTypeButton[`name CONTAINS 'checkbox'`]")
@ClassChain
private ExtendedWebElement privacyPolicyCheckbox;
@FindBy(xpath = "name = 'LOGIN'")
@Predicate
private ExtendedWebElement loginBtn;
public LoginPage(WebDriver driver) {
super(driver);
}
@Override
public void typeName(String name) {
nameInputField.type(name);
}
@Override
public void typePassword(String password) {
passwordInputField.type(password);
}
@Override
public void selectMaleSex() {
maleRadioBtn.click();
}
@Override
public void checkPrivacyPolicyCheckbox() {
privacyPolicyCheckbox.click();
}
@Override
public CarinaDescriptionPageBase clickLoginBtn() {
loginBtn.click();
return initPage(getDriver(), CarinaDescriptionPageBase.class);
}
@Override
public boolean isLoginBtnActive() {
return Boolean.parseBoolean(loginBtn.getAttribute("enabled"));
}
@Override
public CarinaDescriptionPageBase login(){
String username = "Test user";
String password = RandomStringUtils.randomAlphabetic(10);
typeName(username);
typePassword(password);
selectMaleSex();
checkPrivacyPolicyCheckbox();
return clickLoginBtn();
}
}
|
/*
* 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.accumulo.server.security.delegation;
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import javax.crypto.SecretKey;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.admin.DelegationTokenConfig;
import org.apache.accumulo.core.clientImpl.AuthenticationTokenIdentifier;
import org.apache.accumulo.core.clientImpl.DelegationTokenImpl;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.security.token.SecretManager;
import org.apache.hadoop.security.token.Token;
import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
/**
* Manages an internal list of secret keys used to sign new authentication tokens as they are
* generated, and to validate existing tokens used for authentication.
*
* Each TabletServer, in addition to the Manager, has an instance of this {@link SecretManager} so
* that each can authenticate requests from clients presenting delegation tokens. The Manager will
* also run an instance of {@link AuthenticationTokenKeyManager} which handles generation of new
* keys and removal of old keys. That class will call the methods here to ensure the in-memory cache
* is consistent with what is advertised in ZooKeeper.
*/
public class AuthenticationTokenSecretManager extends SecretManager<AuthenticationTokenIdentifier> {
private static final Logger log = LoggerFactory.getLogger(AuthenticationTokenSecretManager.class);
private final String instanceID;
private final long tokenMaxLifetime;
private final ConcurrentHashMap<Integer,AuthenticationKey> allKeys = new ConcurrentHashMap<>();
private AuthenticationKey currentKey;
/**
* Create a new secret manager instance for generating keys.
*
* @param instanceID
* Accumulo instance ID
* @param tokenMaxLifetime
* Maximum age (in milliseconds) before a token expires and is no longer valid
*/
public AuthenticationTokenSecretManager(String instanceID, long tokenMaxLifetime) {
requireNonNull(instanceID);
checkArgument(tokenMaxLifetime > 0, "Max lifetime must be positive");
this.instanceID = instanceID;
this.tokenMaxLifetime = tokenMaxLifetime;
}
@Override
protected byte[] createPassword(AuthenticationTokenIdentifier identifier) {
DelegationTokenConfig cfg = identifier.getConfig();
long now = System.currentTimeMillis();
final AuthenticationKey secretKey;
synchronized (this) {
secretKey = currentKey;
}
identifier.setKeyId(secretKey.getKeyId());
identifier.setIssueDate(now);
long expiration = now + tokenMaxLifetime;
// Catch overflow
if (expiration < now) {
expiration = Long.MAX_VALUE;
}
identifier.setExpirationDate(expiration);
// Limit the lifetime if the user requests it
if (cfg != null) {
long requestedLifetime = cfg.getTokenLifetime(TimeUnit.MILLISECONDS);
if (requestedLifetime > 0) {
long requestedExpirationDate = identifier.getIssueDate() + requestedLifetime;
// Catch overflow again
if (requestedExpirationDate < identifier.getIssueDate()) {
requestedExpirationDate = Long.MAX_VALUE;
}
// Ensure that the user doesn't try to extend the expiration date -- they may only limit it
if (requestedExpirationDate > identifier.getExpirationDate()) {
throw new RuntimeException("Requested token lifetime exceeds configured maximum");
}
log.trace("Overriding token expiration date from {} to {}", identifier.getExpirationDate(),
requestedExpirationDate);
identifier.setExpirationDate(requestedExpirationDate);
}
}
identifier.setInstanceId(instanceID);
return createPassword(identifier.getBytes(), secretKey.getKey());
}
@Override
public byte[] retrievePassword(AuthenticationTokenIdentifier identifier) throws InvalidToken {
long now = System.currentTimeMillis();
if (identifier.getExpirationDate() < now) {
throw new InvalidToken("Token has expired");
}
if (identifier.getIssueDate() > now) {
throw new InvalidToken("Token issued in the future");
}
AuthenticationKey managerKey = allKeys.get(identifier.getKeyId());
if (managerKey == null) {
throw new InvalidToken("Unknown manager key for token (id=" + identifier.getKeyId() + ")");
}
// regenerate the password
return createPassword(identifier.getBytes(), managerKey.getKey());
}
@Override
public AuthenticationTokenIdentifier createIdentifier() {
// Return our TokenIdentifier implementation
return new AuthenticationTokenIdentifier();
}
/**
* Generates a delegation token for the user with the provided {@code username}.
*
* @param username
* The client to generate the delegation token for.
* @param cfg
* A configuration object for obtaining the delegation token
* @return A delegation token for {@code username} created using the {@link #currentKey}.
*/
public Entry<Token<AuthenticationTokenIdentifier>,AuthenticationTokenIdentifier>
generateToken(String username, DelegationTokenConfig cfg) throws AccumuloException {
requireNonNull(username);
requireNonNull(cfg);
final AuthenticationTokenIdentifier id = new AuthenticationTokenIdentifier(username, cfg);
final StringBuilder svcName = new StringBuilder(DelegationTokenImpl.SERVICE_NAME);
if (id.getInstanceId() != null) {
svcName.append("-").append(id.getInstanceId());
}
// Create password will update the state on the identifier given currentKey. Need to call this
// before serializing the identifier
byte[] password;
try {
password = createPassword(id);
} catch (RuntimeException e) {
throw new AccumuloException(e.getMessage());
}
// The use of the ServiceLoader inside Token doesn't work to automatically get the Identifier
// Explicitly returning the identifier also saves an extra deserialization
Token<AuthenticationTokenIdentifier> token =
new Token<>(id.getBytes(), password, id.getKind(), new Text(svcName.toString()));
return Maps.immutableEntry(token, id);
}
/**
* Add the provided {@code key} to the in-memory copy of all {@link AuthenticationKey}s.
*
* @param key
* The key to add.
*/
public synchronized void addKey(AuthenticationKey key) {
requireNonNull(key);
log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId());
allKeys.put(key.getKeyId(), key);
if (currentKey == null || key.getKeyId() > currentKey.getKeyId()) {
currentKey = key;
}
}
/**
* Removes the {@link AuthenticationKey} from the local cache of keys using the provided
* {@code keyId}.
*
* @param keyId
* The unique ID for the {@link AuthenticationKey} to remove.
* @return True if the key was removed, otherwise false.
*/
synchronized boolean removeKey(Integer keyId) {
requireNonNull(keyId);
log.debug("Removing AuthenticatioKey with keyId {}", keyId);
return allKeys.remove(keyId) != null;
}
/**
* The current {@link AuthenticationKey}, may be null.
*
* @return The current key, or null.
*/
@VisibleForTesting
AuthenticationKey getCurrentKey() {
return currentKey;
}
@VisibleForTesting
Map<Integer,AuthenticationKey> getKeys() {
return allKeys;
}
/**
* Inspect each key cached in {@link #allKeys} and remove it if the expiration date has passed.
* For each removed local {@link AuthenticationKey}, the key is also removed from ZooKeeper using
* the provided {@code keyDistributor} instance.
*
* @param keyDistributor
* ZooKeeper key distribution class
*/
synchronized int removeExpiredKeys(ZooAuthenticationKeyDistributor keyDistributor) {
long now = System.currentTimeMillis();
int keysRemoved = 0;
Iterator<Entry<Integer,AuthenticationKey>> iter = allKeys.entrySet().iterator();
while (iter.hasNext()) {
Entry<Integer,AuthenticationKey> entry = iter.next();
AuthenticationKey key = entry.getValue();
if (key.getExpirationDate() < now) {
log.debug("Removing expired delegation token key {}", key.getKeyId());
iter.remove();
keysRemoved++;
try {
keyDistributor.remove(key);
} catch (KeeperException | InterruptedException e) {
log.error("Failed to remove AuthenticationKey from ZooKeeper. Exiting", e);
throw new RuntimeException(e);
}
}
}
return keysRemoved;
}
synchronized boolean isCurrentKeySet() {
return currentKey != null;
}
/**
* Atomic operation to remove all AuthenticationKeys
*/
public synchronized void removeAllKeys() {
allKeys.clear();
currentKey = null;
}
@Override
protected SecretKey generateSecret() {
// Method in the parent is a different package, provide the explicit override so we can use it
// directly in our package.
return super.generateSecret();
}
public static SecretKey createSecretKey(byte[] raw) {
return SecretManager.createSecretKey(raw);
}
}
|
package com.speyejack.gui;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import com.speyejack.bots.Arena;
import com.speyejack.bots.Fight;
public class MainGUI extends JFrame implements ActionListener {
private static final long serialVersionUID = 9222519679125563536L;
private final Dimension dimension = new Dimension(500, 500);
private boolean maxSpeed = false;
private boolean render = true;
private boolean running = false;
private FighterPanel fpanel;
private Arena arena;
private Fight fight;
private ConfigGUI configGUI;
private Controller control;
public MainGUI() {
System.out.print("Initalizing...");
DebugGUI gui = new DebugGUI();
arena = new Arena(gui);
new Thread(arena).start();
fpanel = new FighterPanel(dimension);
// configGUI = new ConfigGUI(this);
control = new Controller(this);
this.setTitle("Learning Bots");
this.setIconImage(new ImageIcon("Fighter.png").getImage());
this.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
running = false;
arena.stop();
}
});
this.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
super.componentResized(e);
// dimension.setSize(getSize());
}
});
this.add(fpanel);
this.setVisible(true);
gui.pack();
this.pack();
System.out.println("Done");
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand() == "Get Top") {
fight = arena.getTopFight();
fpanel.setFight(fight);
new Thread(fpanel).start();
}
}
public static void main(String[] args) {
MainGUI gui = new MainGUI();
/*
* Bug List: Contract thingy, Fitness spikes, have total competition(every opponent fights every other opponent)
*/
}
/*
* public void mainLoop() { running = true; long lastUpdate =
* System.nanoTime(); long lastRender = System.nanoTime(); long now; // try
* { System.out.println("Commencing Test"); while (running) {
* configGUI.updateText(arena); render = configGUI.isRendering(); maxSpeed =
* configGUI.isMaxSpeed(); now = System.nanoTime(); if (maxSpeed ||
* TARGET_UPDATE_TIME <= (now - lastUpdate)) { arena.update(); lastUpdate =
* now; }
*
* if (render && (maxSpeed || TARGET_RENDER_TIME <= (now - lastRender))) {
* panel.repaint(); lastRender = now; }
*
* if (!maxSpeed) { try { Thread.sleep((long) 0.01); } catch (Exception e) {
* e.printStackTrace(); } } } // System.exit(0); // } catch (Exception e) {
* // e.printStackTrace(); // } finally { // System.exit(0); // } }
*/
}
|
/*
* Copyright 2012 eHarmony, 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.eharmony.matching.seeking.translator.solr;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
/**
* A list of wrapped Solr ORDERs. Encapsulated for type safety and as a guard
* against type erasure.
*/
public class SolrOrderings {
private final List<SolrOrdering> orderings = new ArrayList<SolrOrdering>();
public SolrOrderings() {
}
public SolrOrderings(SolrOrdering... orderings) {
this.orderings.addAll(Arrays.asList(orderings));
}
public static SolrOrderings merge(SolrOrderings... orderings) {
SolrOrderings merged = new SolrOrderings();
for (SolrOrderings o : orderings) {
merged.addAll(o.get());
}
return merged;
}
public void add(SolrOrdering ordering) {
orderings.add(ordering);
}
public void addAll(Collection<SolrOrdering> orderings) {
this.orderings.addAll(orderings);
}
public List<SolrOrdering> get() {
return orderings;
}
@Override
public String toString() {
return "SolrOrderings [" + orderings + "]";
}
}
|
package com.example.demo.Entities;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.time.Instant;
import java.util.Date;
import java.util.List;
@Getter
@Setter
@Entity
@Table(name = "rentals")
public class RentalEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "rental_from")
private Instant from;
@Column(name = "rental_to")
private Date to;
@Column(name = "total_price")
private Float total_price;
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<CarEntity> cars;
}
|
package com.navis.mktg.blackjack;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@SpringBootApplication
public class BlackjackApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(BlackjackApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
System.out.println("Hello World!");
System.out.println("\nThis is one of several ways to read input. Enter something");
//Enter data using BufferReader
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Reading data using readLine
String input = reader.readLine();
System.out.println("You typed: " + input);
}
}
|
package future;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class FutureExample {
public static void main(String[] args) throws Exception {
ExecutorService executor = Executors.newCachedThreadPool();
Runnable task1 = () -> System.out.println("i am task1.....");
Callable<Integer> task2 = () -> 100;
Future<?> f1 = executor.submit(task1);
Future<Integer> f2 = executor.submit(task2);
System.out.println("task1 is completed? " + f1.isDone());
System.out.println("task2 is completed? " + f2.isDone());
while(f2.isDone()){
System.out.println("return value by task2: " + f2.get());
break;
}
while(f1.isDone()){
System.out.println("task1 completed." + f1.get());
break;
}
}
}
|
package io.github.project_travel_mate.utilities;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextClock;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
import java.util.TimeZone;
import butterknife.ButterKnife;
import io.github.project_travel_mate.R;
public class WorldClockActivity extends AppCompatActivity {
private CustomAnalogClock mAnalogClock;
private static final String DEFAULT_TIME_ZONE_KEY = "defaultTimeZone";
private TextClock mTextClock;
private long mMiliSeconds;
private ArrayAdapter<String> mIdAdapter;
private Spinner mTimeZoneChooser;
private Calendar mCurrent;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_utilities_world_clock);
ButterKnife.bind(this);
setTitle(R.string.text_clock);
mTextClock = findViewById(R.id.clock_digital);
mAnalogClock = findViewById(R.id.clock_analog);
mTimeZoneChooser = findViewById(R.id.availableID); // choosing time zone
String[] idArray = TimeZone.getAvailableIDs();
mIdAdapter = new ArrayAdapter<>(this,
android.R.layout.simple_spinner_item, idArray);
mIdAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mTimeZoneChooser.setAdapter(mIdAdapter);
/**
* Analog Clock Initialization
*/
mAnalogClock.init(WorldClockActivity.this, R.drawable.clock_face,
R.drawable.hours_hand, R.drawable.minutes_hand,
0, false, false);
mAnalogClock.setScale(1f);
// analog clock size
getGMTTime();
// get time from selected time zone
mTimeZoneChooser.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent,
View view, int position, long id) {
getGMTTime();
String selectedId = (String) (parent.getItemAtPosition(position));
TimeZone timezone = TimeZone.getTimeZone(selectedId);
setSelectedText(timezone);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
public static Intent getStartIntent(Context context) {
Intent intent = new Intent(context, WorldClockActivity.class);
return intent;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home)
finish();
return super.onOptionsItemSelected(item);
}
/**
* This function gets GMT time and also performs time calculation according to time zone.
*/
private void getGMTTime() {
mCurrent = Calendar.getInstance();
mCurrent.add(Calendar.HOUR, -2);
mMiliSeconds = mCurrent.getTimeInMillis();
TimeZone tzCurrent = mCurrent.getTimeZone();
int offset = tzCurrent.getRawOffset();
if (tzCurrent.inDaylightTime(new Date())) {
offset = offset + tzCurrent.getDSTSavings();
}
mMiliSeconds = mMiliSeconds - offset;
}
/**
* This function saves the user selected time zone
*
* @param key
* @param value
*/
private void saveTimeZonePrefs(String key, String value) {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
settings.edit().putString(key, value).apply();
}
/**
* This function gets the time from the time zone that user have chosen.
*
* @param timezone
*/
private void setSelectedText(TimeZone timezone) {
mMiliSeconds = mMiliSeconds + timezone.getRawOffset();
mTextClock.setTimeZone(timezone.getID());
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR, -2);
mAnalogClock.setTime(calendar);
mAnalogClock.setTimezone(timezone);
saveTimeZonePrefs(DEFAULT_TIME_ZONE_KEY, timezone.getID());
mTextClock.setFormat12Hour("hh:mm:ss a"); //for 12 hour format
mTextClock.setFormat24Hour("k:mm:ss"); // for 24 hour format
mMiliSeconds = 0;
}
}
|
// Copyright Keith D Gregory
//
// 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.sf.kdgcommons.net;
/**
* An ever-growing list of MIME types that my applications might use, to avoid
* typos. Why doesn't the JDK provide something like this?!?
*/
public class MimeTypes
{
public final static String TEXT = "text/plain";
public final static String BINARY = "application/octet-stream";
public final static String XML = "text/xml";
public final static String DEPRECATED_XML = "application/xml";
public final static String HTML = "text/html";
public final static String HTML_POST = "application/x-www-form-urlencoded";
public final static String JAVASCRIPT = "application/javascript";
public final static String JSON = "application/json";
}
|
/*
* Copyright Splunk 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.splunk.opentelemetry.profiler;
import static com.splunk.opentelemetry.profiler.LogEntryCreator.PROFILING_SOURCE;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.SOURCE_EVENT_NAME;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.SOURCE_EVENT_PERIOD;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.SOURCE_TYPE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.splunk.opentelemetry.logs.LogEntry;
import com.splunk.opentelemetry.profiler.context.SpanLinkage;
import com.splunk.opentelemetry.profiler.context.StackToSpanLinkage;
import com.splunk.opentelemetry.profiler.events.EventPeriods;
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.SpanContext;
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.sdk.logs.data.Body;
import java.time.Duration;
import java.time.Instant;
import org.junit.jupiter.api.Test;
class LogEntryCreatorTest {
@Test
void testCreate() {
Instant time = Instant.now();
String stack = "the.stack";
SpanContext context =
SpanContext.create(
"deadbeefdeadbeefdeadbeefdeadbeef",
"0123012301230123",
TraceFlags.getSampled(),
TraceState.getDefault());
long threadId = 987L;
String eventName = "GoodEventHere";
EventPeriods periods = mock(EventPeriods.class);
when(periods.getDuration(eventName)).thenReturn(Duration.ofMillis(606));
SpanLinkage linkage = new SpanLinkage(context, threadId);
Attributes attributes =
Attributes.of(
SOURCE_EVENT_NAME, eventName, SOURCE_EVENT_PERIOD, 606L, SOURCE_TYPE, "otel.profiling");
LogEntry expected =
LogEntry.builder()
.spanContext(context)
.name(PROFILING_SOURCE)
.body(Body.string(stack))
.time(time)
.attributes(attributes)
.build();
StackToSpanLinkage linkedSpan = new StackToSpanLinkage(time, "the.stack", eventName, linkage);
LogEntryCreator creator = new LogEntryCreator(new LogEntryCommonAttributes(periods));
LogEntry result = creator.apply(linkedSpan);
assertEquals(expected, result);
}
}
|
/*
-----------------------------------------------------------------------
| |
| Class: Team |
| Description: Team class that represents a Pokemon team entity. |
| |
| |
| |
| Author: Zayd-Waves |
| Date: 5/31/2016 |
| |
| |
| |
-----------------------------------------------------------------------
*/
package me.zaydbille.pokedex.data;
public class Team {
private String title;
private Pokemon[] pokemon = new Pokemon[6];
private int count = 0;
public Team() {
}
public String getTitle() {
return title;
}
public Pokemon[] getPokemon() {
return pokemon;
}
public int getCount() {
return count;
}
public void setTitle(String title) {
this.title = title;
}
public void setPokemon(Pokemon[] pokemon) {
this.pokemon = pokemon;
}
public void setCount(int count) {
this.count = count;
}
}
|
/*
* Copyright (C) 2015 Square, Inc, 2017 Jeff Gilfelt.
*
* 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.coding.zxm.chuck;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.coding.zxm.chuck.internal.data.ChuckContentProvider;
import com.coding.zxm.chuck.internal.data.HttpTransaction;
import com.coding.zxm.chuck.internal.data.LocalCupboard;
import com.coding.zxm.chuck.internal.support.NotificationHelper;
import com.coding.zxm.chuck.internal.support.RetentionManager;
import java.io.EOFException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.http.HttpHeaders;
import okio.Buffer;
import okio.BufferedSource;
import okio.GzipSource;
import okio.Okio;
/**
* An OkHttp Interceptor which persists and displays HTTP activity in your application for later inspection.
*/
public final class ChuckInterceptor implements Interceptor {
public enum Period {
/**
* Retain data for the last hour.
*/
ONE_HOUR,
/**
* Retain data for the last day.
*/
ONE_DAY,
/**
* Retain data for the last week.
*/
ONE_WEEK,
/**
* Retain data forever.
*/
FOREVER
}
private static final String LOG_TAG = "ChuckInterceptor";
private static final Period DEFAULT_RETENTION = Period.ONE_WEEK;
private static final Charset UTF8 = Charset.forName("UTF-8");
private final Context context;
private final NotificationHelper notificationHelper;
private RetentionManager retentionManager;
private boolean showNotification;
private long maxContentLength = 250000L;
/**
* @param context The current Context.
*/
public ChuckInterceptor(Context context) {
this.context = context.getApplicationContext();
notificationHelper = new NotificationHelper(this.context);
showNotification = true;
retentionManager = new RetentionManager(this.context, DEFAULT_RETENTION);
}
/**
* Control whether a notification is shown while HTTP activity is recorded.
*
* @param show true to show a notification, false to suppress it.
* @return The {@link ChuckInterceptor} instance.
*/
public ChuckInterceptor showNotification(boolean show) {
showNotification = show;
return this;
}
/**
* Set the maximum length for request and response content before it is truncated.
* Warning: setting this value too high may cause unexpected results.
*
* @param max the maximum length (in bytes) for request/response content.
* @return The {@link ChuckInterceptor} instance.
*/
public ChuckInterceptor maxContentLength(long max) {
this.maxContentLength = max;
return this;
}
/**
* Set the retention period for HTTP transaction data captured by this interceptor.
* The default is one week.
*
* @param period the peroid for which to retain HTTP transaction data.
* @return The {@link ChuckInterceptor} instance.
*/
public ChuckInterceptor retainDataFor(Period period) {
retentionManager = new RetentionManager(context, period);
return this;
}
@Override
public Response intercept(Chain chain) throws IOException {
//request
final Request request = chain.request();
final RequestBody requestBody = request.body();
boolean hasRequestBody = requestBody != null;
final HttpTransaction transaction = new HttpTransaction();
transaction.setRequestDate(new Date());
transaction.setMethod(request.method());
transaction.setUrl(request.url().toString());
transaction.setRequestHeaders(request.headers());
if (hasRequestBody) {
if (requestBody.contentType() != null) {
transaction.setRequestContentType(requestBody.contentType().toString());
}
if (requestBody.contentLength() != -1) {
transaction.setRequestContentLength(requestBody.contentLength());
}
}
transaction.setRequestBodyIsPlainText(!bodyHasUnsupportedEncoding(request.headers()));
if (hasRequestBody && transaction.requestBodyIsPlainText()) {
BufferedSource source = getNativeSource(new Buffer(), bodyGzipped(request.headers()));
Buffer buffer = source.buffer();
requestBody.writeTo(buffer);
Charset charset = UTF8;
MediaType contentType = requestBody.contentType();
if (contentType != null) {
charset = contentType.charset(UTF8);
}
if (isPlaintext(buffer)) {
transaction.setRequestBody(readFromBuffer(buffer, charset));
} else {
transaction.setResponseBodyIsPlainText(false);
}
}
final Uri transactionUri = create(transaction);
long startNs = System.nanoTime();
//do http request
Response response;
try {
response = chain.proceed(request);
} catch (Exception e) {
transaction.setError(e.toString());
update(transaction, transactionUri);
throw e;
}
long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs);
//reponse body
final ResponseBody responseBody = response.body();
transaction.setRequestHeaders(response.request().headers()); // includes headers added later in the chain
transaction.setResponseDate(new Date());
transaction.setTookMs(tookMs);
transaction.setProtocol(response.protocol().toString());
transaction.setResponseCode(response.code());
transaction.setResponseMessage(response.message());
transaction.setResponseContentLength(responseBody.contentLength());
if (responseBody.contentType() != null) {
transaction.setResponseContentType(responseBody.contentType().toString());
}
transaction.setResponseHeaders(response.headers());
transaction.setResponseBodyIsPlainText(!bodyHasUnsupportedEncoding(response.headers()));
if (HttpHeaders.hasBody(response) && transaction.responseBodyIsPlainText()) {
BufferedSource source = getNativeSource(response);
source.request(Long.MAX_VALUE);
Buffer buffer = source.buffer();
Charset charset = UTF8;
MediaType contentType = responseBody.contentType();
if (contentType != null) {
try {
charset = contentType.charset(UTF8);
} catch (UnsupportedCharsetException e) {
update(transaction, transactionUri);
return response;
}
}
if (isPlaintext(buffer)) {
transaction.setResponseBody(readFromBuffer(buffer.clone(), charset));
} else {
transaction.setResponseBodyIsPlainText(false);
}
transaction.setResponseContentLength(buffer.size());
}
update(transaction, transactionUri);
return response;
}
private Uri create(HttpTransaction transaction) {
ContentValues values = LocalCupboard.getInstance().withEntity(HttpTransaction.class).toContentValues(transaction);
Uri uri = context.getContentResolver().insert(ChuckContentProvider.TRANSACTION_URI, values);
transaction.setId(Long.valueOf(uri.getLastPathSegment()));
if (showNotification) {
notificationHelper.show(transaction);
}
retentionManager.doMaintenance();
return uri;
}
private int update(HttpTransaction transaction, Uri uri) {
ContentValues values = LocalCupboard.getInstance().withEntity(HttpTransaction.class).toContentValues(transaction);
int updated = context.getContentResolver().update(uri, values, null, null);
if (showNotification && updated > 0) {
notificationHelper.show(transaction);
}
return updated;
}
/**
* Returns true if the body in question probably contains human readable text. Uses a small sample
* of code points to detect unicode control characters commonly used in binary file signatures.
*/
private boolean isPlaintext(Buffer buffer) {
try {
Buffer prefix = new Buffer();
long byteCount = buffer.size() < 64 ? buffer.size() : 64;
buffer.copyTo(prefix, 0, byteCount);
for (int i = 0; i < 16; i++) {
if (prefix.exhausted()) {
break;
}
int codePoint = prefix.readUtf8CodePoint();
if (Character.isISOControl(codePoint) && !Character.isWhitespace(codePoint)) {
return false;
}
}
return true;
} catch (EOFException e) {
return false; // Truncated UTF-8 sequence.
}
}
private boolean bodyHasUnsupportedEncoding(Headers headers) {
String contentEncoding = headers.get("Content-Encoding");
return contentEncoding != null &&
!contentEncoding.equalsIgnoreCase("identity") &&
!contentEncoding.equalsIgnoreCase("gzip");
}
private boolean bodyGzipped(Headers headers) {
String contentEncoding = headers.get("Content-Encoding");
return "gzip".equalsIgnoreCase(contentEncoding);
}
private String readFromBuffer(Buffer buffer, Charset charset) {
long bufferSize = buffer.size();
long maxBytes = Math.min(bufferSize, maxContentLength);
String body = "";
try {
body = buffer.readString(maxBytes, charset);
} catch (EOFException e) {
body += context.getString(R.string.chuck_body_unexpected_eof);
}
if (bufferSize > maxContentLength) {
body += context.getString(R.string.chuck_body_content_truncated);
}
return body;
}
private BufferedSource getNativeSource(BufferedSource input, boolean isGzipped) {
if (isGzipped) {
GzipSource source = new GzipSource(input);
return Okio.buffer(source);
} else {
return input;
}
}
private BufferedSource getNativeSource(Response response) throws IOException {
if (bodyGzipped(response.headers())) {
BufferedSource source = response.peekBody(maxContentLength).source();
if (source.buffer().size() < maxContentLength) {
return getNativeSource(source, true);
} else {
Log.w(LOG_TAG, "gzip encoded response was too long");
}
}
return response.body().source();
}
}
|
/*
*AVISO LEGAL
© Copyright
*Este programa esta protegido por la ley de derechos de autor.
*La reproduccion o distribucion ilicita de este programa o de cualquiera de
*sus partes esta penado por la ley con severas sanciones civiles y penales,
*y seran objeto de todas las sanciones legales que correspondan.
*Su contenido no puede copiarse para fines comerciales o de otras,
*ni puede mostrarse, incluso en una version modificada, en otros sitios Web.
Solo esta permitido colocar hipervinculos al sitio web.
*/
package com.bydan.erp.inventario.presentation.swing.jinternalframes.auxiliar;
import com.bydan.erp.seguridad.business.entity.Usuario;
import com.bydan.erp.seguridad.business.entity.Opcion;
import com.bydan.erp.seguridad.business.entity.PerfilOpcion;
import com.bydan.erp.seguridad.business.entity.PerfilCampo;
import com.bydan.erp.seguridad.business.entity.PerfilAccion;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg;
import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario;
import com.bydan.erp.seguridad.business.entity.Modulo;
import com.bydan.erp.seguridad.business.entity.Accion;
//import com.bydan.erp.seguridad.business.entity.PerfilAccion;
import com.bydan.erp.seguridad.util.SistemaConstantesFunciones;
import com.bydan.erp.seguridad.util.SistemaConstantesFuncionesAdditional;
import com.bydan.erp.seguridad.business.logic.SistemaLogicAdditional;
import com.bydan.erp.inventario.util.MensajeCorreoInvenConstantesFunciones;
import com.bydan.erp.inventario.util.MensajeCorreoInvenParameterReturnGeneral;
//import com.bydan.erp.inventario.util.MensajeCorreoInvenParameterGeneral;
import com.bydan.framework.erp.business.dataaccess.ConstantesSql;
import com.bydan.framework.erp.business.entity.Classe;
import com.bydan.framework.erp.business.entity.DatoGeneral;
import com.bydan.framework.erp.business.entity.DatoGeneralMinimo;
import com.bydan.framework.erp.business.entity.GeneralEntity;
import com.bydan.framework.erp.business.entity.Mensajes;
//import com.bydan.framework.erp.business.entity.MaintenanceType;
import com.bydan.framework.erp.util.MaintenanceType;
import com.bydan.framework.erp.util.FuncionesReporte;
import com.bydan.framework.erp.business.logic.DatosCliente;
import com.bydan.framework.erp.business.logic.Pagination;
import com.bydan.erp.inventario.presentation.swing.jinternalframes.MensajeCorreoInvenBeanSwingJInternalFrame;
import com.bydan.framework.erp.presentation.desktop.swing.TablaGeneralTotalModel;
import com.bydan.framework.erp.presentation.desktop.swing.DateConverter;
import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate;
import com.bydan.framework.erp.presentation.desktop.swing.DateRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.DateEditorRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.BooleanRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.BooleanEditorRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.TextFieldRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.*;
//import com.bydan.framework.erp.presentation.desktop.swing.TextFieldEditorRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.HeaderRenderer;
import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase;
import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing;
import com.bydan.framework.erp.presentation.desktop.swing.MainJFrame;
import com.bydan.framework.erp.resources.imagenes.AuxiliarImagenes;
import com.bydan.erp.inventario.resources.reportes.AuxiliarReportes;
import com.bydan.erp.inventario.util.*;
import com.bydan.erp.inventario.business.logic.*;
import com.bydan.erp.seguridad.business.logic.*;
//EJB
//PARAMETROS
//EJB PARAMETROS
import com.bydan.framework.erp.business.logic.*;
import com.bydan.framework.erp.util.*;
import com.bydan.erp.inventario.business.entity.*;
//import com.bydan.framework.erp.business.entity.ConexionBeanFace;
//import com.bydan.framework.erp.business.entity.Mensajes;
import com.bydan.erp.seguridad.presentation.swing.jinternalframes.*;
import java.net.NetworkInterface;
import java.net.InterfaceAddress;
import java.net.InetAddress;
import javax.naming.InitialContext;
import java.lang.Long;
import java.util.Date;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
import java.io.Serializable;
import java.util.Hashtable;
import java.io.File;
import java.io.FileInputStream;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Map;
import java.io.PrintWriter;
import java.sql.SQLException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.stream.StreamSource;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.w3c.dom.Document;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.export.JRHtmlExporter;
import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.data.JRBeanArrayDataSource;
import net.sf.jasperreports.view.JasperViewer;
import org.apache.log4j.Logger;
import com.bydan.framework.erp.business.entity.Reporte;
//VALIDACION
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.export.JExcelApiExporter;
import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRRtfExporter;
import net.sf.jasperreports.engine.export.JRXlsExporter;
import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
import net.sf.jasperreports.engine.util.JRSaver;
import net.sf.jasperreports.engine.xml.JRXmlWriter;
import com.bydan.erp.inventario.presentation.web.jsf.sessionbean.*;
import com.bydan.erp.inventario.presentation.swing.jinternalframes.MensajeCorreoInvenJInternalFrame;
import com.bydan.erp.inventario.presentation.swing.jinternalframes.MensajeCorreoInvenDetalleFormJInternalFrame;
import java.util.EventObject;
import java.util.EventListener;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.event.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.awt.event.*;
import org.jdesktop.beansbinding.Binding.SyncFailure;
import org.jdesktop.beansbinding.BindingListener;
import org.jdesktop.beansbinding.Bindings;
import org.jdesktop.beansbinding.BeanProperty;
import org.jdesktop.beansbinding.ELProperty;
import org.jdesktop.beansbinding.AutoBinding.UpdateStrategy;
import org.jdesktop.beansbinding.PropertyStateEvent;
import org.jdesktop.swingbinding.JComboBoxBinding;
import org.jdesktop.swingbinding.SwingBindings;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import com.bydan.erp.seguridad.business.entity.*;
import com.bydan.erp.seguridad.util.*;
import com.bydan.erp.seguridad.presentation.web.jsf.sessionbean.*;
@SuppressWarnings("unused")
public class MensajeCorreoInvenTableCell extends DefaultCellEditor implements TableCellRenderer {
private static final long serialVersionUID = 1L;
//PARA TABLECELL_FK
public JInternalFrameBase jInternalFrameBase;
protected JLabel jLabelMensajeCorreoInven=new JLabelMe();
@SuppressWarnings("rawtypes")
protected JComboBox jComboBoxMensajeCorreoInven=new JComboBoxMe();
protected Object valor=new Object();
protected List<MensajeCorreoInven> mensajecorreoinvensForeignKey=new ArrayList<MensajeCorreoInven>();
protected List<MensajeCorreoInven> mensajecorreoinvensForeignKeyActual=new ArrayList<MensajeCorreoInven>();
protected Border borderResaltarMensajeCorreoInven=null;
protected Boolean conEnabled=true;
protected Integer iTotalRow=0;
protected Boolean conHotKeys=false;
protected String sNombreHotKeyAbstractAction="";
protected String sTipoBusqueda="NINGUNO";
protected Integer rowActual=-1;
protected ArrayList<Classe> classes;
//PARA TABLECELL_FK_FIN
//PARA TABLECELL
public String sTipo="FK"; //"BOTON"
protected JButton jButtonMensajeCorreoInven;
//PARA TABLECELL FIN
//PARA TABLECELL_FK
public MensajeCorreoInvenTableCell() {
super(new JCheckBoxMe());
}
public MensajeCorreoInvenTableCell(JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public MensajeCorreoInvenTableCell(JInternalFrameBase jInternalFrameBase) {
this(jInternalFrameBase,true);
}
public MensajeCorreoInvenTableCell(JCheckBox checkBox,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(checkBox);
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public MensajeCorreoInvenTableCell(JCheckBox checkBox,JInternalFrameBase jInternalFrameBase) {
this(checkBox,jInternalFrameBase,true);
}
@SuppressWarnings("rawtypes")
public MensajeCorreoInvenTableCell(JComboBox jcComboBox,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(jcComboBox);
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.jComboBoxMensajeCorreoInven=jcComboBox;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
@SuppressWarnings("rawtypes")
public MensajeCorreoInvenTableCell(JComboBox jcComboBox,JInternalFrameBase jInternalFrameBase) {
this(jcComboBox,jInternalFrameBase,true);
}
public MensajeCorreoInvenTableCell(List<MensajeCorreoInven> mensajecorreoinvensForeignKey,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.mensajecorreoinvensForeignKey=mensajecorreoinvensForeignKey;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public MensajeCorreoInvenTableCell(List<MensajeCorreoInven> mensajecorreoinvensForeignKey,JInternalFrameBase jInternalFrameBase) {
this(mensajecorreoinvensForeignKey,jInternalFrameBase,true);
}
public MensajeCorreoInvenTableCell(List<MensajeCorreoInven> mensajecorreoinvensForeignKey,Border borderResaltarMensajeCorreoInven,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.mensajecorreoinvensForeignKey=mensajecorreoinvensForeignKey;
this.borderResaltarMensajeCorreoInven=borderResaltarMensajeCorreoInven;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public MensajeCorreoInvenTableCell(List<MensajeCorreoInven> mensajecorreoinvensForeignKey,Border borderResaltarMensajeCorreoInven,JInternalFrameBase jInternalFrameBase,Boolean conEnabled,Integer iTotalRow) {
super(new JCheckBoxMe());
this.iTotalRow=iTotalRow;
this.conEnabled=conEnabled;
this.conHotKeys=false;
this.sNombreHotKeyAbstractAction="";
this.sTipoBusqueda="NINGUNO";
this.rowActual=-1;
this.mensajecorreoinvensForeignKey=mensajecorreoinvensForeignKey;
this.borderResaltarMensajeCorreoInven=borderResaltarMensajeCorreoInven;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
public MensajeCorreoInvenTableCell(List<MensajeCorreoInven> mensajecorreoinvensForeignKey,Border borderResaltar,JInternalFrameBase jInternalFrameBase) {
this(mensajecorreoinvensForeignKey,borderResaltar,jInternalFrameBase,true);
}
public MensajeCorreoInvenTableCell(List<MensajeCorreoInven> mensajecorreoinvensForeignKey,Border borderResaltarMensajeCorreoInven,JInternalFrameBase jInternalFrameBase,Boolean conEnabled,Boolean conHotKeys,String sNombreHotKeyAbstractAction,String sTipoBusqueda) {
super(new JCheckBoxMe());
this.iTotalRow=0;
this.conEnabled=conEnabled;
this.conHotKeys=conHotKeys;
this.sNombreHotKeyAbstractAction=sNombreHotKeyAbstractAction;
this.sTipoBusqueda=sTipoBusqueda;
this.rowActual=-1;
this.mensajecorreoinvensForeignKey=mensajecorreoinvensForeignKey;
this.borderResaltarMensajeCorreoInven=borderResaltarMensajeCorreoInven;
this.jInternalFrameBase=jInternalFrameBase;
this.sTipo="FK";
}
//PARA TABLECELL_FK_FIN
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
Component component=new JCheckBoxMe();
if(sTipo=="FK") {
component=this.getTableCellRendererComponentParaTableCellFk(table,value,isSelected,hasFocus,row,column);
} else if(sTipo=="BOTON") {
component=this.getTableCellRendererComponentParaTableCell(table,value,isSelected,hasFocus,row,column);
}
return component;
}
public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column) {
Component component=new JCheckBoxMe();
if(sTipo=="FK") {
component=this.getTableCellEditorComponentParaTableCellFk(table,value,isSelected,row,column);
} else if(sTipo=="BOTON") {
component=this.getTableCellEditorComponentParaTableCell(table,value,isSelected,row,column);
}
return component;
}
public Component getTableCellRendererComponentParaTableCellFk(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
try{
int intSelectedRow = row;
//ARCHITECTURE
/*
if(Constantes.ISUSAEJBLOGICLAYER) {
perfil =(Perfil) perfilLogic.getPerfils().toArray()[table.convertRowIndexToModel(intSelectedRow)];
} else if(Constantes.ISUSAEJBREMOTE) {
perfil =(Perfil) perfils.toArray()[table.convertRowIndexToModel(intSelectedRow)];
}
*/
//ARCHITECTURE
jLabelMensajeCorreoInven=new JLabelMe();
/*
if(perfil.getIsChanged()) {
perfil.setsistema_descripcion((getActualSistemaForeignKeyDescripcion((Long)value)));
}
*/
String sMensajeCorreoInvenDescripcion="";
sMensajeCorreoInvenDescripcion=jInternalFrameBase.getDescripcionFk("MensajeCorreoInven",table,value,intSelectedRow);
jLabelMensajeCorreoInven.setText(sMensajeCorreoInvenDescripcion);
if(this.borderResaltarMensajeCorreoInven!=null) {
jLabelMensajeCorreoInven.setBorder(this.borderResaltarMensajeCorreoInven);
}
jLabelMensajeCorreoInven.setOpaque(true);
//if(row!=(this.iTotalRow-1)) {
if((this.jInternalFrameBase.conTotales && row != table.getRowCount()-1) || !this.jInternalFrameBase.conTotales) {
jLabelMensajeCorreoInven.setBackground(row % 2 == 0 ? FuncionesSwing.getColorTextFields(Constantes2.S_FONDOCONTROL_COLOR) : Funciones2.getColorFilaTabla2());
} else {
jLabelMensajeCorreoInven.setBackground(Funciones2.getColorFilaTablaTotales());
}
if(isSelected) {
jLabelMensajeCorreoInven.setForeground(FuncionesSwing.getColorSelectedForeground());
}
} catch(Exception e) {
;
}
this.jLabelMensajeCorreoInven.setEnabled(this.conEnabled);
FuncionesSwing.setBoldLabel(this.jLabelMensajeCorreoInven, this.jInternalFrameBase.getsTipoTamanioGeneralTabla(),true,false,this.jInternalFrameBase);
return this.jLabelMensajeCorreoInven;
}
@SuppressWarnings({"unchecked" })
public Component getTableCellEditorComponentParaTableCellFk(JTable table,Object value,boolean isSelected,int row,int column) {
this.jComboBoxMensajeCorreoInven=new JComboBoxMe();
try{
int intSelectedRow = row;
//ARCHITECTURE
/*
if(Constantes.ISUSAEJBLOGICLAYER) {
perfil =(Perfil) perfilLogic.getPerfils().toArray()[table.convertRowIndexToModel(intSelectedRow)];
} else if(Constantes.ISUSAEJBREMOTE) {
perfil =(Perfil) perfils.toArray()[table.convertRowIndexToModel(intSelectedRow)];
}
*/
//ARCHITECTURE
if(!MensajeCorreoInvenJInternalFrame.ISBINDING_MANUAL) {
} else {
this.jComboBoxMensajeCorreoInven.removeAllItems();
//SIEMPRE <0 , NO USADO POR EL MOMENTO
//COMBO DE FILA ACTUAL SE ACTUALIZA, LOS DEMAS USAN EL ANTERIOR COMBO
if(this.rowActual<0 || (this.rowActual>=0 && this.rowActual!=row)) {
for(MensajeCorreoInven mensajecorreoinven:this.mensajecorreoinvensForeignKey) {
this.jComboBoxMensajeCorreoInven.addItem(mensajecorreoinven);
}
} else {
if(this.rowActual==row && row>=0) {
for(MensajeCorreoInven mensajecorreoinven:this.mensajecorreoinvensForeignKeyActual) {
this.jComboBoxMensajeCorreoInven.addItem(mensajecorreoinven);
}
}
}
}
//this.jComboBoxMensajeCorreoInven.setSelectedItem(perfil.getMensajeCorreoInven());
//setActualMensajeCorreoInvenForeignKey((Long)value,false,"Formulario");
MensajeCorreoInvenBeanSwingJInternalFrame.setActualComboBoxMensajeCorreoInvenGenerico((Long)value,this.jComboBoxMensajeCorreoInven,this.mensajecorreoinvensForeignKey);
if(this.conHotKeys) {
MensajeCorreoInvenBeanSwingJInternalFrame.setHotKeysComboBoxMensajeCorreoInvenGenerico(this.jComboBoxMensajeCorreoInven,this.jInternalFrameBase,this.sNombreHotKeyAbstractAction,this.sTipoBusqueda);
}
//NO_FUNCIONA_perfil.setsistema_descripcion(getActualMensajeCorreoInvenForeignKeyDescripcion((Long)value));
valor=value;
this.jComboBoxMensajeCorreoInven.setOpaque(true);
} catch(Exception e) {
e.printStackTrace();
}
this.jComboBoxMensajeCorreoInven.setEnabled(this.conEnabled);
FuncionesSwing.setBoldComboBox(this.jComboBoxMensajeCorreoInven, this.jInternalFrameBase.getsTipoTamanioGeneralTabla(),true,false,this.jInternalFrameBase);
return this.jComboBoxMensajeCorreoInven;
}
public Component getTableCellRendererComponentParaTableCell(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column) {
jButtonMensajeCorreoInven =new JButtonMe((row+1)+"-Mensaje Correo");
jButtonMensajeCorreoInven.setToolTipText((row+1)+"-Mensaje Correo");
if(this.borderResaltarMensajeCorreoInven!=null) {
jButtonMensajeCorreoInven.setBorder(this.borderResaltarMensajeCorreoInven);
}
jButtonMensajeCorreoInven.setOpaque(true);
jButtonMensajeCorreoInven.setBackground(row % 2 == 0 ? FuncionesSwing.getColorTextFields(Constantes2.S_FONDOCONTROL_COLOR) : Funciones2.getColorFilaTabla2());
if(isSelected) {
jButtonMensajeCorreoInven.setForeground(FuncionesSwing.getColorSelectedForeground());
}
this.jButtonMensajeCorreoInven.setEnabled(this.conEnabled);
return jButtonMensajeCorreoInven;
}
public Component getTableCellEditorComponentParaTableCell(JTable table,Object value,boolean isSelected,final int row,int column) {
jButtonMensajeCorreoInven=new JButtonMe((row+1)+"-Mensaje Correo");
jButtonMensajeCorreoInven.setToolTipText((row+1)+"-Mensaje Correo");
if(this.borderResaltarMensajeCorreoInven!=null) {
jButtonMensajeCorreoInven.setBorder(this.borderResaltarMensajeCorreoInven);
}
/*
jButtonMensajeCorreoInven.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
//jButtonMensajeCorreoInvenActionPerformed(evt,row,true,false);
jInternalFrameBase.jButtonRelacionActionPerformed("MensajeCorreoInven",evt,row,true,false);
}
}
);
*/
this.jButtonMensajeCorreoInven.addActionListener(new ButtonActionListener(this.jInternalFrameBase,"TableCell","MensajeCorreoInven",row));
valor=value;
this.jButtonMensajeCorreoInven.setEnabled(this.conEnabled);
return jButtonMensajeCorreoInven;
}
public MensajeCorreoInvenTableCell(Border borderResaltarMensajeCorreoInven,JInternalFrameBase jInternalFrameBase,Boolean conEnabled) {
super(new JCheckBoxMe());
this.conEnabled=conEnabled;
this.jInternalFrameBase=jInternalFrameBase;
this.borderResaltarMensajeCorreoInven=borderResaltarMensajeCorreoInven;
this.sTipo="BOTON";
}
public MensajeCorreoInvenTableCell(Border borderResaltarMensajeCorreoInven,JInternalFrameBase jInternalFrameBase) {
this(borderResaltarMensajeCorreoInven,jInternalFrameBase,true);
}
public Object getCellEditorValue() {
Object value=new Object();
Long idActual=0L;
if(sTipo=="FK") {
MensajeCorreoInven mensajecorreoinven=((MensajeCorreoInven)this.jComboBoxMensajeCorreoInven.getSelectedItem());
if(mensajecorreoinven!=null) {
idActual=mensajecorreoinven.getId();
}
value=idActual;
} else if(sTipo=="BOTON") {
value=valor;
}
return value;
}
public boolean stopCellEditing() {
fireEditingStopped();
return true;
}
public Integer getRowActual() {
return this.rowActual;
}
public void setRowActual(Integer rowActual) {
this.rowActual = rowActual;
}
public Boolean getConEnabled() {
return this.conEnabled;
}
public void setConEnabled(Boolean conEnabled) {
this.conEnabled = conEnabled;
}
public Boolean getConHotKeys() {
return this.conHotKeys;
}
public void setConHotKeys(Boolean conHotKeys) {
this.conHotKeys = conHotKeys;
}
@SuppressWarnings("rawtypes")
public JComboBox getjComboBoxMensajeCorreoInven() {
return this.jComboBoxMensajeCorreoInven;
}
@SuppressWarnings("rawtypes")
public void setjComboBoxMensajeCorreoInven(JComboBox jComboBoxMensajeCorreoInven) {
this.jComboBoxMensajeCorreoInven = jComboBoxMensajeCorreoInven;
}
public List<MensajeCorreoInven> getmensajecorreoinvensForeignKey() {
return this.mensajecorreoinvensForeignKey;
}
public void setmensajecorreoinvensForeignKey(List<MensajeCorreoInven> mensajecorreoinvensForeignKey) {
this.mensajecorreoinvensForeignKey = mensajecorreoinvensForeignKey;
}
public List<MensajeCorreoInven> getmensajecorreoinvensForeignKeyActual() {
return this.mensajecorreoinvensForeignKeyActual;
}
public void setmensajecorreoinvensForeignKeyActual(List<MensajeCorreoInven> mensajecorreoinvensForeignKeyActual) {
this.mensajecorreoinvensForeignKeyActual = mensajecorreoinvensForeignKeyActual;
}
@SuppressWarnings("unchecked")
public void RecargarMensajeCorreoInvensForeignKey() {
this.jComboBoxMensajeCorreoInven.removeAllItems();
//SIEMPRE <0 , NO USADO POR EL MOMENTO
//COMBO DE FILA ACTUAL SE ACTUALIZA, LOS DEMAS USAN EL ANTERIOR COMBO
if(this.rowActual<0) {
for(MensajeCorreoInven mensajecorreoinven:this.mensajecorreoinvensForeignKey) {
this.jComboBoxMensajeCorreoInven.addItem(mensajecorreoinven);
}
} else {
for(MensajeCorreoInven mensajecorreoinven:this.mensajecorreoinvensForeignKeyActual) {
this.jComboBoxMensajeCorreoInven.addItem(mensajecorreoinven);
}
}
}
}
|
public class MathTest {
/**
* Multiply n by m
*
* @param n
* the first number
* @param m
* the second number
* @return n*m
*/
public int multiply(int n, int m) {
return n * m;
}
}
|
/*
* SessionAnalysisWorkflowManagerInterface.java
*
* Copyright 2006-2018 James F. Bowring, CIRDLES.org, and Earth-Time.org
*
* 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.earthtime.UPb_Redux.dialogs.sessionManagers;
/**
*
* @author James F. Bowring
*/
public interface SessionAnalysisWorkflowManagerInterface {
/**
*
*/
public void setSize ();
/**
*
* @return
*/
public boolean isInitialized ();
/**
*
* @param b
*/
public void setVisible ( boolean b );
/**
*
*/
public void setupTripoliSessionRawDataView();
public void revalidateScrollPane();
}
|
/*
* Copyright 2021 Collate
* 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.openmetadata.catalog.security.auth;
import java.security.Principal;
import javax.ws.rs.core.SecurityContext;
import lombok.extern.slf4j.Slf4j;
/** Holds authenticated principal and security context which is passed to the JAX-RS request methods */
@Slf4j
public class CatalogSecurityContext implements SecurityContext {
private final Principal principal;
private final String scheme;
private final String authenticationScheme;
public static final String OPENID_AUTH = "openid";
public static final String JWT_AUTH = "jwt";
public CatalogSecurityContext(Principal principal, String scheme) {
this(principal, scheme, SecurityContext.DIGEST_AUTH);
}
public CatalogSecurityContext(Principal principal, String scheme, String authenticationScheme) {
this.principal = principal;
this.scheme = scheme;
this.authenticationScheme = authenticationScheme;
}
@Override
public Principal getUserPrincipal() {
return principal;
}
@Override
public boolean isUserInRole(String role) {
LOG.debug("isUserInRole user: {}, role: {}", principal, role);
return false;
}
@Override
public boolean isSecure() {
return "https".equals(this.scheme);
}
@Override
public String getAuthenticationScheme() {
return authenticationScheme;
}
@Override
public String toString() {
return "catalogSecurityContext{"
+ "principal="
+ principal
+ ", scheme='"
+ scheme
+ '\''
+ ", authenticationScheme='"
+ authenticationScheme
+ '\''
+ ", isSecure="
+ isSecure()
+ '}';
}
}
|
package nl.softcause.jsontemplates.nodes.controlflowstatement;
import java.util.Map;
import lombok.EqualsAndHashCode;
import nl.softcause.jsontemplates.expressions.IExpression;
import nl.softcause.jsontemplates.model.TemplateModel;
import nl.softcause.jsontemplates.nodes.IDescriptionBuilder;
import nl.softcause.jsontemplates.nodes.INode;
import nl.softcause.jsontemplates.nodes.base.ReflectionBasedNodeImpl;
@EqualsAndHashCode(callSuper = true)
public class If extends ReflectionBasedNodeImpl {
public static If create(Map<String, IExpression> arguments, Map<String, INode[]> slots) {
var ifNode = new If();
ifNode.setArguments(arguments);
ifNode.setSlots(slots);
return ifNode;
}
@RequiredArgument
private boolean test;
@RequiredSlot
private INode thenNode;
private INode elseNode;
@Override
protected void internalEvaluate(TemplateModel model) {
if (test) {
thenNode.evaluate(model);
} else if (slots.containsKey("else")) {
elseNode.evaluate(model);
}
}
@Override
public void describe(IDescriptionBuilder builder) {
builder.phrase().add("If").expression(getArguments().get("test")).add("then").end();
builder.describe(getSlots().get("then"));
builder.describeIfPresent("else", getSlots().get("else"));
}
}
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.instantapps.samples.feature.base;
public final class R {
public static final class anim {
public static int abc_fade_in = 0x7f010001;
public static int abc_fade_out = 0x7f010002;
public static int abc_grow_fade_in_from_bottom = 0x7f010003;
public static int abc_popup_enter = 0x7f010004;
public static int abc_popup_exit = 0x7f010005;
public static int abc_shrink_fade_out_from_bottom = 0x7f010006;
public static int abc_slide_in_bottom = 0x7f010007;
public static int abc_slide_in_top = 0x7f010008;
public static int abc_slide_out_bottom = 0x7f010009;
public static int abc_slide_out_top = 0x7f01000a;
public static int slide_in_front_global = 0x7f01000b;
public static int slide_in_right_global = 0x7f01000c;
public static int slide_out_back_global = 0x7f01000d;
public static int slide_out_right_global = 0x7f01000e;
}
public static final class attr {
public static int actionBarDivider = 0x7f040001;
public static int actionBarItemBackground = 0x7f040002;
public static int actionBarPopupTheme = 0x7f040003;
public static int actionBarSize = 0x7f040004;
public static int actionBarSplitStyle = 0x7f040005;
public static int actionBarStyle = 0x7f040006;
public static int actionBarTabBarStyle = 0x7f040007;
public static int actionBarTabStyle = 0x7f040008;
public static int actionBarTabTextStyle = 0x7f040009;
public static int actionBarTheme = 0x7f04000a;
public static int actionBarWidgetTheme = 0x7f04000b;
public static int actionButtonStyle = 0x7f04000c;
public static int actionDropDownStyle = 0x7f04000d;
public static int actionLayout = 0x7f04000e;
public static int actionMenuTextAppearance = 0x7f04000f;
public static int actionMenuTextColor = 0x7f040010;
public static int actionModeBackground = 0x7f040011;
public static int actionModeCloseButtonStyle = 0x7f040012;
public static int actionModeCloseDrawable = 0x7f040013;
public static int actionModeCopyDrawable = 0x7f040014;
public static int actionModeCutDrawable = 0x7f040015;
public static int actionModeFindDrawable = 0x7f040016;
public static int actionModePasteDrawable = 0x7f040017;
public static int actionModePopupWindowStyle = 0x7f040018;
public static int actionModeSelectAllDrawable = 0x7f040019;
public static int actionModeShareDrawable = 0x7f04001a;
public static int actionModeSplitBackground = 0x7f04001b;
public static int actionModeStyle = 0x7f04001c;
public static int actionModeWebSearchDrawable = 0x7f04001d;
public static int actionOverflowButtonStyle = 0x7f04001e;
public static int actionOverflowMenuStyle = 0x7f04001f;
public static int actionProviderClass = 0x7f040020;
public static int actionViewClass = 0x7f040021;
public static int activityChooserViewStyle = 0x7f040022;
public static int alertDialogButtonGroupStyle = 0x7f040023;
public static int alertDialogCenterButtons = 0x7f040024;
public static int alertDialogStyle = 0x7f040025;
public static int alertDialogTheme = 0x7f040026;
public static int allowStacking = 0x7f040027;
public static int alpha = 0x7f040028;
public static int arrowHeadLength = 0x7f040029;
public static int arrowShaftLength = 0x7f04002a;
public static int autoCompleteTextViewStyle = 0x7f04002b;
public static int background = 0x7f04002c;
public static int backgroundSplit = 0x7f04002d;
public static int backgroundStacked = 0x7f04002e;
public static int backgroundTint = 0x7f04002f;
public static int backgroundTintMode = 0x7f040030;
public static int barLength = 0x7f040031;
public static int borderlessButtonStyle = 0x7f040032;
public static int buttonBarButtonStyle = 0x7f040033;
public static int buttonBarNegativeButtonStyle = 0x7f040034;
public static int buttonBarNeutralButtonStyle = 0x7f040035;
public static int buttonBarPositiveButtonStyle = 0x7f040036;
public static int buttonBarStyle = 0x7f040037;
public static int buttonGravity = 0x7f040038;
public static int buttonPanelSideLayout = 0x7f040039;
public static int buttonStyle = 0x7f04003a;
public static int buttonStyleSmall = 0x7f04003b;
public static int buttonTint = 0x7f04003c;
public static int buttonTintMode = 0x7f04003d;
public static int checkboxStyle = 0x7f04003e;
public static int checkedTextViewStyle = 0x7f04003f;
public static int closeIcon = 0x7f040040;
public static int closeItemLayout = 0x7f040041;
public static int collapseContentDescription = 0x7f040042;
public static int collapseIcon = 0x7f040043;
public static int color = 0x7f040044;
public static int colorAccent = 0x7f040045;
public static int colorBackgroundFloating = 0x7f040046;
public static int colorButtonNormal = 0x7f040047;
public static int colorControlActivated = 0x7f040048;
public static int colorControlHighlight = 0x7f040049;
public static int colorControlNormal = 0x7f04004a;
public static int colorPrimary = 0x7f04004b;
public static int colorPrimaryDark = 0x7f04004c;
public static int colorSwitchThumbNormal = 0x7f04004d;
public static int commitIcon = 0x7f04004e;
public static int contentInsetEnd = 0x7f04004f;
public static int contentInsetEndWithActions = 0x7f040050;
public static int contentInsetLeft = 0x7f040051;
public static int contentInsetRight = 0x7f040052;
public static int contentInsetStart = 0x7f040053;
public static int contentInsetStartWithNavigation = 0x7f040054;
public static int controlBackground = 0x7f040055;
public static int customNavigationLayout = 0x7f040056;
public static int defaultQueryHint = 0x7f040057;
public static int dialogPreferredPadding = 0x7f040058;
public static int dialogTheme = 0x7f040059;
public static int displayOptions = 0x7f04005a;
public static int divider = 0x7f04005b;
public static int dividerHorizontal = 0x7f04005c;
public static int dividerPadding = 0x7f04005d;
public static int dividerVertical = 0x7f04005e;
public static int drawableSize = 0x7f04005f;
public static int drawerArrowStyle = 0x7f040060;
public static int dropDownListViewStyle = 0x7f040061;
public static int dropdownListPreferredItemHeight = 0x7f040062;
public static int editTextBackground = 0x7f040063;
public static int editTextColor = 0x7f040064;
public static int editTextStyle = 0x7f040065;
public static int elevation = 0x7f040066;
public static int expandActivityOverflowButtonDrawable = 0x7f040067;
public static int gapBetweenBars = 0x7f040068;
public static int goIcon = 0x7f040069;
public static int height = 0x7f04006a;
public static int hideOnContentScroll = 0x7f04006b;
public static int homeAsUpIndicator = 0x7f04006c;
public static int homeLayout = 0x7f04006d;
public static int icon = 0x7f04006e;
public static int iconifiedByDefault = 0x7f04006f;
public static int imageButtonStyle = 0x7f040070;
public static int indeterminateProgressStyle = 0x7f040071;
public static int initialActivityCount = 0x7f040072;
public static int isLightTheme = 0x7f040073;
public static int itemPadding = 0x7f040074;
public static int layout = 0x7f040075;
public static int listChoiceBackgroundIndicator = 0x7f040076;
public static int listDividerAlertDialog = 0x7f040077;
public static int listItemLayout = 0x7f040078;
public static int listLayout = 0x7f040079;
public static int listMenuViewStyle = 0x7f04007a;
public static int listPopupWindowStyle = 0x7f04007b;
public static int listPreferredItemHeight = 0x7f04007c;
public static int listPreferredItemHeightLarge = 0x7f04007d;
public static int listPreferredItemHeightSmall = 0x7f04007e;
public static int listPreferredItemPaddingLeft = 0x7f04007f;
public static int listPreferredItemPaddingRight = 0x7f040080;
public static int logo = 0x7f040081;
public static int logoDescription = 0x7f040082;
public static int maxButtonHeight = 0x7f040083;
public static int measureWithLargestChild = 0x7f040084;
public static int multiChoiceItemLayout = 0x7f040085;
public static int navigationContentDescription = 0x7f040086;
public static int navigationIcon = 0x7f040087;
public static int navigationMode = 0x7f040088;
public static int overlapAnchor = 0x7f040089;
public static int paddingBottomNoButtons = 0x7f04008a;
public static int paddingEnd = 0x7f04008b;
public static int paddingStart = 0x7f04008c;
public static int paddingTopNoTitle = 0x7f04008d;
public static int panelBackground = 0x7f04008e;
public static int panelMenuListTheme = 0x7f04008f;
public static int panelMenuListWidth = 0x7f040090;
public static int popupMenuStyle = 0x7f040091;
public static int popupTheme = 0x7f040092;
public static int popupWindowStyle = 0x7f040093;
public static int preserveIconSpacing = 0x7f040094;
public static int progressBarPadding = 0x7f040095;
public static int progressBarStyle = 0x7f040096;
public static int queryBackground = 0x7f040097;
public static int queryHint = 0x7f040098;
public static int radioButtonStyle = 0x7f040099;
public static int ratingBarStyle = 0x7f04009a;
public static int ratingBarStyleIndicator = 0x7f04009b;
public static int ratingBarStyleSmall = 0x7f04009c;
public static int searchHintIcon = 0x7f04009d;
public static int searchIcon = 0x7f04009e;
public static int searchViewStyle = 0x7f04009f;
public static int seekBarStyle = 0x7f0400a0;
public static int selectableItemBackground = 0x7f0400a1;
public static int selectableItemBackgroundBorderless = 0x7f0400a2;
public static int showAsAction = 0x7f0400a3;
public static int showDividers = 0x7f0400a4;
public static int showText = 0x7f0400a5;
public static int showTitle = 0x7f0400a6;
public static int singleChoiceItemLayout = 0x7f0400a7;
public static int spinBars = 0x7f0400a8;
public static int spinnerDropDownItemStyle = 0x7f0400a9;
public static int spinnerStyle = 0x7f0400aa;
public static int splitTrack = 0x7f0400ab;
public static int srcCompat = 0x7f0400ac;
public static int state_above_anchor = 0x7f0400ad;
public static int subMenuArrow = 0x7f0400ae;
public static int submitBackground = 0x7f0400af;
public static int subtitle = 0x7f0400b0;
public static int subtitleTextAppearance = 0x7f0400b1;
public static int subtitleTextColor = 0x7f0400b2;
public static int subtitleTextStyle = 0x7f0400b3;
public static int suggestionRowLayout = 0x7f0400b4;
public static int switchMinWidth = 0x7f0400b5;
public static int switchPadding = 0x7f0400b6;
public static int switchStyle = 0x7f0400b7;
public static int switchTextAppearance = 0x7f0400b8;
public static int textAllCaps = 0x7f0400b9;
public static int textAppearanceLargePopupMenu = 0x7f0400ba;
public static int textAppearanceListItem = 0x7f0400bb;
public static int textAppearanceListItemSmall = 0x7f0400bc;
public static int textAppearancePopupMenuHeader = 0x7f0400bd;
public static int textAppearanceSearchResultSubtitle = 0x7f0400be;
public static int textAppearanceSearchResultTitle = 0x7f0400bf;
public static int textAppearanceSmallPopupMenu = 0x7f0400c0;
public static int textColorAlertDialogListItem = 0x7f0400c1;
public static int textColorSearchUrl = 0x7f0400c2;
public static int theme = 0x7f0400c3;
public static int thickness = 0x7f0400c4;
public static int thumbTextPadding = 0x7f0400c5;
public static int thumbTint = 0x7f0400c6;
public static int thumbTintMode = 0x7f0400c7;
public static int tickMark = 0x7f0400c8;
public static int tickMarkTint = 0x7f0400c9;
public static int tickMarkTintMode = 0x7f0400ca;
public static int title = 0x7f0400cb;
public static int titleMargin = 0x7f0400cc;
public static int titleMarginBottom = 0x7f0400cd;
public static int titleMarginEnd = 0x7f0400ce;
public static int titleMarginStart = 0x7f0400cf;
public static int titleMarginTop = 0x7f0400d0;
public static int titleMargins = 0x7f0400d1;
public static int titleTextAppearance = 0x7f0400d2;
public static int titleTextColor = 0x7f0400d3;
public static int titleTextStyle = 0x7f0400d4;
public static int toolbarNavigationButtonStyle = 0x7f0400d5;
public static int toolbarStyle = 0x7f0400d6;
public static int track = 0x7f0400d7;
public static int trackTint = 0x7f0400d8;
public static int trackTintMode = 0x7f0400d9;
public static int voiceIcon = 0x7f0400da;
public static int windowActionBar = 0x7f0400db;
public static int windowActionBarOverlay = 0x7f0400dc;
public static int windowActionModeOverlay = 0x7f0400dd;
public static int windowFixedHeightMajor = 0x7f0400de;
public static int windowFixedHeightMinor = 0x7f0400df;
public static int windowFixedWidthMajor = 0x7f0400e0;
public static int windowFixedWidthMinor = 0x7f0400e1;
public static int windowMinWidthMajor = 0x7f0400e2;
public static int windowMinWidthMinor = 0x7f0400e3;
public static int windowNoTitle = 0x7f0400e4;
}
public static final class bool {
public static int abc_action_bar_embed_tabs = 0x7f050001;
public static int abc_allow_stacked_button_bar = 0x7f050002;
public static int abc_config_actionMenuItemAllCaps = 0x7f050003;
public static int abc_config_closeDialogWhenTouchOutside = 0x7f050004;
public static int abc_config_showMenuShortcutsWhenKeyboardPresent = 0x7f050005;
}
public static final class color {
public static int abc_background_cache_hint_selector_material_dark = 0x7f060001;
public static int abc_background_cache_hint_selector_material_light = 0x7f060002;
public static int abc_btn_colored_borderless_text_material = 0x7f060003;
public static int abc_btn_colored_text_material = 0x7f060004;
public static int abc_color_highlight_material = 0x7f060005;
public static int abc_hint_foreground_material_dark = 0x7f060006;
public static int abc_hint_foreground_material_light = 0x7f060007;
public static int abc_input_method_navigation_guard = 0x7f060008;
public static int abc_primary_text_disable_only_material_dark = 0x7f060009;
public static int abc_primary_text_disable_only_material_light = 0x7f06000a;
public static int abc_primary_text_material_dark = 0x7f06000b;
public static int abc_primary_text_material_light = 0x7f06000c;
public static int abc_search_url_text = 0x7f06000d;
public static int abc_search_url_text_normal = 0x7f06000e;
public static int abc_search_url_text_pressed = 0x7f06000f;
public static int abc_search_url_text_selected = 0x7f060010;
public static int abc_secondary_text_material_dark = 0x7f060011;
public static int abc_secondary_text_material_light = 0x7f060012;
public static int abc_tint_btn_checkable = 0x7f060013;
public static int abc_tint_default = 0x7f060014;
public static int abc_tint_edittext = 0x7f060015;
public static int abc_tint_seek_thumb = 0x7f060016;
public static int abc_tint_spinner = 0x7f060017;
public static int abc_tint_switch_thumb = 0x7f060018;
public static int abc_tint_switch_track = 0x7f060019;
public static int accent_material_dark = 0x7f06001a;
public static int accent_material_light = 0x7f06001b;
public static int background_floating_material_dark = 0x7f06001c;
public static int background_floating_material_light = 0x7f06001d;
public static int background_material_dark = 0x7f06001e;
public static int background_material_light = 0x7f06001f;
public static int bright_foreground_disabled_material_dark = 0x7f060020;
public static int bright_foreground_disabled_material_light = 0x7f060021;
public static int bright_foreground_inverse_material_dark = 0x7f060022;
public static int bright_foreground_inverse_material_light = 0x7f060023;
public static int bright_foreground_material_dark = 0x7f060024;
public static int bright_foreground_material_light = 0x7f060025;
public static int button_material_dark = 0x7f060026;
public static int button_material_light = 0x7f060027;
public static int colorAccent = 0x7f060028;
public static int colorPrimary = 0x7f060029;
public static int colorPrimaryDark = 0x7f06002a;
public static int dim_foreground_disabled_material_dark = 0x7f06002b;
public static int dim_foreground_disabled_material_light = 0x7f06002c;
public static int dim_foreground_material_dark = 0x7f06002d;
public static int dim_foreground_material_light = 0x7f06002e;
public static int foreground_material_dark = 0x7f06002f;
public static int foreground_material_light = 0x7f060030;
public static int highlighted_text_material_dark = 0x7f060031;
public static int highlighted_text_material_light = 0x7f060032;
public static int material_blue_grey_800 = 0x7f060033;
public static int material_blue_grey_900 = 0x7f060034;
public static int material_blue_grey_950 = 0x7f060035;
public static int material_deep_teal_200 = 0x7f060036;
public static int material_deep_teal_500 = 0x7f060037;
public static int material_grey_100 = 0x7f060038;
public static int material_grey_300 = 0x7f060039;
public static int material_grey_50 = 0x7f06003a;
public static int material_grey_600 = 0x7f06003b;
public static int material_grey_800 = 0x7f06003c;
public static int material_grey_850 = 0x7f06003d;
public static int material_grey_900 = 0x7f06003e;
public static int notification_action_color_filter = 0x7f06003f;
public static int notification_icon_bg_color = 0x7f060040;
public static int notification_material_background_media_default_color = 0x7f060041;
public static int primary_dark_material_dark = 0x7f060042;
public static int primary_dark_material_light = 0x7f060043;
public static int primary_material_dark = 0x7f060044;
public static int primary_material_light = 0x7f060045;
public static int primary_text_default_material_dark = 0x7f060046;
public static int primary_text_default_material_light = 0x7f060047;
public static int primary_text_disabled_material_dark = 0x7f060048;
public static int primary_text_disabled_material_light = 0x7f060049;
public static int ripple_material_dark = 0x7f06004a;
public static int ripple_material_light = 0x7f06004b;
public static int secondary_text_default_material_dark = 0x7f06004c;
public static int secondary_text_default_material_light = 0x7f06004d;
public static int secondary_text_disabled_material_dark = 0x7f06004e;
public static int secondary_text_disabled_material_light = 0x7f06004f;
public static int switch_thumb_disabled_material_dark = 0x7f060050;
public static int switch_thumb_disabled_material_light = 0x7f060051;
public static int switch_thumb_material_dark = 0x7f060052;
public static int switch_thumb_material_light = 0x7f060053;
public static int switch_thumb_normal_material_dark = 0x7f060054;
public static int switch_thumb_normal_material_light = 0x7f060055;
}
public static final class dimen {
public static int abc_action_bar_content_inset_material = 0x7f080001;
public static int abc_action_bar_content_inset_with_nav = 0x7f080002;
public static int abc_action_bar_default_height_material = 0x7f080003;
public static int abc_action_bar_default_padding_end_material = 0x7f080004;
public static int abc_action_bar_default_padding_start_material = 0x7f080005;
public static int abc_action_bar_elevation_material = 0x7f080006;
public static int abc_action_bar_icon_vertical_padding_material = 0x7f080007;
public static int abc_action_bar_overflow_padding_end_material = 0x7f080008;
public static int abc_action_bar_overflow_padding_start_material = 0x7f080009;
public static int abc_action_bar_progress_bar_size = 0x7f08000a;
public static int abc_action_bar_stacked_max_height = 0x7f08000b;
public static int abc_action_bar_stacked_tab_max_width = 0x7f08000c;
public static int abc_action_bar_subtitle_bottom_margin_material = 0x7f08000d;
public static int abc_action_bar_subtitle_top_margin_material = 0x7f08000e;
public static int abc_action_button_min_height_material = 0x7f08000f;
public static int abc_action_button_min_width_material = 0x7f080010;
public static int abc_action_button_min_width_overflow_material = 0x7f080011;
public static int abc_alert_dialog_button_bar_height = 0x7f080012;
public static int abc_button_inset_horizontal_material = 0x7f080013;
public static int abc_button_inset_vertical_material = 0x7f080014;
public static int abc_button_padding_horizontal_material = 0x7f080015;
public static int abc_button_padding_vertical_material = 0x7f080016;
public static int abc_cascading_menus_min_smallest_width = 0x7f080017;
public static int abc_config_prefDialogWidth = 0x7f080018;
public static int abc_control_corner_material = 0x7f080019;
public static int abc_control_inset_material = 0x7f08001a;
public static int abc_control_padding_material = 0x7f08001b;
public static int abc_dialog_fixed_height_major = 0x7f08001c;
public static int abc_dialog_fixed_height_minor = 0x7f08001d;
public static int abc_dialog_fixed_width_major = 0x7f08001e;
public static int abc_dialog_fixed_width_minor = 0x7f08001f;
public static int abc_dialog_list_padding_bottom_no_buttons = 0x7f080020;
public static int abc_dialog_list_padding_top_no_title = 0x7f080021;
public static int abc_dialog_min_width_major = 0x7f080022;
public static int abc_dialog_min_width_minor = 0x7f080023;
public static int abc_dialog_padding_material = 0x7f080024;
public static int abc_dialog_padding_top_material = 0x7f080025;
public static int abc_dialog_title_divider_material = 0x7f080026;
public static int abc_disabled_alpha_material_dark = 0x7f080027;
public static int abc_disabled_alpha_material_light = 0x7f080028;
public static int abc_dropdownitem_icon_width = 0x7f080029;
public static int abc_dropdownitem_text_padding_left = 0x7f08002a;
public static int abc_dropdownitem_text_padding_right = 0x7f08002b;
public static int abc_edit_text_inset_bottom_material = 0x7f08002c;
public static int abc_edit_text_inset_horizontal_material = 0x7f08002d;
public static int abc_edit_text_inset_top_material = 0x7f08002e;
public static int abc_floating_window_z = 0x7f08002f;
public static int abc_list_item_padding_horizontal_material = 0x7f080030;
public static int abc_panel_menu_list_width = 0x7f080031;
public static int abc_progress_bar_height_material = 0x7f080032;
public static int abc_search_view_preferred_height = 0x7f080033;
public static int abc_search_view_preferred_width = 0x7f080034;
public static int abc_seekbar_track_background_height_material = 0x7f080035;
public static int abc_seekbar_track_progress_height_material = 0x7f080036;
public static int abc_select_dialog_padding_start_material = 0x7f080037;
public static int abc_switch_padding = 0x7f080038;
public static int abc_text_size_body_1_material = 0x7f080039;
public static int abc_text_size_body_2_material = 0x7f08003a;
public static int abc_text_size_button_material = 0x7f08003b;
public static int abc_text_size_caption_material = 0x7f08003c;
public static int abc_text_size_display_1_material = 0x7f08003d;
public static int abc_text_size_display_2_material = 0x7f08003e;
public static int abc_text_size_display_3_material = 0x7f08003f;
public static int abc_text_size_display_4_material = 0x7f080040;
public static int abc_text_size_headline_material = 0x7f080041;
public static int abc_text_size_large_material = 0x7f080042;
public static int abc_text_size_medium_material = 0x7f080043;
public static int abc_text_size_menu_header_material = 0x7f080044;
public static int abc_text_size_menu_material = 0x7f080045;
public static int abc_text_size_small_material = 0x7f080046;
public static int abc_text_size_subhead_material = 0x7f080047;
public static int abc_text_size_subtitle_material_toolbar = 0x7f080048;
public static int abc_text_size_title_material = 0x7f080049;
public static int abc_text_size_title_material_toolbar = 0x7f08004a;
public static int activity_horizontal_margin = 0x7f08004b;
public static int activity_vertical_margin = 0x7f08004c;
public static int disabled_alpha_material_dark = 0x7f08004d;
public static int disabled_alpha_material_light = 0x7f08004e;
public static int fab_margin = 0x7f08004f;
public static int highlight_alpha_material_colored = 0x7f080050;
public static int highlight_alpha_material_dark = 0x7f080051;
public static int highlight_alpha_material_light = 0x7f080052;
public static int hint_alpha_material_dark = 0x7f080053;
public static int hint_alpha_material_light = 0x7f080054;
public static int hint_pressed_alpha_material_dark = 0x7f080055;
public static int hint_pressed_alpha_material_light = 0x7f080056;
public static int notification_action_icon_size = 0x7f080057;
public static int notification_action_text_size = 0x7f080058;
public static int notification_big_circle_margin = 0x7f080059;
public static int notification_content_margin_start = 0x7f08005a;
public static int notification_large_icon_height = 0x7f08005b;
public static int notification_large_icon_width = 0x7f08005c;
public static int notification_main_column_padding_top = 0x7f08005d;
public static int notification_media_narrow_margin = 0x7f08005e;
public static int notification_right_icon_size = 0x7f08005f;
public static int notification_right_side_padding_top = 0x7f080060;
public static int notification_small_icon_background_padding = 0x7f080061;
public static int notification_small_icon_size_as_large = 0x7f080062;
public static int notification_subtext_size = 0x7f080063;
public static int notification_top_pad = 0x7f080064;
public static int notification_top_pad_large_text = 0x7f080065;
}
public static final class drawable {
public static int abc_ab_share_pack_mtrl_alpha = 0x7f090001;
public static int abc_action_bar_item_background_material = 0x7f090002;
public static int abc_btn_borderless_material = 0x7f090003;
public static int abc_btn_check_material = 0x7f090004;
public static int abc_btn_check_to_on_mtrl_000 = 0x7f090005;
public static int abc_btn_check_to_on_mtrl_015 = 0x7f090006;
public static int abc_btn_colored_material = 0x7f090007;
public static int abc_btn_default_mtrl_shape = 0x7f090008;
public static int abc_btn_radio_material = 0x7f090009;
public static int abc_btn_radio_to_on_mtrl_000 = 0x7f09000a;
public static int abc_btn_radio_to_on_mtrl_015 = 0x7f09000b;
public static int abc_btn_switch_to_on_mtrl_00001 = 0x7f09000c;
public static int abc_btn_switch_to_on_mtrl_00012 = 0x7f09000d;
public static int abc_cab_background_internal_bg = 0x7f09000e;
public static int abc_cab_background_top_material = 0x7f09000f;
public static int abc_cab_background_top_mtrl_alpha = 0x7f090010;
public static int abc_control_background_material = 0x7f090011;
public static int abc_dialog_material_background = 0x7f090012;
public static int abc_edit_text_material = 0x7f090013;
public static int abc_ic_ab_back_material = 0x7f090014;
public static int abc_ic_arrow_drop_right_black_24dp = 0x7f090015;
public static int abc_ic_clear_material = 0x7f090016;
public static int abc_ic_commit_search_api_mtrl_alpha = 0x7f090017;
public static int abc_ic_go_search_api_material = 0x7f090018;
public static int abc_ic_menu_copy_mtrl_am_alpha = 0x7f090019;
public static int abc_ic_menu_cut_mtrl_alpha = 0x7f09001a;
public static int abc_ic_menu_overflow_material = 0x7f09001b;
public static int abc_ic_menu_paste_mtrl_am_alpha = 0x7f09001c;
public static int abc_ic_menu_selectall_mtrl_alpha = 0x7f09001d;
public static int abc_ic_menu_share_mtrl_alpha = 0x7f09001e;
public static int abc_ic_search_api_material = 0x7f09001f;
public static int abc_ic_star_black_16dp = 0x7f090020;
public static int abc_ic_star_black_36dp = 0x7f090021;
public static int abc_ic_star_black_48dp = 0x7f090022;
public static int abc_ic_star_half_black_16dp = 0x7f090023;
public static int abc_ic_star_half_black_36dp = 0x7f090024;
public static int abc_ic_star_half_black_48dp = 0x7f090025;
public static int abc_ic_voice_search_api_material = 0x7f090026;
public static int abc_item_background_holo_dark = 0x7f090027;
public static int abc_item_background_holo_light = 0x7f090028;
public static int abc_list_divider_mtrl_alpha = 0x7f090029;
public static int abc_list_focused_holo = 0x7f09002a;
public static int abc_list_longpressed_holo = 0x7f09002b;
public static int abc_list_pressed_holo_dark = 0x7f09002c;
public static int abc_list_pressed_holo_light = 0x7f09002d;
public static int abc_list_selector_background_transition_holo_dark = 0x7f09002e;
public static int abc_list_selector_background_transition_holo_light = 0x7f09002f;
public static int abc_list_selector_disabled_holo_dark = 0x7f090030;
public static int abc_list_selector_disabled_holo_light = 0x7f090031;
public static int abc_list_selector_holo_dark = 0x7f090032;
public static int abc_list_selector_holo_light = 0x7f090033;
public static int abc_menu_hardkey_panel_mtrl_mult = 0x7f090034;
public static int abc_popup_background_mtrl_mult = 0x7f090035;
public static int abc_ratingbar_indicator_material = 0x7f090036;
public static int abc_ratingbar_material = 0x7f090037;
public static int abc_ratingbar_small_material = 0x7f090038;
public static int abc_scrubber_control_off_mtrl_alpha = 0x7f090039;
public static int abc_scrubber_control_to_pressed_mtrl_000 = 0x7f09003a;
public static int abc_scrubber_control_to_pressed_mtrl_005 = 0x7f09003b;
public static int abc_scrubber_primary_mtrl_alpha = 0x7f09003c;
public static int abc_scrubber_track_mtrl_alpha = 0x7f09003d;
public static int abc_seekbar_thumb_material = 0x7f09003e;
public static int abc_seekbar_tick_mark_material = 0x7f09003f;
public static int abc_seekbar_track_material = 0x7f090040;
public static int abc_spinner_mtrl_am_alpha = 0x7f090041;
public static int abc_spinner_textfield_background_material = 0x7f090042;
public static int abc_switch_thumb_material = 0x7f090043;
public static int abc_switch_track_mtrl_alpha = 0x7f090044;
public static int abc_tab_indicator_material = 0x7f090045;
public static int abc_tab_indicator_mtrl_alpha = 0x7f090046;
public static int abc_text_cursor_material = 0x7f090047;
public static int abc_text_select_handle_left_mtrl_dark = 0x7f090048;
public static int abc_text_select_handle_left_mtrl_light = 0x7f090049;
public static int abc_text_select_handle_middle_mtrl_dark = 0x7f09004a;
public static int abc_text_select_handle_middle_mtrl_light = 0x7f09004b;
public static int abc_text_select_handle_right_mtrl_dark = 0x7f09004c;
public static int abc_text_select_handle_right_mtrl_light = 0x7f09004d;
public static int abc_textfield_activated_mtrl_alpha = 0x7f09004e;
public static int abc_textfield_default_mtrl_alpha = 0x7f09004f;
public static int abc_textfield_search_activated_mtrl_alpha = 0x7f090050;
public static int abc_textfield_search_default_mtrl_alpha = 0x7f090051;
public static int abc_textfield_search_material = 0x7f090052;
public static int abc_vector_test = 0x7f090053;
public static int custom_dialog_bg = 0x7f090054;
public static int my_main_news = 0x7f090055;
public static int notification_action_background = 0x7f090056;
public static int notification_bg = 0x7f090057;
public static int notification_bg_low = 0x7f090058;
public static int notification_bg_low_normal = 0x7f090059;
public static int notification_bg_low_pressed = 0x7f09005a;
public static int notification_bg_normal = 0x7f09005b;
public static int notification_bg_normal_pressed = 0x7f09005c;
public static int notification_icon_background = 0x7f09005d;
public static int notification_template_icon_bg = 0x7f09005e;
public static int notification_template_icon_low_bg = 0x7f09005f;
public static int notification_tile_bg = 0x7f090060;
public static int notify_panel_notification_icon_bg = 0x7f090061;
public static int rockect_create = 0x7f090062;
public static int shape_cornor_circle = 0x7f090063;
}
public static final class id {
public static int action0 = 0x7f0c0001;
public static int action_bar = 0x7f0c0002;
public static int action_bar_activity_content = 0x7f0c0003;
public static int action_bar_container = 0x7f0c0004;
public static int action_bar_root = 0x7f0c0005;
public static int action_bar_spinner = 0x7f0c0006;
public static int action_bar_subtitle = 0x7f0c0007;
public static int action_bar_title = 0x7f0c0008;
public static int action_container = 0x7f0c0009;
public static int action_context_bar = 0x7f0c000a;
public static int action_divider = 0x7f0c000b;
public static int action_image = 0x7f0c000c;
public static int action_menu_divider = 0x7f0c000d;
public static int action_menu_presenter = 0x7f0c000e;
public static int action_mode_bar = 0x7f0c000f;
public static int action_mode_bar_stub = 0x7f0c0010;
public static int action_mode_close_button = 0x7f0c0011;
public static int action_text = 0x7f0c0012;
public static int actions = 0x7f0c0013;
public static int activity_chooser_view_content = 0x7f0c0014;
public static int add = 0x7f0c0015;
public static int alertTitle = 0x7f0c0016;
public static int always = 0x7f0c0017;
public static int beginning = 0x7f0c0018;
public static int bottom = 0x7f0c0019;
public static int buttonPanel = 0x7f0c001a;
public static int cancel_action = 0x7f0c001b;
public static int checkbox = 0x7f0c001c;
public static int chronometer = 0x7f0c001d;
public static int collapseActionView = 0x7f0c001e;
public static int contentPanel = 0x7f0c001f;
public static int custom = 0x7f0c0020;
public static int customPanel = 0x7f0c0021;
public static int decor_content_parent = 0x7f0c0022;
public static int default_activity_button = 0x7f0c0023;
public static int disableHome = 0x7f0c0024;
public static int edit_query = 0x7f0c0025;
public static int end = 0x7f0c0026;
public static int end_padder = 0x7f0c0027;
public static int expand_activities_button = 0x7f0c0028;
public static int expanded_menu = 0x7f0c0029;
public static int home = 0x7f0c002e;
public static int homeAsUp = 0x7f0c002f;
public static int icon = 0x7f0c0030;
public static int icon_group = 0x7f0c0031;
public static int ifRoom = 0x7f0c0032;
public static int image = 0x7f0c0033;
public static int info = 0x7f0c0034;
public static int line1 = 0x7f0c0035;
public static int line3 = 0x7f0c0036;
public static int listMode = 0x7f0c0037;
public static int list_item = 0x7f0c0038;
public static int media_actions = 0x7f0c0039;
public static int middle = 0x7f0c003a;
public static int multiply = 0x7f0c003b;
public static int never = 0x7f0c003c;
public static int none = 0x7f0c003d;
public static int normal = 0x7f0c003e;
public static int notification_background = 0x7f0c003f;
public static int notification_main_column = 0x7f0c0040;
public static int notification_main_column_container = 0x7f0c0041;
public static int parentPanel = 0x7f0c0042;
public static int progress_circular = 0x7f0c0043;
public static int progress_horizontal = 0x7f0c0044;
public static int radio = 0x7f0c0045;
public static int right_icon = 0x7f0c0046;
public static int right_side = 0x7f0c0047;
public static int screen = 0x7f0c0048;
public static int scrollIndicatorDown = 0x7f0c0049;
public static int scrollIndicatorUp = 0x7f0c004a;
public static int scrollView = 0x7f0c004b;
public static int search_badge = 0x7f0c004c;
public static int search_bar = 0x7f0c004d;
public static int search_button = 0x7f0c004e;
public static int search_close_btn = 0x7f0c004f;
public static int search_edit_frame = 0x7f0c0050;
public static int search_go_btn = 0x7f0c0051;
public static int search_mag_icon = 0x7f0c0052;
public static int search_plate = 0x7f0c0053;
public static int search_src_text = 0x7f0c0054;
public static int search_voice_btn = 0x7f0c0055;
public static int select_dialog_listview = 0x7f0c0056;
public static int shortcut = 0x7f0c0057;
public static int showCustom = 0x7f0c0058;
public static int showHome = 0x7f0c0059;
public static int showTitle = 0x7f0c005a;
public static int spacer = 0x7f0c005b;
public static int split_action_bar = 0x7f0c005c;
public static int src_atop = 0x7f0c005d;
public static int src_in = 0x7f0c005e;
public static int src_over = 0x7f0c005f;
public static int status_bar_latest_event_content = 0x7f0c0060;
public static int submenuarrow = 0x7f0c0061;
public static int submit_area = 0x7f0c0062;
public static int tabMode = 0x7f0c0063;
public static int text = 0x7f0c0064;
public static int text2 = 0x7f0c0065;
public static int textSpacerNoButtons = 0x7f0c0066;
public static int textSpacerNoTitle = 0x7f0c0067;
public static int time = 0x7f0c0068;
public static int title = 0x7f0c0069;
public static int titleDividerNoCustom = 0x7f0c006a;
public static int title_template = 0x7f0c006b;
public static int top = 0x7f0c006c;
public static int topPanel = 0x7f0c006d;
public static int up = 0x7f0c006e;
public static int useLogo = 0x7f0c006f;
public static int wifi_5g_create_button = 0x7f0c0070;
public static int wifi_5g_dialog_summary = 0x7f0c0071;
public static int wifi_5g_dialog_title = 0x7f0c0072;
public static int withText = 0x7f0c0073;
public static int wrap_content = 0x7f0c0074;
}
public static final class integer {
public static int abc_config_activityDefaultDur = 0x7f0d0001;
public static int abc_config_activityShortDur = 0x7f0d0002;
public static int cancel_button_image_alpha = 0x7f0d0003;
public static int status_bar_notification_info_maxnum = 0x7f0d0004;
}
public static final class layout {
public static int abc_action_bar_title_item = 0x7f0f0001;
public static int abc_action_bar_up_container = 0x7f0f0002;
public static int abc_action_bar_view_list_nav_layout = 0x7f0f0003;
public static int abc_action_menu_item_layout = 0x7f0f0004;
public static int abc_action_menu_layout = 0x7f0f0005;
public static int abc_action_mode_bar = 0x7f0f0006;
public static int abc_action_mode_close_item_material = 0x7f0f0007;
public static int abc_activity_chooser_view = 0x7f0f0008;
public static int abc_activity_chooser_view_list_item = 0x7f0f0009;
public static int abc_alert_dialog_button_bar_material = 0x7f0f000a;
public static int abc_alert_dialog_material = 0x7f0f000b;
public static int abc_alert_dialog_title_material = 0x7f0f000c;
public static int abc_dialog_title_material = 0x7f0f000d;
public static int abc_expanded_menu_layout = 0x7f0f000e;
public static int abc_list_menu_item_checkbox = 0x7f0f000f;
public static int abc_list_menu_item_icon = 0x7f0f0010;
public static int abc_list_menu_item_layout = 0x7f0f0011;
public static int abc_list_menu_item_radio = 0x7f0f0012;
public static int abc_popup_menu_header_item_layout = 0x7f0f0013;
public static int abc_popup_menu_item_layout = 0x7f0f0014;
public static int abc_screen_content_include = 0x7f0f0015;
public static int abc_screen_simple = 0x7f0f0016;
public static int abc_screen_simple_overlay_action_mode = 0x7f0f0017;
public static int abc_screen_toolbar = 0x7f0f0018;
public static int abc_search_dropdown_item_icons_2line = 0x7f0f0019;
public static int abc_search_view = 0x7f0f001a;
public static int abc_select_dialog_material = 0x7f0f001b;
public static int build_5g_wifi_dialog_view = 0x7f0f001d;
public static int notification_action = 0x7f0f001e;
public static int notification_action_tombstone = 0x7f0f001f;
public static int notification_media_action = 0x7f0f0020;
public static int notification_media_cancel_action = 0x7f0f0021;
public static int notification_template_big_media = 0x7f0f0022;
public static int notification_template_big_media_custom = 0x7f0f0023;
public static int notification_template_big_media_narrow = 0x7f0f0024;
public static int notification_template_big_media_narrow_custom = 0x7f0f0025;
public static int notification_template_custom_big = 0x7f0f0026;
public static int notification_template_icon_group = 0x7f0f0027;
public static int notification_template_lines_media = 0x7f0f0028;
public static int notification_template_media = 0x7f0f0029;
public static int notification_template_media_custom = 0x7f0f002a;
public static int notification_template_part_chronometer = 0x7f0f002b;
public static int notification_template_part_time = 0x7f0f002c;
public static int select_dialog_item_material = 0x7f0f002d;
public static int select_dialog_multichoice_material = 0x7f0f002e;
public static int select_dialog_singlechoice_material = 0x7f0f002f;
public static int support_simple_spinner_dropdown_item = 0x7f0f0030;
}
public static final class mipmap {
public static int ic_launcher = 0x7f110001;
}
public static final class string {
public static int abc_action_bar_home_description = 0x7f150001;
public static int abc_action_bar_home_description_format = 0x7f150002;
public static int abc_action_bar_home_subtitle_description_format = 0x7f150003;
public static int abc_action_bar_up_description = 0x7f150004;
public static int abc_action_menu_overflow_description = 0x7f150005;
public static int abc_action_mode_done = 0x7f150006;
public static int abc_activity_chooser_view_see_all = 0x7f150007;
public static int abc_activitychooserview_choose_application = 0x7f150008;
public static int abc_capital_off = 0x7f150009;
public static int abc_capital_on = 0x7f15000a;
public static int abc_font_family_body_1_material = 0x7f15000b;
public static int abc_font_family_body_2_material = 0x7f15000c;
public static int abc_font_family_button_material = 0x7f15000d;
public static int abc_font_family_caption_material = 0x7f15000e;
public static int abc_font_family_display_1_material = 0x7f15000f;
public static int abc_font_family_display_2_material = 0x7f150010;
public static int abc_font_family_display_3_material = 0x7f150011;
public static int abc_font_family_display_4_material = 0x7f150012;
public static int abc_font_family_headline_material = 0x7f150013;
public static int abc_font_family_menu_material = 0x7f150014;
public static int abc_font_family_subhead_material = 0x7f150015;
public static int abc_font_family_title_material = 0x7f150016;
public static int abc_search_hint = 0x7f150017;
public static int abc_searchview_description_clear = 0x7f150018;
public static int abc_searchview_description_query = 0x7f150019;
public static int abc_searchview_description_search = 0x7f15001a;
public static int abc_searchview_description_submit = 0x7f15001b;
public static int abc_searchview_description_voice = 0x7f15001c;
public static int abc_shareactionprovider_share_with = 0x7f15001d;
public static int abc_shareactionprovider_share_with_application = 0x7f15001e;
public static int abc_toolbar_collapse_description = 0x7f15001f;
public static int app_name = 0x7f150020;
public static int asset_statements = 0x7f150021;
public static int build_5g_wifi_summary = 0x7f150022;
public static int build_5g_wifi_title = 0x7f150023;
public static int goodbye_instant_world = 0x7f150024;
public static int hello_base_module = 0x7f150025;
public static int hello_instant_world = 0x7f150026;
public static int nothing_to_see = 0x7f150027;
public static int search_menu_title = 0x7f150028;
public static int status_bar_notification_info_overflow = 0x7f150029;
public static int title_activity_goodbye = 0x7f15002a;
public static int title_activity_hello = 0x7f15002b;
public static int whats_this = 0x7f15002c;
}
public static final class style {
public static int AlertDialog_AppCompat = 0x7f160001;
public static int AlertDialog_AppCompat_Light = 0x7f160002;
public static int Animation_AppCompat_Dialog = 0x7f160003;
public static int Animation_AppCompat_DropDownUp = 0x7f160004;
public static int AppTheme = 0x7f160005;
public static int Base_AlertDialog_AppCompat = 0x7f160006;
public static int Base_AlertDialog_AppCompat_Light = 0x7f160007;
public static int Base_Animation_AppCompat_Dialog = 0x7f160008;
public static int Base_Animation_AppCompat_DropDownUp = 0x7f160009;
public static int Base_DialogWindowTitleBackground_AppCompat = 0x7f16000a;
public static int Base_DialogWindowTitle_AppCompat = 0x7f16000b;
public static int Base_TextAppearance_AppCompat = 0x7f16000c;
public static int Base_TextAppearance_AppCompat_Body1 = 0x7f16000d;
public static int Base_TextAppearance_AppCompat_Body2 = 0x7f16000e;
public static int Base_TextAppearance_AppCompat_Button = 0x7f16000f;
public static int Base_TextAppearance_AppCompat_Caption = 0x7f160010;
public static int Base_TextAppearance_AppCompat_Display1 = 0x7f160011;
public static int Base_TextAppearance_AppCompat_Display2 = 0x7f160012;
public static int Base_TextAppearance_AppCompat_Display3 = 0x7f160013;
public static int Base_TextAppearance_AppCompat_Display4 = 0x7f160014;
public static int Base_TextAppearance_AppCompat_Headline = 0x7f160015;
public static int Base_TextAppearance_AppCompat_Inverse = 0x7f160016;
public static int Base_TextAppearance_AppCompat_Large = 0x7f160017;
public static int Base_TextAppearance_AppCompat_Large_Inverse = 0x7f160018;
public static int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f160019;
public static int Base_TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f16001a;
public static int Base_TextAppearance_AppCompat_Medium = 0x7f16001b;
public static int Base_TextAppearance_AppCompat_Medium_Inverse = 0x7f16001c;
public static int Base_TextAppearance_AppCompat_Menu = 0x7f16001d;
public static int Base_TextAppearance_AppCompat_SearchResult = 0x7f16001e;
public static int Base_TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f16001f;
public static int Base_TextAppearance_AppCompat_SearchResult_Title = 0x7f160020;
public static int Base_TextAppearance_AppCompat_Small = 0x7f160021;
public static int Base_TextAppearance_AppCompat_Small_Inverse = 0x7f160022;
public static int Base_TextAppearance_AppCompat_Subhead = 0x7f160023;
public static int Base_TextAppearance_AppCompat_Subhead_Inverse = 0x7f160024;
public static int Base_TextAppearance_AppCompat_Title = 0x7f160025;
public static int Base_TextAppearance_AppCompat_Title_Inverse = 0x7f160026;
public static int Base_TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f160027;
public static int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f160028;
public static int Base_TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f160029;
public static int Base_TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f16002a;
public static int Base_TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f16002b;
public static int Base_TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f16002c;
public static int Base_TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f16002d;
public static int Base_TextAppearance_AppCompat_Widget_Button = 0x7f16002e;
public static int Base_TextAppearance_AppCompat_Widget_Button_Borderless_Colored = 0x7f16002f;
public static int Base_TextAppearance_AppCompat_Widget_Button_Colored = 0x7f160030;
public static int Base_TextAppearance_AppCompat_Widget_Button_Inverse = 0x7f160031;
public static int Base_TextAppearance_AppCompat_Widget_DropDownItem = 0x7f160032;
public static int Base_TextAppearance_AppCompat_Widget_PopupMenu_Header = 0x7f160033;
public static int Base_TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f160034;
public static int Base_TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f160035;
public static int Base_TextAppearance_AppCompat_Widget_Switch = 0x7f160036;
public static int Base_TextAppearance_AppCompat_Widget_TextView_SpinnerItem = 0x7f160037;
public static int Base_TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f160038;
public static int Base_TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 0x7f160039;
public static int Base_TextAppearance_Widget_AppCompat_Toolbar_Title = 0x7f16003a;
public static int Base_ThemeOverlay_AppCompat = 0x7f16003b;
public static int Base_ThemeOverlay_AppCompat_ActionBar = 0x7f16003c;
public static int Base_ThemeOverlay_AppCompat_Dark = 0x7f16003d;
public static int Base_ThemeOverlay_AppCompat_Dark_ActionBar = 0x7f16003e;
public static int Base_ThemeOverlay_AppCompat_Dialog = 0x7f16003f;
public static int Base_ThemeOverlay_AppCompat_Dialog_Alert = 0x7f160040;
public static int Base_ThemeOverlay_AppCompat_Light = 0x7f160041;
public static int Base_Theme_AppCompat = 0x7f160042;
public static int Base_Theme_AppCompat_CompactMenu = 0x7f160043;
public static int Base_Theme_AppCompat_Dialog = 0x7f160044;
public static int Base_Theme_AppCompat_DialogWhenLarge = 0x7f160045;
public static int Base_Theme_AppCompat_Dialog_Alert = 0x7f160046;
public static int Base_Theme_AppCompat_Dialog_FixedSize = 0x7f160047;
public static int Base_Theme_AppCompat_Dialog_MinWidth = 0x7f160048;
public static int Base_Theme_AppCompat_Light = 0x7f160049;
public static int Base_Theme_AppCompat_Light_DarkActionBar = 0x7f16004a;
public static int Base_Theme_AppCompat_Light_Dialog = 0x7f16004b;
public static int Base_Theme_AppCompat_Light_DialogWhenLarge = 0x7f16004c;
public static int Base_Theme_AppCompat_Light_Dialog_Alert = 0x7f16004d;
public static int Base_Theme_AppCompat_Light_Dialog_FixedSize = 0x7f16004e;
public static int Base_Theme_AppCompat_Light_Dialog_MinWidth = 0x7f16004f;
public static int Base_V11_ThemeOverlay_AppCompat_Dialog = 0x7f160050;
public static int Base_V11_Theme_AppCompat_Dialog = 0x7f160051;
public static int Base_V11_Theme_AppCompat_Light_Dialog = 0x7f160052;
public static int Base_V12_Widget_AppCompat_AutoCompleteTextView = 0x7f160053;
public static int Base_V12_Widget_AppCompat_EditText = 0x7f160054;
public static int Base_V21_ThemeOverlay_AppCompat_Dialog = 0x7f160055;
public static int Base_V21_Theme_AppCompat = 0x7f160056;
public static int Base_V21_Theme_AppCompat_Dialog = 0x7f160057;
public static int Base_V21_Theme_AppCompat_Light = 0x7f160058;
public static int Base_V21_Theme_AppCompat_Light_Dialog = 0x7f160059;
public static int Base_V22_Theme_AppCompat = 0x7f16005a;
public static int Base_V22_Theme_AppCompat_Light = 0x7f16005b;
public static int Base_V23_Theme_AppCompat = 0x7f16005c;
public static int Base_V23_Theme_AppCompat_Light = 0x7f16005d;
public static int Base_V7_ThemeOverlay_AppCompat_Dialog = 0x7f16005e;
public static int Base_V7_Theme_AppCompat = 0x7f16005f;
public static int Base_V7_Theme_AppCompat_Dialog = 0x7f160060;
public static int Base_V7_Theme_AppCompat_Light = 0x7f160061;
public static int Base_V7_Theme_AppCompat_Light_Dialog = 0x7f160062;
public static int Base_V7_Widget_AppCompat_AutoCompleteTextView = 0x7f160063;
public static int Base_V7_Widget_AppCompat_EditText = 0x7f160064;
public static int Base_Widget_AppCompat_ActionBar = 0x7f160065;
public static int Base_Widget_AppCompat_ActionBar_Solid = 0x7f160066;
public static int Base_Widget_AppCompat_ActionBar_TabBar = 0x7f160067;
public static int Base_Widget_AppCompat_ActionBar_TabText = 0x7f160068;
public static int Base_Widget_AppCompat_ActionBar_TabView = 0x7f160069;
public static int Base_Widget_AppCompat_ActionButton = 0x7f16006a;
public static int Base_Widget_AppCompat_ActionButton_CloseMode = 0x7f16006b;
public static int Base_Widget_AppCompat_ActionButton_Overflow = 0x7f16006c;
public static int Base_Widget_AppCompat_ActionMode = 0x7f16006d;
public static int Base_Widget_AppCompat_ActivityChooserView = 0x7f16006e;
public static int Base_Widget_AppCompat_AutoCompleteTextView = 0x7f16006f;
public static int Base_Widget_AppCompat_Button = 0x7f160070;
public static int Base_Widget_AppCompat_ButtonBar = 0x7f160071;
public static int Base_Widget_AppCompat_ButtonBar_AlertDialog = 0x7f160072;
public static int Base_Widget_AppCompat_Button_Borderless = 0x7f160073;
public static int Base_Widget_AppCompat_Button_Borderless_Colored = 0x7f160074;
public static int Base_Widget_AppCompat_Button_ButtonBar_AlertDialog = 0x7f160075;
public static int Base_Widget_AppCompat_Button_Colored = 0x7f160076;
public static int Base_Widget_AppCompat_Button_Small = 0x7f160077;
public static int Base_Widget_AppCompat_CompoundButton_CheckBox = 0x7f160078;
public static int Base_Widget_AppCompat_CompoundButton_RadioButton = 0x7f160079;
public static int Base_Widget_AppCompat_CompoundButton_Switch = 0x7f16007a;
public static int Base_Widget_AppCompat_DrawerArrowToggle = 0x7f16007b;
public static int Base_Widget_AppCompat_DrawerArrowToggle_Common = 0x7f16007c;
public static int Base_Widget_AppCompat_DropDownItem_Spinner = 0x7f16007d;
public static int Base_Widget_AppCompat_EditText = 0x7f16007e;
public static int Base_Widget_AppCompat_ImageButton = 0x7f16007f;
public static int Base_Widget_AppCompat_Light_ActionBar = 0x7f160080;
public static int Base_Widget_AppCompat_Light_ActionBar_Solid = 0x7f160081;
public static int Base_Widget_AppCompat_Light_ActionBar_TabBar = 0x7f160082;
public static int Base_Widget_AppCompat_Light_ActionBar_TabText = 0x7f160083;
public static int Base_Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f160084;
public static int Base_Widget_AppCompat_Light_ActionBar_TabView = 0x7f160085;
public static int Base_Widget_AppCompat_Light_PopupMenu = 0x7f160086;
public static int Base_Widget_AppCompat_Light_PopupMenu_Overflow = 0x7f160087;
public static int Base_Widget_AppCompat_ListMenuView = 0x7f160088;
public static int Base_Widget_AppCompat_ListPopupWindow = 0x7f160089;
public static int Base_Widget_AppCompat_ListView = 0x7f16008a;
public static int Base_Widget_AppCompat_ListView_DropDown = 0x7f16008b;
public static int Base_Widget_AppCompat_ListView_Menu = 0x7f16008c;
public static int Base_Widget_AppCompat_PopupMenu = 0x7f16008d;
public static int Base_Widget_AppCompat_PopupMenu_Overflow = 0x7f16008e;
public static int Base_Widget_AppCompat_PopupWindow = 0x7f16008f;
public static int Base_Widget_AppCompat_ProgressBar = 0x7f160090;
public static int Base_Widget_AppCompat_ProgressBar_Horizontal = 0x7f160091;
public static int Base_Widget_AppCompat_RatingBar = 0x7f160092;
public static int Base_Widget_AppCompat_RatingBar_Indicator = 0x7f160093;
public static int Base_Widget_AppCompat_RatingBar_Small = 0x7f160094;
public static int Base_Widget_AppCompat_SearchView = 0x7f160095;
public static int Base_Widget_AppCompat_SearchView_ActionBar = 0x7f160096;
public static int Base_Widget_AppCompat_SeekBar = 0x7f160097;
public static int Base_Widget_AppCompat_SeekBar_Discrete = 0x7f160098;
public static int Base_Widget_AppCompat_Spinner = 0x7f160099;
public static int Base_Widget_AppCompat_Spinner_Underlined = 0x7f16009a;
public static int Base_Widget_AppCompat_TextView_SpinnerItem = 0x7f16009b;
public static int Base_Widget_AppCompat_Toolbar = 0x7f16009c;
public static int Base_Widget_AppCompat_Toolbar_Button_Navigation = 0x7f16009d;
public static int Platform_AppCompat = 0x7f16009e;
public static int Platform_AppCompat_Light = 0x7f16009f;
public static int Platform_ThemeOverlay_AppCompat = 0x7f1600a0;
public static int Platform_ThemeOverlay_AppCompat_Dark = 0x7f1600a1;
public static int Platform_ThemeOverlay_AppCompat_Light = 0x7f1600a2;
public static int Platform_V11_AppCompat = 0x7f1600a3;
public static int Platform_V11_AppCompat_Light = 0x7f1600a4;
public static int Platform_V14_AppCompat = 0x7f1600a5;
public static int Platform_V14_AppCompat_Light = 0x7f1600a6;
public static int Platform_V21_AppCompat = 0x7f1600a7;
public static int Platform_V21_AppCompat_Light = 0x7f1600a8;
public static int Platform_V25_AppCompat = 0x7f1600a9;
public static int Platform_V25_AppCompat_Light = 0x7f1600aa;
public static int Platform_Widget_AppCompat_Spinner = 0x7f1600ab;
public static int RtlOverlay_DialogWindowTitle_AppCompat = 0x7f1600ac;
public static int RtlOverlay_Widget_AppCompat_ActionBar_TitleItem = 0x7f1600ad;
public static int RtlOverlay_Widget_AppCompat_DialogTitle_Icon = 0x7f1600ae;
public static int RtlOverlay_Widget_AppCompat_PopupMenuItem = 0x7f1600af;
public static int RtlOverlay_Widget_AppCompat_PopupMenuItem_InternalGroup = 0x7f1600b0;
public static int RtlOverlay_Widget_AppCompat_PopupMenuItem_Text = 0x7f1600b1;
public static int RtlOverlay_Widget_AppCompat_SearchView_MagIcon = 0x7f1600b2;
public static int RtlOverlay_Widget_AppCompat_Search_DropDown = 0x7f1600b3;
public static int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon1 = 0x7f1600b4;
public static int RtlOverlay_Widget_AppCompat_Search_DropDown_Icon2 = 0x7f1600b5;
public static int RtlOverlay_Widget_AppCompat_Search_DropDown_Query = 0x7f1600b6;
public static int RtlOverlay_Widget_AppCompat_Search_DropDown_Text = 0x7f1600b7;
public static int RtlUnderlay_Widget_AppCompat_ActionButton = 0x7f1600b8;
public static int RtlUnderlay_Widget_AppCompat_ActionButton_Overflow = 0x7f1600b9;
public static int TextAppearance_AppCompat = 0x7f1600ba;
public static int TextAppearance_AppCompat_Body1 = 0x7f1600bb;
public static int TextAppearance_AppCompat_Body2 = 0x7f1600bc;
public static int TextAppearance_AppCompat_Button = 0x7f1600bd;
public static int TextAppearance_AppCompat_Caption = 0x7f1600be;
public static int TextAppearance_AppCompat_Display1 = 0x7f1600bf;
public static int TextAppearance_AppCompat_Display2 = 0x7f1600c0;
public static int TextAppearance_AppCompat_Display3 = 0x7f1600c1;
public static int TextAppearance_AppCompat_Display4 = 0x7f1600c2;
public static int TextAppearance_AppCompat_Headline = 0x7f1600c3;
public static int TextAppearance_AppCompat_Inverse = 0x7f1600c4;
public static int TextAppearance_AppCompat_Large = 0x7f1600c5;
public static int TextAppearance_AppCompat_Large_Inverse = 0x7f1600c6;
public static int TextAppearance_AppCompat_Light_SearchResult_Subtitle = 0x7f1600c7;
public static int TextAppearance_AppCompat_Light_SearchResult_Title = 0x7f1600c8;
public static int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large = 0x7f1600c9;
public static int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small = 0x7f1600ca;
public static int TextAppearance_AppCompat_Medium = 0x7f1600cb;
public static int TextAppearance_AppCompat_Medium_Inverse = 0x7f1600cc;
public static int TextAppearance_AppCompat_Menu = 0x7f1600cd;
public static int TextAppearance_AppCompat_Notification = 0x7f1600ce;
public static int TextAppearance_AppCompat_Notification_Info = 0x7f1600cf;
public static int TextAppearance_AppCompat_Notification_Info_Media = 0x7f1600d0;
public static int TextAppearance_AppCompat_Notification_Line2 = 0x7f1600d1;
public static int TextAppearance_AppCompat_Notification_Line2_Media = 0x7f1600d2;
public static int TextAppearance_AppCompat_Notification_Media = 0x7f1600d3;
public static int TextAppearance_AppCompat_Notification_Time = 0x7f1600d4;
public static int TextAppearance_AppCompat_Notification_Time_Media = 0x7f1600d5;
public static int TextAppearance_AppCompat_Notification_Title = 0x7f1600d6;
public static int TextAppearance_AppCompat_Notification_Title_Media = 0x7f1600d7;
public static int TextAppearance_AppCompat_SearchResult_Subtitle = 0x7f1600d8;
public static int TextAppearance_AppCompat_SearchResult_Title = 0x7f1600d9;
public static int TextAppearance_AppCompat_Small = 0x7f1600da;
public static int TextAppearance_AppCompat_Small_Inverse = 0x7f1600db;
public static int TextAppearance_AppCompat_Subhead = 0x7f1600dc;
public static int TextAppearance_AppCompat_Subhead_Inverse = 0x7f1600dd;
public static int TextAppearance_AppCompat_Title = 0x7f1600de;
public static int TextAppearance_AppCompat_Title_Inverse = 0x7f1600df;
public static int TextAppearance_AppCompat_Widget_ActionBar_Menu = 0x7f1600e0;
public static int TextAppearance_AppCompat_Widget_ActionBar_Subtitle = 0x7f1600e1;
public static int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse = 0x7f1600e2;
public static int TextAppearance_AppCompat_Widget_ActionBar_Title = 0x7f1600e3;
public static int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse = 0x7f1600e4;
public static int TextAppearance_AppCompat_Widget_ActionMode_Subtitle = 0x7f1600e5;
public static int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse = 0x7f1600e6;
public static int TextAppearance_AppCompat_Widget_ActionMode_Title = 0x7f1600e7;
public static int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse = 0x7f1600e8;
public static int TextAppearance_AppCompat_Widget_Button = 0x7f1600e9;
public static int TextAppearance_AppCompat_Widget_Button_Borderless_Colored = 0x7f1600ea;
public static int TextAppearance_AppCompat_Widget_Button_Colored = 0x7f1600eb;
public static int TextAppearance_AppCompat_Widget_Button_Inverse = 0x7f1600ec;
public static int TextAppearance_AppCompat_Widget_DropDownItem = 0x7f1600ed;
public static int TextAppearance_AppCompat_Widget_PopupMenu_Header = 0x7f1600ee;
public static int TextAppearance_AppCompat_Widget_PopupMenu_Large = 0x7f1600ef;
public static int TextAppearance_AppCompat_Widget_PopupMenu_Small = 0x7f1600f0;
public static int TextAppearance_AppCompat_Widget_Switch = 0x7f1600f1;
public static int TextAppearance_AppCompat_Widget_TextView_SpinnerItem = 0x7f1600f2;
public static int TextAppearance_StatusBar_EventContent = 0x7f1600f3;
public static int TextAppearance_StatusBar_EventContent_Info = 0x7f1600f4;
public static int TextAppearance_StatusBar_EventContent_Line2 = 0x7f1600f5;
public static int TextAppearance_StatusBar_EventContent_Time = 0x7f1600f6;
public static int TextAppearance_StatusBar_EventContent_Title = 0x7f1600f7;
public static int TextAppearance_Widget_AppCompat_ExpandedMenu_Item = 0x7f1600f8;
public static int TextAppearance_Widget_AppCompat_Toolbar_Subtitle = 0x7f1600f9;
public static int TextAppearance_Widget_AppCompat_Toolbar_Title = 0x7f1600fa;
public static int ThemeOverlay_AppCompat = 0x7f1600fb;
public static int ThemeOverlay_AppCompat_ActionBar = 0x7f1600fc;
public static int ThemeOverlay_AppCompat_Dark = 0x7f1600fd;
public static int ThemeOverlay_AppCompat_Dark_ActionBar = 0x7f1600fe;
public static int ThemeOverlay_AppCompat_Dialog = 0x7f1600ff;
public static int ThemeOverlay_AppCompat_Dialog_Alert = 0x7f160100;
public static int ThemeOverlay_AppCompat_Light = 0x7f160101;
public static int Theme_AppCompat = 0x7f160102;
public static int Theme_AppCompat_CompactMenu = 0x7f160103;
public static int Theme_AppCompat_DayNight = 0x7f160104;
public static int Theme_AppCompat_DayNight_DarkActionBar = 0x7f160105;
public static int Theme_AppCompat_DayNight_Dialog = 0x7f160106;
public static int Theme_AppCompat_DayNight_DialogWhenLarge = 0x7f160107;
public static int Theme_AppCompat_DayNight_Dialog_Alert = 0x7f160108;
public static int Theme_AppCompat_DayNight_Dialog_MinWidth = 0x7f160109;
public static int Theme_AppCompat_DayNight_NoActionBar = 0x7f16010a;
public static int Theme_AppCompat_Dialog = 0x7f16010b;
public static int Theme_AppCompat_DialogWhenLarge = 0x7f16010c;
public static int Theme_AppCompat_Dialog_Alert = 0x7f16010d;
public static int Theme_AppCompat_Dialog_MinWidth = 0x7f16010e;
public static int Theme_AppCompat_Light = 0x7f16010f;
public static int Theme_AppCompat_Light_DarkActionBar = 0x7f160110;
public static int Theme_AppCompat_Light_Dialog = 0x7f160111;
public static int Theme_AppCompat_Light_DialogWhenLarge = 0x7f160112;
public static int Theme_AppCompat_Light_Dialog_Alert = 0x7f160113;
public static int Theme_AppCompat_Light_Dialog_MinWidth = 0x7f160114;
public static int Theme_AppCompat_Light_NoActionBar = 0x7f160115;
public static int Theme_AppCompat_NoActionBar = 0x7f160116;
public static int TipsHintText = 0x7f160117;
public static int Widget_AppCompat_ActionBar = 0x7f160118;
public static int Widget_AppCompat_ActionBar_Solid = 0x7f160119;
public static int Widget_AppCompat_ActionBar_TabBar = 0x7f16011a;
public static int Widget_AppCompat_ActionBar_TabText = 0x7f16011b;
public static int Widget_AppCompat_ActionBar_TabView = 0x7f16011c;
public static int Widget_AppCompat_ActionButton = 0x7f16011d;
public static int Widget_AppCompat_ActionButton_CloseMode = 0x7f16011e;
public static int Widget_AppCompat_ActionButton_Overflow = 0x7f16011f;
public static int Widget_AppCompat_ActionMode = 0x7f160120;
public static int Widget_AppCompat_ActivityChooserView = 0x7f160121;
public static int Widget_AppCompat_AutoCompleteTextView = 0x7f160122;
public static int Widget_AppCompat_Button = 0x7f160123;
public static int Widget_AppCompat_ButtonBar = 0x7f160124;
public static int Widget_AppCompat_ButtonBar_AlertDialog = 0x7f160125;
public static int Widget_AppCompat_Button_Borderless = 0x7f160126;
public static int Widget_AppCompat_Button_Borderless_Colored = 0x7f160127;
public static int Widget_AppCompat_Button_ButtonBar_AlertDialog = 0x7f160128;
public static int Widget_AppCompat_Button_Colored = 0x7f160129;
public static int Widget_AppCompat_Button_Small = 0x7f16012a;
public static int Widget_AppCompat_CompoundButton_CheckBox = 0x7f16012b;
public static int Widget_AppCompat_CompoundButton_RadioButton = 0x7f16012c;
public static int Widget_AppCompat_CompoundButton_Switch = 0x7f16012d;
public static int Widget_AppCompat_DrawerArrowToggle = 0x7f16012e;
public static int Widget_AppCompat_DropDownItem_Spinner = 0x7f16012f;
public static int Widget_AppCompat_EditText = 0x7f160130;
public static int Widget_AppCompat_ImageButton = 0x7f160131;
public static int Widget_AppCompat_Light_ActionBar = 0x7f160132;
public static int Widget_AppCompat_Light_ActionBar_Solid = 0x7f160133;
public static int Widget_AppCompat_Light_ActionBar_Solid_Inverse = 0x7f160134;
public static int Widget_AppCompat_Light_ActionBar_TabBar = 0x7f160135;
public static int Widget_AppCompat_Light_ActionBar_TabBar_Inverse = 0x7f160136;
public static int Widget_AppCompat_Light_ActionBar_TabText = 0x7f160137;
public static int Widget_AppCompat_Light_ActionBar_TabText_Inverse = 0x7f160138;
public static int Widget_AppCompat_Light_ActionBar_TabView = 0x7f160139;
public static int Widget_AppCompat_Light_ActionBar_TabView_Inverse = 0x7f16013a;
public static int Widget_AppCompat_Light_ActionButton = 0x7f16013b;
public static int Widget_AppCompat_Light_ActionButton_CloseMode = 0x7f16013c;
public static int Widget_AppCompat_Light_ActionButton_Overflow = 0x7f16013d;
public static int Widget_AppCompat_Light_ActionMode_Inverse = 0x7f16013e;
public static int Widget_AppCompat_Light_ActivityChooserView = 0x7f16013f;
public static int Widget_AppCompat_Light_AutoCompleteTextView = 0x7f160140;
public static int Widget_AppCompat_Light_DropDownItem_Spinner = 0x7f160141;
public static int Widget_AppCompat_Light_ListPopupWindow = 0x7f160142;
public static int Widget_AppCompat_Light_ListView_DropDown = 0x7f160143;
public static int Widget_AppCompat_Light_PopupMenu = 0x7f160144;
public static int Widget_AppCompat_Light_PopupMenu_Overflow = 0x7f160145;
public static int Widget_AppCompat_Light_SearchView = 0x7f160146;
public static int Widget_AppCompat_Light_Spinner_DropDown_ActionBar = 0x7f160147;
public static int Widget_AppCompat_ListMenuView = 0x7f160148;
public static int Widget_AppCompat_ListPopupWindow = 0x7f160149;
public static int Widget_AppCompat_ListView = 0x7f16014a;
public static int Widget_AppCompat_ListView_DropDown = 0x7f16014b;
public static int Widget_AppCompat_ListView_Menu = 0x7f16014c;
public static int Widget_AppCompat_NotificationActionContainer = 0x7f16014d;
public static int Widget_AppCompat_NotificationActionText = 0x7f16014e;
public static int Widget_AppCompat_PopupMenu = 0x7f16014f;
public static int Widget_AppCompat_PopupMenu_Overflow = 0x7f160150;
public static int Widget_AppCompat_PopupWindow = 0x7f160151;
public static int Widget_AppCompat_ProgressBar = 0x7f160152;
public static int Widget_AppCompat_ProgressBar_Horizontal = 0x7f160153;
public static int Widget_AppCompat_RatingBar = 0x7f160154;
public static int Widget_AppCompat_RatingBar_Indicator = 0x7f160155;
public static int Widget_AppCompat_RatingBar_Small = 0x7f160156;
public static int Widget_AppCompat_SearchView = 0x7f160157;
public static int Widget_AppCompat_SearchView_ActionBar = 0x7f160158;
public static int Widget_AppCompat_SeekBar = 0x7f160159;
public static int Widget_AppCompat_SeekBar_Discrete = 0x7f16015a;
public static int Widget_AppCompat_Spinner = 0x7f16015b;
public static int Widget_AppCompat_Spinner_DropDown = 0x7f16015c;
public static int Widget_AppCompat_Spinner_DropDown_ActionBar = 0x7f16015d;
public static int Widget_AppCompat_Spinner_Underlined = 0x7f16015e;
public static int Widget_AppCompat_TextView_SpinnerItem = 0x7f16015f;
public static int Widget_AppCompat_Toolbar = 0x7f160160;
public static int Widget_AppCompat_Toolbar_Button_Navigation = 0x7f160161;
public static int custom_dialog_style = 0x7f160162;
public static int phone_download_bottom_ad_popup = 0x7f160163;
public static int top_title_item = 0x7f160164;
}
public static final class styleable {
public static int[] ActionBar = { 0x7f04002c, 0x7f04002d, 0x7f04002e, 0x7f04004f, 0x7f040050, 0x7f040051, 0x7f040052, 0x7f040053, 0x7f040054, 0x7f040056, 0x7f04005a, 0x7f04005b, 0x7f040066, 0x7f04006a, 0x7f04006b, 0x7f04006c, 0x7f04006d, 0x7f04006e, 0x7f040071, 0x7f040074, 0x7f040081, 0x7f040088, 0x7f040092, 0x7f040095, 0x7f040096, 0x7f0400b0, 0x7f0400b3, 0x7f0400cb, 0x7f0400d4 };
public static int ActionBar_background = 0;
public static int ActionBar_backgroundSplit = 1;
public static int ActionBar_backgroundStacked = 2;
public static int ActionBar_contentInsetEnd = 3;
public static int ActionBar_contentInsetEndWithActions = 4;
public static int ActionBar_contentInsetLeft = 5;
public static int ActionBar_contentInsetRight = 6;
public static int ActionBar_contentInsetStart = 7;
public static int ActionBar_contentInsetStartWithNavigation = 8;
public static int ActionBar_customNavigationLayout = 9;
public static int ActionBar_displayOptions = 10;
public static int ActionBar_divider = 11;
public static int ActionBar_elevation = 12;
public static int ActionBar_height = 13;
public static int ActionBar_hideOnContentScroll = 14;
public static int ActionBar_homeAsUpIndicator = 15;
public static int ActionBar_homeLayout = 16;
public static int ActionBar_icon = 17;
public static int ActionBar_indeterminateProgressStyle = 18;
public static int ActionBar_itemPadding = 19;
public static int ActionBar_logo = 20;
public static int ActionBar_navigationMode = 21;
public static int ActionBar_popupTheme = 22;
public static int ActionBar_progressBarPadding = 23;
public static int ActionBar_progressBarStyle = 24;
public static int ActionBar_subtitle = 25;
public static int ActionBar_subtitleTextStyle = 26;
public static int ActionBar_title = 27;
public static int ActionBar_titleTextStyle = 28;
public static int[] ActionBarLayout = { 0x010100b3 };
public static int ActionBarLayout_android_layout_gravity = 0;
public static int[] ActionMenuItemView = { 0x0101013f };
public static int ActionMenuItemView_android_minWidth = 0;
public static int[] ActionMode = { 0x7f04002c, 0x7f04002d, 0x7f040041, 0x7f04006a, 0x7f0400b3, 0x7f0400d4 };
public static int ActionMode_background = 0;
public static int ActionMode_backgroundSplit = 1;
public static int ActionMode_closeItemLayout = 2;
public static int ActionMode_height = 3;
public static int ActionMode_subtitleTextStyle = 4;
public static int ActionMode_titleTextStyle = 5;
public static int[] ActivityChooserView = { 0x7f040067, 0x7f040072 };
public static int ActivityChooserView_expandActivityOverflowButtonDrawable = 0;
public static int ActivityChooserView_initialActivityCount = 1;
public static int[] AlertDialog = { 0x010100f2, 0x7f040039, 0x7f040078, 0x7f040079, 0x7f040085, 0x7f0400a6, 0x7f0400a7 };
public static int AlertDialog_android_layout = 0;
public static int AlertDialog_buttonPanelSideLayout = 1;
public static int AlertDialog_listItemLayout = 2;
public static int AlertDialog_listLayout = 3;
public static int AlertDialog_multiChoiceItemLayout = 4;
public static int AlertDialog_showTitle = 5;
public static int AlertDialog_singleChoiceItemLayout = 6;
public static int[] AppCompatImageView = { 0x01010119, 0x7f0400ac };
public static int AppCompatImageView_android_src = 0;
public static int AppCompatImageView_srcCompat = 1;
public static int[] AppCompatSeekBar = { 0x01010142, 0x7f0400c8, 0x7f0400c9, 0x7f0400ca };
public static int AppCompatSeekBar_android_thumb = 0;
public static int AppCompatSeekBar_tickMark = 1;
public static int AppCompatSeekBar_tickMarkTint = 2;
public static int AppCompatSeekBar_tickMarkTintMode = 3;
public static int[] AppCompatTextHelper = { 0x0101016e, 0x01010393, 0x0101016f, 0x01010170, 0x01010392, 0x0101016d, 0x01010034 };
public static int AppCompatTextHelper_android_drawableBottom = 0;
public static int AppCompatTextHelper_android_drawableEnd = 1;
public static int AppCompatTextHelper_android_drawableLeft = 2;
public static int AppCompatTextHelper_android_drawableRight = 3;
public static int AppCompatTextHelper_android_drawableStart = 4;
public static int AppCompatTextHelper_android_drawableTop = 5;
public static int AppCompatTextHelper_android_textAppearance = 6;
public static int[] AppCompatTextView = { 0x01010034, 0x7f0400b9 };
public static int AppCompatTextView_android_textAppearance = 0;
public static int AppCompatTextView_textAllCaps = 1;
public static int[] AppCompatTheme = { 0x7f040001, 0x7f040002, 0x7f040003, 0x7f040004, 0x7f040005, 0x7f040006, 0x7f040007, 0x7f040008, 0x7f040009, 0x7f04000a, 0x7f04000b, 0x7f04000c, 0x7f04000d, 0x7f04000f, 0x7f040010, 0x7f040011, 0x7f040012, 0x7f040013, 0x7f040014, 0x7f040015, 0x7f040016, 0x7f040017, 0x7f040018, 0x7f040019, 0x7f04001a, 0x7f04001b, 0x7f04001c, 0x7f04001d, 0x7f04001e, 0x7f04001f, 0x7f040022, 0x7f040023, 0x7f040024, 0x7f040025, 0x7f040026, 0x010100ae, 0x01010057, 0x7f04002b, 0x7f040032, 0x7f040033, 0x7f040034, 0x7f040035, 0x7f040036, 0x7f040037, 0x7f04003a, 0x7f04003b, 0x7f04003e, 0x7f04003f, 0x7f040045, 0x7f040046, 0x7f040047, 0x7f040048, 0x7f040049, 0x7f04004a, 0x7f04004b, 0x7f04004c, 0x7f04004d, 0x7f040055, 0x7f040058, 0x7f040059, 0x7f04005c, 0x7f04005e, 0x7f040061, 0x7f040062, 0x7f040063, 0x7f040064, 0x7f040065, 0x7f04006c, 0x7f040070, 0x7f040076, 0x7f040077, 0x7f04007a, 0x7f04007b, 0x7f04007c, 0x7f04007d, 0x7f04007e, 0x7f04007f, 0x7f040080, 0x7f04008e, 0x7f04008f, 0x7f040090, 0x7f040091, 0x7f040093, 0x7f040099, 0x7f04009a, 0x7f04009b, 0x7f04009c, 0x7f04009f, 0x7f0400a0, 0x7f0400a1, 0x7f0400a2, 0x7f0400a9, 0x7f0400aa, 0x7f0400b7, 0x7f0400ba, 0x7f0400bb, 0x7f0400bc, 0x7f0400bd, 0x7f0400be, 0x7f0400bf, 0x7f0400c0, 0x7f0400c1, 0x7f0400c2, 0x7f0400d5, 0x7f0400d6, 0x7f0400db, 0x7f0400dc, 0x7f0400dd, 0x7f0400de, 0x7f0400df, 0x7f0400e0, 0x7f0400e1, 0x7f0400e2, 0x7f0400e3, 0x7f0400e4 };
public static int AppCompatTheme_actionBarDivider = 0;
public static int AppCompatTheme_actionBarItemBackground = 1;
public static int AppCompatTheme_actionBarPopupTheme = 2;
public static int AppCompatTheme_actionBarSize = 3;
public static int AppCompatTheme_actionBarSplitStyle = 4;
public static int AppCompatTheme_actionBarStyle = 5;
public static int AppCompatTheme_actionBarTabBarStyle = 6;
public static int AppCompatTheme_actionBarTabStyle = 7;
public static int AppCompatTheme_actionBarTabTextStyle = 8;
public static int AppCompatTheme_actionBarTheme = 9;
public static int AppCompatTheme_actionBarWidgetTheme = 10;
public static int AppCompatTheme_actionButtonStyle = 11;
public static int AppCompatTheme_actionDropDownStyle = 12;
public static int AppCompatTheme_actionMenuTextAppearance = 13;
public static int AppCompatTheme_actionMenuTextColor = 14;
public static int AppCompatTheme_actionModeBackground = 15;
public static int AppCompatTheme_actionModeCloseButtonStyle = 16;
public static int AppCompatTheme_actionModeCloseDrawable = 17;
public static int AppCompatTheme_actionModeCopyDrawable = 18;
public static int AppCompatTheme_actionModeCutDrawable = 19;
public static int AppCompatTheme_actionModeFindDrawable = 20;
public static int AppCompatTheme_actionModePasteDrawable = 21;
public static int AppCompatTheme_actionModePopupWindowStyle = 22;
public static int AppCompatTheme_actionModeSelectAllDrawable = 23;
public static int AppCompatTheme_actionModeShareDrawable = 24;
public static int AppCompatTheme_actionModeSplitBackground = 25;
public static int AppCompatTheme_actionModeStyle = 26;
public static int AppCompatTheme_actionModeWebSearchDrawable = 27;
public static int AppCompatTheme_actionOverflowButtonStyle = 28;
public static int AppCompatTheme_actionOverflowMenuStyle = 29;
public static int AppCompatTheme_activityChooserViewStyle = 30;
public static int AppCompatTheme_alertDialogButtonGroupStyle = 31;
public static int AppCompatTheme_alertDialogCenterButtons = 32;
public static int AppCompatTheme_alertDialogStyle = 33;
public static int AppCompatTheme_alertDialogTheme = 34;
public static int AppCompatTheme_android_windowAnimationStyle = 35;
public static int AppCompatTheme_android_windowIsFloating = 36;
public static int AppCompatTheme_autoCompleteTextViewStyle = 37;
public static int AppCompatTheme_borderlessButtonStyle = 38;
public static int AppCompatTheme_buttonBarButtonStyle = 39;
public static int AppCompatTheme_buttonBarNegativeButtonStyle = 40;
public static int AppCompatTheme_buttonBarNeutralButtonStyle = 41;
public static int AppCompatTheme_buttonBarPositiveButtonStyle = 42;
public static int AppCompatTheme_buttonBarStyle = 43;
public static int AppCompatTheme_buttonStyle = 44;
public static int AppCompatTheme_buttonStyleSmall = 45;
public static int AppCompatTheme_checkboxStyle = 46;
public static int AppCompatTheme_checkedTextViewStyle = 47;
public static int AppCompatTheme_colorAccent = 48;
public static int AppCompatTheme_colorBackgroundFloating = 49;
public static int AppCompatTheme_colorButtonNormal = 50;
public static int AppCompatTheme_colorControlActivated = 51;
public static int AppCompatTheme_colorControlHighlight = 52;
public static int AppCompatTheme_colorControlNormal = 53;
public static int AppCompatTheme_colorPrimary = 54;
public static int AppCompatTheme_colorPrimaryDark = 55;
public static int AppCompatTheme_colorSwitchThumbNormal = 56;
public static int AppCompatTheme_controlBackground = 57;
public static int AppCompatTheme_dialogPreferredPadding = 58;
public static int AppCompatTheme_dialogTheme = 59;
public static int AppCompatTheme_dividerHorizontal = 60;
public static int AppCompatTheme_dividerVertical = 61;
public static int AppCompatTheme_dropDownListViewStyle = 62;
public static int AppCompatTheme_dropdownListPreferredItemHeight = 63;
public static int AppCompatTheme_editTextBackground = 64;
public static int AppCompatTheme_editTextColor = 65;
public static int AppCompatTheme_editTextStyle = 66;
public static int AppCompatTheme_homeAsUpIndicator = 67;
public static int AppCompatTheme_imageButtonStyle = 68;
public static int AppCompatTheme_listChoiceBackgroundIndicator = 69;
public static int AppCompatTheme_listDividerAlertDialog = 70;
public static int AppCompatTheme_listMenuViewStyle = 71;
public static int AppCompatTheme_listPopupWindowStyle = 72;
public static int AppCompatTheme_listPreferredItemHeight = 73;
public static int AppCompatTheme_listPreferredItemHeightLarge = 74;
public static int AppCompatTheme_listPreferredItemHeightSmall = 75;
public static int AppCompatTheme_listPreferredItemPaddingLeft = 76;
public static int AppCompatTheme_listPreferredItemPaddingRight = 77;
public static int AppCompatTheme_panelBackground = 78;
public static int AppCompatTheme_panelMenuListTheme = 79;
public static int AppCompatTheme_panelMenuListWidth = 80;
public static int AppCompatTheme_popupMenuStyle = 81;
public static int AppCompatTheme_popupWindowStyle = 82;
public static int AppCompatTheme_radioButtonStyle = 83;
public static int AppCompatTheme_ratingBarStyle = 84;
public static int AppCompatTheme_ratingBarStyleIndicator = 85;
public static int AppCompatTheme_ratingBarStyleSmall = 86;
public static int AppCompatTheme_searchViewStyle = 87;
public static int AppCompatTheme_seekBarStyle = 88;
public static int AppCompatTheme_selectableItemBackground = 89;
public static int AppCompatTheme_selectableItemBackgroundBorderless = 90;
public static int AppCompatTheme_spinnerDropDownItemStyle = 91;
public static int AppCompatTheme_spinnerStyle = 92;
public static int AppCompatTheme_switchStyle = 93;
public static int AppCompatTheme_textAppearanceLargePopupMenu = 94;
public static int AppCompatTheme_textAppearanceListItem = 95;
public static int AppCompatTheme_textAppearanceListItemSmall = 96;
public static int AppCompatTheme_textAppearancePopupMenuHeader = 97;
public static int AppCompatTheme_textAppearanceSearchResultSubtitle = 98;
public static int AppCompatTheme_textAppearanceSearchResultTitle = 99;
public static int AppCompatTheme_textAppearanceSmallPopupMenu = 100;
public static int AppCompatTheme_textColorAlertDialogListItem = 101;
public static int AppCompatTheme_textColorSearchUrl = 102;
public static int AppCompatTheme_toolbarNavigationButtonStyle = 103;
public static int AppCompatTheme_toolbarStyle = 104;
public static int AppCompatTheme_windowActionBar = 105;
public static int AppCompatTheme_windowActionBarOverlay = 106;
public static int AppCompatTheme_windowActionModeOverlay = 107;
public static int AppCompatTheme_windowFixedHeightMajor = 108;
public static int AppCompatTheme_windowFixedHeightMinor = 109;
public static int AppCompatTheme_windowFixedWidthMajor = 110;
public static int AppCompatTheme_windowFixedWidthMinor = 111;
public static int AppCompatTheme_windowMinWidthMajor = 112;
public static int AppCompatTheme_windowMinWidthMinor = 113;
public static int AppCompatTheme_windowNoTitle = 114;
public static int[] ButtonBarLayout = { 0x7f040027 };
public static int ButtonBarLayout_allowStacking = 0;
public static int[] ColorStateListItem = { 0x7f040028, 0x0101031f, 0x010101a5 };
public static int ColorStateListItem_alpha = 0;
public static int ColorStateListItem_android_alpha = 1;
public static int ColorStateListItem_android_color = 2;
public static int[] CompoundButton = { 0x01010107, 0x7f04003c, 0x7f04003d };
public static int CompoundButton_android_button = 0;
public static int CompoundButton_buttonTint = 1;
public static int CompoundButton_buttonTintMode = 2;
public static int[] DrawerArrowToggle = { 0x7f040029, 0x7f04002a, 0x7f040031, 0x7f040044, 0x7f04005f, 0x7f040068, 0x7f0400a8, 0x7f0400c4 };
public static int DrawerArrowToggle_arrowHeadLength = 0;
public static int DrawerArrowToggle_arrowShaftLength = 1;
public static int DrawerArrowToggle_barLength = 2;
public static int DrawerArrowToggle_color = 3;
public static int DrawerArrowToggle_drawableSize = 4;
public static int DrawerArrowToggle_gapBetweenBars = 5;
public static int DrawerArrowToggle_spinBars = 6;
public static int DrawerArrowToggle_thickness = 7;
public static int[] LinearLayoutCompat = { 0x01010126, 0x01010127, 0x010100af, 0x010100c4, 0x01010128, 0x7f04005b, 0x7f04005d, 0x7f040084, 0x7f0400a4 };
public static int LinearLayoutCompat_android_baselineAligned = 0;
public static int LinearLayoutCompat_android_baselineAlignedChildIndex = 1;
public static int LinearLayoutCompat_android_gravity = 2;
public static int LinearLayoutCompat_android_orientation = 3;
public static int LinearLayoutCompat_android_weightSum = 4;
public static int LinearLayoutCompat_divider = 5;
public static int LinearLayoutCompat_dividerPadding = 6;
public static int LinearLayoutCompat_measureWithLargestChild = 7;
public static int LinearLayoutCompat_showDividers = 8;
public static int[] LinearLayoutCompat_Layout = { 0x010100b3, 0x010100f5, 0x01010181, 0x010100f4 };
public static int LinearLayoutCompat_Layout_android_layout_gravity = 0;
public static int LinearLayoutCompat_Layout_android_layout_height = 1;
public static int LinearLayoutCompat_Layout_android_layout_weight = 2;
public static int LinearLayoutCompat_Layout_android_layout_width = 3;
public static int[] ListPopupWindow = { 0x010102ac, 0x010102ad };
public static int ListPopupWindow_android_dropDownHorizontalOffset = 0;
public static int ListPopupWindow_android_dropDownVerticalOffset = 1;
public static int[] MenuGroup = { 0x010101e0, 0x0101000e, 0x010100d0, 0x010101de, 0x010101df, 0x01010194 };
public static int MenuGroup_android_checkableBehavior = 0;
public static int MenuGroup_android_enabled = 1;
public static int MenuGroup_android_id = 2;
public static int MenuGroup_android_menuCategory = 3;
public static int MenuGroup_android_orderInCategory = 4;
public static int MenuGroup_android_visible = 5;
public static int[] MenuItem = { 0x7f04000e, 0x7f040020, 0x7f040021, 0x010101e3, 0x010101e5, 0x01010106, 0x0101000e, 0x01010002, 0x010100d0, 0x010101de, 0x010101e4, 0x0101026f, 0x010101df, 0x010101e1, 0x010101e2, 0x01010194, 0x7f0400a3 };
public static int MenuItem_actionLayout = 0;
public static int MenuItem_actionProviderClass = 1;
public static int MenuItem_actionViewClass = 2;
public static int MenuItem_android_alphabeticShortcut = 3;
public static int MenuItem_android_checkable = 4;
public static int MenuItem_android_checked = 5;
public static int MenuItem_android_enabled = 6;
public static int MenuItem_android_icon = 7;
public static int MenuItem_android_id = 8;
public static int MenuItem_android_menuCategory = 9;
public static int MenuItem_android_numericShortcut = 10;
public static int MenuItem_android_onClick = 11;
public static int MenuItem_android_orderInCategory = 12;
public static int MenuItem_android_title = 13;
public static int MenuItem_android_titleCondensed = 14;
public static int MenuItem_android_visible = 15;
public static int MenuItem_showAsAction = 16;
public static int[] MenuView = { 0x0101012f, 0x0101012d, 0x01010130, 0x01010131, 0x0101012c, 0x0101012e, 0x010100ae, 0x7f040094, 0x7f0400ae };
public static int MenuView_android_headerBackground = 0;
public static int MenuView_android_horizontalDivider = 1;
public static int MenuView_android_itemBackground = 2;
public static int MenuView_android_itemIconDisabledAlpha = 3;
public static int MenuView_android_itemTextAppearance = 4;
public static int MenuView_android_verticalDivider = 5;
public static int MenuView_android_windowAnimationStyle = 6;
public static int MenuView_preserveIconSpacing = 7;
public static int MenuView_subMenuArrow = 8;
public static int[] PopupWindow = { 0x010102c9, 0x01010176, 0x7f040089 };
public static int PopupWindow_android_popupAnimationStyle = 0;
public static int PopupWindow_android_popupBackground = 1;
public static int PopupWindow_overlapAnchor = 2;
public static int[] PopupWindowBackgroundState = { 0x7f0400ad };
public static int PopupWindowBackgroundState_state_above_anchor = 0;
public static int[] RecycleListView = { 0x7f04008a, 0x7f04008d };
public static int RecycleListView_paddingBottomNoButtons = 0;
public static int RecycleListView_paddingTopNoTitle = 1;
public static int[] SearchView = { 0x010100da, 0x01010264, 0x01010220, 0x0101011f, 0x7f040040, 0x7f04004e, 0x7f040057, 0x7f040069, 0x7f04006f, 0x7f040075, 0x7f040097, 0x7f040098, 0x7f04009d, 0x7f04009e, 0x7f0400af, 0x7f0400b4, 0x7f0400da };
public static int SearchView_android_focusable = 0;
public static int SearchView_android_imeOptions = 1;
public static int SearchView_android_inputType = 2;
public static int SearchView_android_maxWidth = 3;
public static int SearchView_closeIcon = 4;
public static int SearchView_commitIcon = 5;
public static int SearchView_defaultQueryHint = 6;
public static int SearchView_goIcon = 7;
public static int SearchView_iconifiedByDefault = 8;
public static int SearchView_layout = 9;
public static int SearchView_queryBackground = 10;
public static int SearchView_queryHint = 11;
public static int SearchView_searchHintIcon = 12;
public static int SearchView_searchIcon = 13;
public static int SearchView_submitBackground = 14;
public static int SearchView_suggestionRowLayout = 15;
public static int SearchView_voiceIcon = 16;
public static int[] Spinner = { 0x01010262, 0x010100b2, 0x01010176, 0x0101017b, 0x7f040092 };
public static int Spinner_android_dropDownWidth = 0;
public static int Spinner_android_entries = 1;
public static int Spinner_android_popupBackground = 2;
public static int Spinner_android_prompt = 3;
public static int Spinner_popupTheme = 4;
public static int[] SwitchCompat = { 0x01010125, 0x01010124, 0x01010142, 0x7f0400a5, 0x7f0400ab, 0x7f0400b5, 0x7f0400b6, 0x7f0400b8, 0x7f0400c5, 0x7f0400c6, 0x7f0400c7, 0x7f0400d7, 0x7f0400d8, 0x7f0400d9 };
public static int SwitchCompat_android_textOff = 0;
public static int SwitchCompat_android_textOn = 1;
public static int SwitchCompat_android_thumb = 2;
public static int SwitchCompat_showText = 3;
public static int SwitchCompat_splitTrack = 4;
public static int SwitchCompat_switchMinWidth = 5;
public static int SwitchCompat_switchPadding = 6;
public static int SwitchCompat_switchTextAppearance = 7;
public static int SwitchCompat_thumbTextPadding = 8;
public static int SwitchCompat_thumbTint = 9;
public static int SwitchCompat_thumbTintMode = 10;
public static int SwitchCompat_track = 11;
public static int SwitchCompat_trackTint = 12;
public static int SwitchCompat_trackTintMode = 13;
public static int[] TextAppearance = { 0x01010161, 0x01010162, 0x01010163, 0x01010164, 0x01010098, 0x0101009a, 0x01010095, 0x01010097, 0x01010096, 0x7f0400b9 };
public static int TextAppearance_android_shadowColor = 0;
public static int TextAppearance_android_shadowDx = 1;
public static int TextAppearance_android_shadowDy = 2;
public static int TextAppearance_android_shadowRadius = 3;
public static int TextAppearance_android_textColor = 4;
public static int TextAppearance_android_textColorHint = 5;
public static int TextAppearance_android_textSize = 6;
public static int TextAppearance_android_textStyle = 7;
public static int TextAppearance_android_typeface = 8;
public static int TextAppearance_textAllCaps = 9;
public static int[] Toolbar = { 0x010100af, 0x01010140, 0x7f040038, 0x7f040042, 0x7f040043, 0x7f04004f, 0x7f040050, 0x7f040051, 0x7f040052, 0x7f040053, 0x7f040054, 0x7f040081, 0x7f040082, 0x7f040083, 0x7f040086, 0x7f040087, 0x7f040092, 0x7f0400b0, 0x7f0400b1, 0x7f0400b2, 0x7f0400cb, 0x7f0400cc, 0x7f0400cd, 0x7f0400ce, 0x7f0400cf, 0x7f0400d0, 0x7f0400d1, 0x7f0400d2, 0x7f0400d3 };
public static int Toolbar_android_gravity = 0;
public static int Toolbar_android_minHeight = 1;
public static int Toolbar_buttonGravity = 2;
public static int Toolbar_collapseContentDescription = 3;
public static int Toolbar_collapseIcon = 4;
public static int Toolbar_contentInsetEnd = 5;
public static int Toolbar_contentInsetEndWithActions = 6;
public static int Toolbar_contentInsetLeft = 7;
public static int Toolbar_contentInsetRight = 8;
public static int Toolbar_contentInsetStart = 9;
public static int Toolbar_contentInsetStartWithNavigation = 10;
public static int Toolbar_logo = 11;
public static int Toolbar_logoDescription = 12;
public static int Toolbar_maxButtonHeight = 13;
public static int Toolbar_navigationContentDescription = 14;
public static int Toolbar_navigationIcon = 15;
public static int Toolbar_popupTheme = 16;
public static int Toolbar_subtitle = 17;
public static int Toolbar_subtitleTextAppearance = 18;
public static int Toolbar_subtitleTextColor = 19;
public static int Toolbar_title = 20;
public static int Toolbar_titleMargin = 21;
public static int Toolbar_titleMarginBottom = 22;
public static int Toolbar_titleMarginEnd = 23;
public static int Toolbar_titleMarginStart = 24;
public static int Toolbar_titleMarginTop = 25;
public static int Toolbar_titleMargins = 26;
public static int Toolbar_titleTextAppearance = 27;
public static int Toolbar_titleTextColor = 28;
public static int[] View = { 0x010100da, 0x01010000, 0x7f04008b, 0x7f04008c, 0x7f0400c3 };
public static int View_android_focusable = 0;
public static int View_android_theme = 1;
public static int View_paddingEnd = 2;
public static int View_paddingStart = 3;
public static int View_theme = 4;
public static int[] ViewBackgroundHelper = { 0x010100d4, 0x7f04002f, 0x7f040030 };
public static int ViewBackgroundHelper_android_background = 0;
public static int ViewBackgroundHelper_backgroundTint = 1;
public static int ViewBackgroundHelper_backgroundTintMode = 2;
public static int[] ViewStubCompat = { 0x010100d0, 0x010100f3, 0x010100f2 };
public static int ViewStubCompat_android_id = 0;
public static int ViewStubCompat_android_inflatedId = 1;
public static int ViewStubCompat_android_layout = 2;
}
}
|
/*
* Copyright 2021 YugaByte, Inc. and Contributors
*
* Licensed under the Polyform Free Trial License 1.0.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://github.com/YugaByte/yugabyte-db/blob/master/licenses/POLYFORM-FREE-TRIAL-LICENSE-1.0.0.txt
*/
package com.yugabyte.yw.forms;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.typesafe.config.Config;
import com.yugabyte.yw.cloud.UniverseResourceDetails;
import com.yugabyte.yw.commissioner.Common;
import com.yugabyte.yw.common.CertificateHelper;
import com.yugabyte.yw.models.Universe;
import com.yugabyte.yw.models.helpers.NodeDetails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
import play.Play;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(description = "Universe Resp")
public class UniverseResp {
public static final Logger LOG = LoggerFactory.getLogger(UniverseResp.class);
public static UniverseResp create(Universe universe, UUID taskUUID, Config config) {
UniverseResourceDetails resourceDetails =
UniverseResourceDetails.create(universe.getUniverseDetails(), config);
return new UniverseResp(universe, taskUUID, resourceDetails);
}
@ApiModelProperty(value = "Universe UUID")
public final UUID universeUUID;
@ApiModelProperty(value = "Universe name")
public final String name;
@ApiModelProperty(value = "Creation time")
public final String creationDate;
@ApiModelProperty(value = "Version")
public final int version;
@ApiModelProperty(value = "DNS name")
public final String dnsName;
@ApiModelProperty(value = "Universe Resources", dataType = "java.util.Map")
public final UniverseResourceDetails resources;
@ApiModelProperty(value = "Universe Details", dataType = "java.util.Map")
public final UniverseDefinitionTaskParamsResp universeDetails;
@ApiModelProperty(value = "Universe config")
public final Map<String, String> universeConfig;
@ApiModelProperty(value = "Task UUID")
public final UUID taskUUID;
@ApiModelProperty(value = "Sample command")
public final String sampleAppCommandTxt;
public UniverseResp(Universe entity) {
this(entity, null, null);
}
public UniverseResp(Universe entity, UUID taskUUID) {
this(entity, taskUUID, null);
}
public UniverseResp(Universe entity, UUID taskUUID, UniverseResourceDetails resources) {
universeUUID = entity.universeUUID;
name = entity.name;
creationDate = entity.creationDate.toString();
version = entity.version;
dnsName = entity.getDnsName();
universeDetails = new UniverseDefinitionTaskParamsResp(entity.getUniverseDetails(), entity);
this.taskUUID = taskUUID;
this.resources = resources;
universeConfig = entity.getConfig();
this.sampleAppCommandTxt = this.getManifest(entity);
}
// TODO(UI folks): Remove this. This is redundant as it is already available in resources
@ApiModelProperty(value = "Price")
public Double getPricePerHour() {
return resources == null ? null : resources.pricePerHour;
}
/** Returns the command to run the sample apps in the universe. */
private String getManifest(Universe universe) {
Set<NodeDetails> nodeDetailsSet = universe.getUniverseDetails().nodeDetailsSet;
Integer yqlServerRpcPort = universe.getUniverseDetails().communicationPorts.yqlServerRpcPort;
StringBuilder nodeBuilder = new StringBuilder();
UniverseDefinitionTaskParams.Cluster cluster =
universe.getUniverseDetails().getPrimaryCluster();
String sampleAppCommand;
if (cluster.userIntent.providerType == null) {
return null;
}
boolean isKubernetesProvider =
cluster.userIntent.providerType.equals(Common.CloudType.kubernetes);
// Building --nodes param value of the command
nodeDetailsSet
.stream()
.filter(
nodeDetails ->
(nodeDetails.isTserver
&& nodeDetails.state != null
&& nodeDetails.state.name().equals("Live")))
.forEach(
nodeDetails ->
nodeBuilder.append(
String.format(
nodeBuilder.length() == 0 ? "%s:%s" : ",%s:%s",
nodeDetails.cloudInfo.private_ip,
yqlServerRpcPort)));
// If node to client TLS is enabled.
if (cluster.userIntent.enableClientToNodeEncrypt) {
String randomFileName = UUID.randomUUID().toString();
UUID certUUID =
universe.getUniverseDetails().rootAndClientRootCASame
? universe.getUniverseDetails().rootCA
: universe.getUniverseDetails().clientRootCA;
if (certUUID == null) {
LOG.warn("!!! CertUUID cannot be null when TLS is enabled !!!");
}
if (isKubernetesProvider) {
String certContent = certUUID == null ? "" : CertificateHelper.getCertPEM(certUUID);
Yaml yaml = new Yaml();
String sampleAppCommandTxt =
yaml.dump(
yaml.load(
Play.application()
.resourceAsStream("templates/k8s-sample-app-command-pod.yml")));
sampleAppCommandTxt =
sampleAppCommandTxt
.replace("<root_cert_content>", certContent)
.replace("<nodes>", nodeBuilder.toString());
String secretCommandTxt =
yaml.dump(
yaml.load(
Play.application()
.resourceAsStream("templates/k8s-sample-app-command-secret.yml")));
secretCommandTxt =
secretCommandTxt
.replace("<root_cert_content>", certContent)
.replace("<nodes>", nodeBuilder.toString());
sampleAppCommandTxt = secretCommandTxt + "\n---\n" + sampleAppCommandTxt;
sampleAppCommand = "echo -n \"" + sampleAppCommandTxt + "\" | kubectl create -f -";
} else {
sampleAppCommand =
("export FILE_NAME=/tmp/<file_name>.crt "
+ "&& echo -n \"<root_cert_content>\" > $FILE_NAME "
+ "&& docker run -d -v $FILE_NAME:/home/root.crt:ro yugabytedb/yb-sample-apps "
+ "--workload CassandraKeyValue --nodes <nodes> --ssl_cert /home/root.crt")
.replace(
"<root_cert_content>",
certUUID == null ? "" : CertificateHelper.getCertPEMFileContents(certUUID))
.replace("<nodes>", nodeBuilder.toString());
}
sampleAppCommand = sampleAppCommand.replace("<file_name>", randomFileName);
} else {
// If TLS is disabled.
if (isKubernetesProvider) {
String commandTemplateKubeCtl =
"kubectl run "
+ "--image=yugabytedb/yb-sample-apps yb-sample-apps "
+ "-- --workload CassandraKeyValue --nodes <nodes>";
sampleAppCommand = commandTemplateKubeCtl.replace("<nodes>", nodeBuilder.toString());
} else {
String commandTemplateDocker =
"docker run "
+ "-d yugabytedb/yb-sample-apps "
+ "--workload CassandraKeyValue --nodes <nodes>";
sampleAppCommand = commandTemplateDocker.replace("<nodes>", nodeBuilder.toString());
}
}
return sampleAppCommand;
}
}
|
package com.pensato.replicator.support;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.core.ResolvableType;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.lang.Nullable;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
public class BaseDualDatabaseService<T extends BaseEntity<T,ID>, ID, R extends PagingAndSortingRepository<T, ID>> {
private R primeRepository;
private R replicaRepository;
public void initializeReplication() {
List<T> items = findAll();
List<T> replicas = findAllInReplica();
String className = "";
try {
Class<T> clazz = resolveClass(getClass());
if (clazz != null) {
clazz.getName();
}
} catch (Exception e) {
e.printStackTrace();
}
for(T entity: items) {
if(!replicas.contains(entity)) {
createOrUpdateInReplica(entity.createCopy());
System.out.println("---> Entity " + className + ":" + entity.getId() + " was successfully replicated.");
}
}
}
@Transactional(transactionManager="primeTransactionManager")
public List<T> findAll()
{
List<T> target = new ArrayList<>();
primeRepository.findAll().forEach(target::add);
return target;
}
@Transactional(transactionManager="replicaTransactionManager")
public List<T> findAllInReplica()
{
List<T> target = new ArrayList<>();
replicaRepository.findAll().forEach(target::add);
return target;
}
@Transactional(transactionManager="replicaTransactionManager")
public void createOrUpdateInReplica(T entity)
{
replicaRepository.save(entity);
}
/**
* Resolve the single type argument of the given generic interface against
* the given target class which is assumed to implement the generic interface
* and possibly declare a concrete type for its type variable.
* @param clazz the target class to check against
* @return the resolved type of the argument, or {@code null} if not resolvable
*/
@Nullable
@SuppressWarnings("unchecked")
private Class<T> resolveClass(Class<?> clazz) {
ResolvableType resolvableType = ResolvableType.forClass(clazz).as(BaseDualDatabaseService.class);
if (!resolvableType.hasGenerics()) {
return null;
}
if(resolvableType.getGenerics().length == 1) {
return (Class<T>) resolvableType.getGeneric().resolve();
} else {
// In case of multiple generic interfaces, the line below expects Entity to be the first argument.
return (Class<T>) resolvableType.getGenerics()[0].resolve();
}
}
}
|
/*
* Anserini: A Lucene toolkit for reproducible information retrieval research
*
* 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.anserini.doc;
import org.apache.commons.lang3.StringUtils;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DataModel {
private static final String INDEX_COMMAND = "target/appassembler/bin/IndexCollection";
private static final String SEARCH_COMMAND = "target/appassembler/bin/SearchCollection";
private String corpus;
private String corpus_path;
public String getCorpus() {
return corpus;
}
public void setCorpus(String corpus) {
this.corpus = corpus;
}
public String getCorpus_path() {
return corpus_path;
}
public void setCorpus_path(String corpus_path) {
this.corpus_path = corpus_path;
}
private String index_path;
private String collection;
private String generator;
private int threads;
private String index_options;
private Map<String, Long> index_stats;
public String getIndex_path() {
return index_path;
}
public void setIndex_path(String index_path) {
this.index_path = index_path;
}
public String getCollection() {
return collection;
}
public void setCollection(String collection) {
this.collection = collection;
}
public String getGenerator() {
return generator;
}
public void setGenerator(String generator) {
this.generator = generator;
}
public int getThreads() {
return threads;
}
public void setThreads(int threads) {
this.threads = threads;
}
public String getIndex_options() {
return index_options;
}
public void setIndex_options(String index_options) {
this.index_options = index_options;
}
public Map<String, Long> getIndex_stats() {
return index_stats;
}
public void setIndex_stats(Map<String, Long> index_stats) {
this.index_stats = index_stats;
}
private String topic_root;
private String qrels_root;
private String topic_reader;
public String getTopic_reader() {
return topic_reader;
}
public void setTopic_reader(String topic_reader) {
this.topic_reader = topic_reader;
}
public String getTopic_root() {
return topic_root;
}
public void setTopic_root(String topic_root) {
this.topic_root = topic_root;
}
public String getQrels_root() {
return qrels_root;
}
public void setQrels_root(String qrels_root) {
this.qrels_root = qrels_root;
}
private List<Metric> metrics;
private List<Model> models;
private List<Topic> topics;
public List<Metric> getMetrics() {
return metrics;
}
public void setMetrics(List<Metric> evals) {
this.metrics = evals;
}
public List<Topic> getTopics() {
return topics;
}
public void setTopics(List<Topic> topics) {
this.topics = topics;
}
public List<Model> getModels() {
return models;
}
public void setModels(List<Model> models) {
this.models = models;
}
static class Topic {
private String name;
private String id;
private String path;
private String qrel;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getPath() { return path; }
public void setPath(String path) { this.path = path; }
public String getQrel() { return qrel; }
public void setQrel(String qrel) { this.qrel = qrel; }
}
static class Model {
private String name;
private String display;
private String params;
private Map<String, List<Float>> results;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public Map<String, List<Float>> getResults() { return results; }
public void setDisplay(String display) { this.display = display; }
public String getDisplay() { return display; }
public void setResults(Map<String, List<Float>> results) { this.results = results; }
public String getParams() { return params; }
public void setParams(String params) { this.params = params; }
}
static class Metric {
private String command;
private String params;
private String separator;
private int parse_index;
private String metric;
private int metric_precision;
private boolean can_combine;
public boolean isCan_combine() { return can_combine; }
public void setCan_combine(boolean can_combine) { this.can_combine = can_combine; }
public String getCommand() { return command; }
public void setCommand(String command) { this.command = command; }
public String getParams() { return params; }
public void setParams(String params) { this.params = params; }
public String getSeparator() { return separator; }
public void setSeparator(String separator) { this.separator = separator; }
public int getParse_index() { return parse_index; }
public void setParse_index(int parse_index) { this.parse_index = parse_index; }
public String getMetric() { return metric; }
public void setMetric(String metric) { this.metric = metric; }
public int getMetric_precision() { return metric_precision; }
public void setMetric_precision(int metric_precision) { this.metric_precision = metric_precision; }
}
public String generateIndexingCommand(String collection) {
StringBuilder builder = new StringBuilder();
builder.append(INDEX_COMMAND).append(" \\\n");
builder.append(" -collection ").append(getCollection()).append(" \\\n");
builder.append(" -input ").append("/path/to/"+collection).append(" \\\n");
builder.append(" -index ").append(getIndex_path()).append(" \\\n");
builder.append(" -generator ").append(getGenerator()).append(" \\\n");
builder.append(" -threads ").append(getThreads());
builder.append(" ").append(getIndex_options()).append(" \\\n");
builder.append(String.format(" >& logs/log.%s &", collection));
return builder.toString();
}
public String generateRankingCommand(String collection) {
StringBuilder builder = new StringBuilder();
for (Model model : getModels()) {
for (Topic topic : getTopics()) {
builder.append(SEARCH_COMMAND).append(" \\\n");
builder.append(" -index").append(" ").append(getIndex_path()).append(" \\\n");
builder
.append(" -topics").append(" ").append(Paths.get(getTopic_root(), topic.getPath()).toString())
.append(" -topicreader").append(" ").append(getTopic_reader()).append(" \\\n");
builder.append(" -output").append(" ").append("runs/run."+collection+"."+model.getName()+"."+topic.getPath()).append(" \\\n");
if (model.getParams() != null) {
builder.append(" ").append(model.getParams());
}
builder.append(" &"); // nohup
builder.append("\n");
}
builder.append("\n");
}
return builder.toString().trim();
}
public String generateEvalCommand(String collection) {
StringBuilder builder = new StringBuilder();
for (Model model : getModels()) {
for (Topic topic : getTopics()) {
Map<String, Map<String, List<String>>> combinedEvalCmd = new HashMap<>();
for (Metric eval : getMetrics()) {
String evalCmd = eval.getCommand();
String evalCmdOption = "";
if (eval.getParams() != null) {
evalCmdOption += " " + eval.getParams();
}
String evalCmdResidual = "";
evalCmdResidual += " " + Paths.get(getQrels_root(), topic.getQrel());
evalCmdResidual += " runs/run." + collection+ "." + model.getName() + "." + topic.getPath();
evalCmdResidual += "\n";
if (eval.isCan_combine() || evalCmdOption.isEmpty()) {
combinedEvalCmd.putIfAbsent(evalCmd, new HashMap<>());
combinedEvalCmd.get(evalCmd).putIfAbsent(evalCmdResidual, new ArrayList<>());
combinedEvalCmd.get(evalCmd).get(evalCmdResidual).add(evalCmdOption);
} else {
builder.append(evalCmd + evalCmdOption + evalCmdResidual);
}
}
for (Map.Entry<String, Map<String, List<String>>> entry : combinedEvalCmd.entrySet()) {
for (Map.Entry<String, List<String>> innerEntry : entry.getValue().entrySet()) {
builder.append(entry.getKey() + String.join("", innerEntry.getValue()) + innerEntry.getKey());
}
}
}
builder.append("\n");
}
return builder.toString().trim();
}
public String generateEffectiveness(String collection) {
StringBuilder builder = new StringBuilder();
for (Metric eval : getMetrics()) {
builder.append(String.format("%1$-40s|", eval.getMetric()));
for (Model model : getModels()) {
if (model.getDisplay() == null) {
builder.append(String.format(" %1$-10s|", model.getName()));
} else {
builder.append(String.format(" %1$-10s|", model.getDisplay()));
}
}
builder.append("\n");
builder.append(":").append(StringUtils.repeat("-", 39)).append("|");
for (Model model : getModels()) {
builder.append(StringUtils.repeat("-", 11)).append("|");
}
builder.append("\n");
for (int i = 0; i < topics.size(); i++) {
Topic topic = getTopics().get(i);
builder.append(String.format("%1$-40s|", topic.getName()));
for (Model model : getModels()) {
builder.append(String.format(" %-10.4f|", model.getResults().get(eval.getMetric()).get(i)));
}
builder.append("\n");
}
builder.append("\n\n");
}
return builder.toString().trim();
}
}
|
package com.github.common.db.entity.primary;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 被反映人和是否村干关联表
* </p>
*
* @author DESKTOP-3Q631SR,WLW
* @since 2019-06-06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="LetDefendantJobType对象", description="被反映人和是否村干关联表")
public class LetDefendantJobType implements Serializable {
private static final long serialVersionUID = 1L;
@TableField("defendant_id")
private String defendantId;
@TableField("job_type_id")
private Integer jobTypeId;
public static final String DEFENDANT_ID = "defendant_id";
public static final String JOB_TYPE_ID = "job_type_id";
}
|
package io.quarkus.arc.benchmarks.appbeans;
import javax.enterprise.context.ApplicationScoped;
import io.quarkus.runtime.Startup;
@ApplicationScoped
@Startup
public class AppBean172 {
void ping() {
}
}
|
/*
* Copyright 2006-2020 Prowide
*
* 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.prowidesoftware.swift.model.field;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import org.junit.jupiter.api.Test;
/**
* Test for Field26C and similar fields.
*
* @since 6.4
*/
public class Field26CTest extends AbstractFieldTest {
@Override
@Test
public void testSerialization() {
testSerializationImpl("26C",
"A/B/CCCCCDDDDEEEE"
);
}
/**
* [S]/S/5!a4!aS
*/
@Test
public void testField26C() {
Field26C f = new Field26C((String)null);
assertNull(f.getComponent1());
assertNull(f.getComponent2());
assertNull(f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("");
assertNull(f.getComponent1());
assertNull(f.getComponent2());
assertNull(f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A");
assertEquals("A", f.getComponent1());
assertNull(f.getComponent2());
assertNull(f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/");
assertEquals("A", f.getComponent1());
assertNull(f.getComponent2());
assertNull(f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/B");
assertEquals("A", f.getComponent1());
assertEquals("B", f.getComponent2());
assertNull(f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/B/C");
assertEquals("A", f.getComponent1());
assertEquals("B", f.getComponent2());
assertEquals("C", f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/B/CCCCC");
assertEquals("A", f.getComponent1());
assertEquals("B", f.getComponent2());
assertEquals("CCCCC", f.getComponent3());
assertNull(f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/B/CCCCCD");
assertEquals("A", f.getComponent1());
assertEquals("B", f.getComponent2());
assertEquals("CCCCC", f.getComponent3());
assertEquals("D", f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/B/CCCCCDDDD");
assertEquals("A", f.getComponent1());
assertEquals("B", f.getComponent2());
assertEquals("CCCCC", f.getComponent3());
assertEquals("DDDD", f.getComponent4());
assertNull(f.getComponent5());
f = new Field26C("A/B/CCCCCDDDDEEEE");
assertEquals("A", f.getComponent1());
assertEquals("B", f.getComponent2());
assertEquals("CCCCC", f.getComponent3());
assertEquals("DDDD", f.getComponent4());
assertEquals("EEEE", f.getComponent5());
}
}
|
package com.marklogic.client.modulesloader;
import java.io.File;
public class Asset {
private File file;
private String path;
public Asset(File file, String path) {
super();
this.file = file;
this.path = path;
}
public File getFile() {
return file;
}
public String getPath() {
return path;
}
}
|
package com.orbitz.consul.model.agent;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.orbitz.consul.util.Jackson;
import org.junit.Test;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
public class DebugConfigTest {
private final String JSON = "{\n" +
" \"ACLMasterToken\": \"hidden\",\n" +
" \"GRPCAddrs\": [\n" +
" \"tcp://0.0.0.0:8502\"\n" +
" ],\n" +
" \"ACLEnableKeyListPolicy\": false,\n" +
" \"HTTPSPort\": -1,\n" +
" \"AutoEncryptTLS\": false,\n" +
" \"AdvertiseAddrLAN\": \"127.0.0.1\",\n" +
" \"HTTPAddrs\": [\n" +
" \"tcp://0.0.0.0:8500\"\n" +
" ],\n" +
" \"LeaveOnTerm\": false,\n" +
" \"ClientAddrs\": [\n" +
" \"0.0.0.0\"\n" +
" ],\n" +
" \"RetryJoinIntervalLAN\": \"30s\",\n" +
" \"ACLTokenTTL\": \"30s\",\n" +
" \"ACLDefaultPolicy\": \"allow\",\n" +
" \"CheckReapInterval\": \"30s\",\n" +
" \"ConnectEnabled\": true,\n" +
" \"ConsulCoordinateUpdatePeriod\": \"100ms\",\n" +
" \"ConsulRaftHeartbeatTimeout\": \"35ms\",\n" +
" \"AutoEncryptAllowTLS\": false,\n" +
" \"RaftSnapshotThreshold\": 0,\n" +
" \"ACLTokenReplication\": false,\n" +
" \"GRPCPort\": 8502,\n" +
" \"AutopilotDisableUpgradeMigration\": false,\n" +
" \"BindAddr\": \"127.0.0.1\",\n" +
" \"VerifyIncomingRPC\": false,\n" +
" \"DNSAddrs\": [\n" +
" \"tcp://0.0.0.0:8600\",\n" +
" \"udp://0.0.0.0:8600\"\n" +
" ],\n" +
" \"ACLReplicationToken\": \"hidden\",\n" +
" \"AutopilotMinQuorum\": 0,\n" +
" \"SerfAdvertiseAddrLAN\": \"tcp://127.0.0.1:8301\",\n" +
" \"ConsulRaftLeaderLeaseTimeout\": \"20ms\",\n" +
" \"UIContentPath\": \"/ui/\",\n" +
" \"EnableCentralServiceConfig\": false,\n" +
" \"KVMaxValueSize\": 524288,\n" +
" \"ServerMode\": true,\n" +
" \"TxnMaxReqLen\": 524288,\n" +
" \"DisableRemoteExec\": true,\n" +
" \"HTTPMaxConnsPerClient\": 200,\n" +
" \"RPCHandshakeTimeout\": \"5s\",\n" +
" \"DNSMaxStale\": \"87600h0m0s\",\n" +
" \"Telemetry\": {\n" +
" \"CirconusAPIToken\": \"hidden\",\n" +
" \"Disable\": false,\n" +
" \"DisableHostname\": false,\n" +
" \"FilterDefault\": true,\n" +
" \"MetricsPrefix\": \"consul\",\n" +
" \"PrometheusRetentionTime\": \"0s\"\n" +
" },\n" +
" \"SegmentNameLimit\": 64,\n" +
" \"GossipLANGossipNodes\": 3,\n" +
" \"RaftTrailingLogs\": 0,\n" +
" \"RPCProtocol\": 2,\n" +
" \"DNSCacheMaxAge\": \"0s\",\n" +
" \"GossipLANRetransmitMult\": 4,\n" +
" \"AutopilotMaxTrailingLogs\": 250,\n" +
" \"ACLDatacenter\": \"dc1\",\n" +
" \"DefaultQueryTime\": \"5m0s\",\n" +
" \"Version\": \"1.8.4\",\n" +
" \"RPCRateLimit\": -1,\n" +
" \"Logging\": {\n" +
" \"EnableSyslog\": false,\n" +
" \"LogJSON\": false,\n" +
" \"LogLevel\": \"DEBUG\",\n" +
" \"LogRotateBytes\": 0,\n" +
" \"LogRotateDuration\": \"0s\",\n" +
" \"LogRotateMaxFiles\": 0,\n" +
" \"SyslogFacility\": \"LOCAL0\"\n" +
" },\n" +
" \"RPCMaxConnsPerClient\": 100,\n" +
" \"RejoinAfterLeave\": false,\n" +
" \"GossipWANSuspicionMult\": 3,\n" +
" \"DNSNodeMetaTXT\": true,\n" +
" \"ACLsEnabled\": false,\n" +
" \"SerfPortWAN\": 8302,\n" +
" \"GossipLANProbeInterval\": \"100ms\",\n" +
" \"PrimaryDatacenter\": \"dc1\",\n" +
" \"Cache\": {\n" +
" \"EntryFetchMaxBurst\": 2,\n" +
" \"EntryFetchRate\": 1.7976931348623157E308\n" +
" },\n" +
" \"DiscardCheckOutput\": false,\n" +
" \"ReconnectTimeoutWAN\": \"0s\",\n" +
" \"AdvertiseAddrWAN\": \"127.0.0.1\",\n" +
" \"ConnectSidecarMaxPort\": 21255,\n" +
" \"EnableUI\": true,\n" +
" \"EnableDebug\": true,\n" +
" \"KeyFile\": \"hidden\",\n" +
" \"RPCAdvertiseAddr\": \"tcp://127.0.0.1:8300\",\n" +
" \"SyncCoordinateIntervalMin\": \"15s\",\n" +
" \"EncryptVerifyOutgoing\": true,\n" +
" \"DNSUseCache\": false,\n" +
" \"Bootstrap\": false,\n" +
" \"TranslateWANAddrs\": false,\n" +
" \"ACLEnableTokenPersistence\": false,\n" +
" \"DNSNodeTTL\": \"0s\",\n" +
" \"ExposeMinPort\": 21500,\n" +
" \"DNSDomain\": \"consul.\",\n" +
" \"SegmentLimit\": 64,\n" +
" \"AutopilotLastContactThreshold\": \"200ms\",\n" +
" \"ConsulCoordinateUpdateMaxBatches\": 5,\n" +
" \"EnableRemoteScriptChecks\": true,\n" +
" \"DNSAllowStale\": true,\n" +
" \"AutopilotCleanupDeadServers\": true,\n" +
" \"GossipWANGossipNodes\": 3,\n" +
" \"NodeName\": \"484c56552d86\",\n" +
" \"HTTPUseCache\": true,\n" +
" \"DNSDisableCompression\": false,\n" +
" \"SyncCoordinateRateTarget\": 64,\n" +
" \"SerfAdvertiseAddrWAN\": \"tcp://127.0.0.1:8302\",\n" +
" \"VerifyServerHostname\": false,\n" +
" \"GossipWANProbeInterval\": \"100ms\",\n" +
" \"ExposeMaxPort\": 21755,\n" +
" \"VerifyOutgoing\": false,\n" +
" \"DevMode\": true,\n" +
" \"GossipWANProbeTimeout\": \"100ms\",\n" +
" \"RetryJoinMaxAttemptsWAN\": 0,\n" +
" \"DNSARecordLimit\": 0,\n" +
" \"EncryptVerifyIncoming\": true,\n" +
" \"DisableHTTPUnprintableCharFilter\": false,\n" +
" \"GossipLANSuspicionMult\": 3,\n" +
" \"DisableAnonymousSignature\": true,\n" +
" \"SerfBindAddrWAN\": \"tcp://127.0.0.1:8302\",\n" +
" \"ACLDownPolicy\": \"extend-cache\",\n" +
" \"ConsulServerHealthInterval\": \"10ms\",\n" +
" \"LeaveDrainTime\": \"5s\",\n" +
" \"PrimaryGatewaysInterval\": \"30s\",\n" +
" \"GossipWANRetransmitMult\": 4,\n" +
" \"DisableCoordinates\": false,\n" +
" \"EnableAgentTLSForChecks\": false,\n" +
" \"EnableLocalScriptChecks\": true,\n" +
" \"DisableHostNodeID\": true,\n" +
" \"RPCBindAddr\": \"tcp://127.0.0.1:8300\",\n" +
" \"ACLToken\": \"hidden\",\n" +
" \"DataDir\": \"/consul/data\",\n" +
" \"BootstrapExpect\": 0,\n" +
" \"ConsulCoordinateUpdateBatchSize\": 128,\n" +
" \"HTTPSHandshakeTimeout\": \"5s\",\n" +
" \"EncryptKey\": \"hidden\",\n" +
" \"ACLDisabledTTL\": \"2m0s\",\n" +
" \"SerfPortLAN\": 8301,\n" +
" \"ACLRoleTTL\": \"0s\",\n" +
" \"ServerPort\": 8300,\n" +
" \"ConnectTestCALeafRootChangeSpread\": \"0s\",\n" +
" \"VerifyIncomingHTTPS\": false,\n" +
" \"DiscoveryMaxStale\": \"0s\",\n" +
" \"GossipLANGossipInterval\": \"100ms\",\n" +
" \"GossipLANProbeTimeout\": \"100ms\",\n" +
" \"TLSPreferServerCipherSuites\": false,\n" +
" \"MaxQueryTime\": \"10m0s\",\n" +
" \"ReconnectTimeoutLAN\": \"0s\",\n" +
" \"CheckUpdateInterval\": \"5m0s\",\n" +
" \"TLSMinVersion\": \"tls12\",\n" +
" \"AutoConfig\": {\n" +
" \"Authorizer\": {\n" +
" \"AllowReuse\": false,\n" +
" \"AuthMethod\": {\n" +
" \"Config\": {\n" +
" \"ClockSkewLeeway\": 0,\n" +
" \"ExpirationLeeway\": 0,\n" +
" \"NotBeforeLeeway\": 0\n" +
" },\n" +
" \"MaxTokenTTL\": \"0s\",\n" +
" \"Name\": \"Auto Config Authorizer\",\n" +
" \"RaftIndex\": {\n" +
" \"CreateIndex\": 0,\n" +
" \"ModifyIndex\": 0\n" +
" },\n" +
" \"Type\": \"jwt\"\n" +
" },\n" +
" \"Enabled\": false\n" +
" },\n" +
" \"Enabled\": false,\n" +
" \"IntroToken\": \"hidden\"\n" +
" },\n" +
" \"ACLAgentToken\": \"hidden\",\n" +
" \"DNSEnableTruncate\": false,\n" +
" \"DisableKeyringFile\": true,\n" +
" \"SkipLeaveOnInt\": true,\n" +
" \"RaftProtocol\": 0,\n" +
" \"CheckDeregisterIntervalMin\": \"1m0s\",\n" +
" \"DNSRecursorTimeout\": \"2s\",\n" +
" \"RPCMaxBurst\": 1000,\n" +
" \"Revision\": \"12b16df32\",\n" +
" \"CheckOutputMaxSize\": 4096,\n" +
" \"TaggedAddresses\": {\n" +
" \"lan\": \"127.0.0.1\",\n" +
" \"lan_ipv4\": \"127.0.0.1\",\n" +
" \"wan\": \"127.0.0.1\",\n" +
" \"wan_ipv4\": \"127.0.0.1\"\n" +
" },\n" +
" \"AutopilotServerStabilizationTime\": \"10s\",\n" +
" \"DNSOnlyPassing\": false,\n" +
" \"VerifyIncoming\": false,\n" +
" \"DNSSOA\": {\n" +
" \"Expire\": 86400,\n" +
" \"Minttl\": 0,\n" +
" \"Refresh\": 3600,\n" +
" \"Retry\": 600\n" +
" },\n" +
" \"GossipWANGossipInterval\": \"100ms\",\n" +
" \"ACLPolicyTTL\": \"30s\",\n" +
" \"DisableUpdateCheck\": false,\n" +
" \"DNSPort\": 8600,\n" +
" \"NodeID\": \"46c53c05-5d11-8e08-c49b-a1e0c4a485b2\",\n" +
" \"RetryJoinIntervalWAN\": \"30s\",\n" +
" \"SessionTTLMin\": \"0s\",\n" +
" \"NonVotingServer\": false,\n" +
" \"ConnectMeshGatewayWANFederationEnabled\": false,\n" +
" \"SerfBindAddrLAN\": \"tcp://127.0.0.1:8301\",\n" +
" \"RetryJoinMaxAttemptsLAN\": 0,\n" +
" \"ACLAgentMasterToken\": \"hidden\",\n" +
" \"HTTPPort\": 8500,\n" +
" \"ConsulRaftElectionTimeout\": \"52ms\",\n" +
" \"RaftSnapshotInterval\": \"0s\",\n" +
" \"ConnectSidecarMinPort\": 21000,\n" +
" \"DNSUDPAnswerLimit\": 3,\n" +
" \"AEInterval\": \"1m0s\",\n" +
" \"Datacenter\": \"dc1\",\n" +
" \"RPCHoldTimeout\": \"7s\"\n" +
"}";
@Test
public void testDeserialization() throws IOException {
ObjectMapper mapper = Jackson.MAPPER;
final DebugConfig dbgConfig = mapper.readerFor(DebugConfig.class).readValue(JSON);
assertEquals("DebugConfig contains 167 items", 167, dbgConfig.size());
}
}
|
/*
* 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.gobblin.couchbase.writer;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.math3.util.Pair;
import com.couchbase.client.core.lang.Tuple;
import com.couchbase.client.core.lang.Tuple2;
import com.couchbase.client.core.message.ResponseStatus;
import com.couchbase.client.core.message.kv.MutationToken;
import com.couchbase.client.deps.io.netty.buffer.ByteBuf;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseCluster;
import com.couchbase.client.java.document.AbstractDocument;
import com.couchbase.client.java.document.Document;
import com.couchbase.client.java.document.RawJsonDocument;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.transcoder.Transcoder;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.typesafe.config.Config;
import lombok.extern.slf4j.Slf4j;
import rx.Observable;
import rx.Subscriber;
import org.apache.gobblin.couchbase.common.TupleDocument;
import org.apache.gobblin.util.ConfigUtils;
import org.apache.gobblin.writer.AsyncDataWriter;
import org.apache.gobblin.writer.GenericWriteResponse;
import org.apache.gobblin.writer.GenericWriteResponseWrapper;
import org.apache.gobblin.writer.SyncDataWriter;
import org.apache.gobblin.writer.WriteCallback;
import org.apache.gobblin.writer.WriteResponse;
import org.apache.gobblin.writer.WriteResponseFuture;
import org.apache.gobblin.writer.WriteResponseMapper;
/**
* A single bucket Couchbase writer.
*/
@Slf4j
public class CouchbaseWriter<D extends AbstractDocument> implements AsyncDataWriter<D>, SyncDataWriter<D> {
private final Cluster _cluster;
private final Bucket _bucket;
private final long _operationTimeout;
private final TimeUnit _operationTimeunit;
private final WriteResponseMapper<D> _defaultWriteResponseMapper;
// A basic transcoder that just passes through the embedded binary content.
private final Transcoder<TupleDocument, Tuple2<ByteBuf, Integer>> _tupleDocumentTranscoder =
new Transcoder<TupleDocument, Tuple2<ByteBuf, Integer>>() {
@Override
public TupleDocument decode(String id, ByteBuf content, long cas, int expiry, int flags,
ResponseStatus status) {
return newDocument(id, expiry, Tuple.create(content, flags), cas);
}
@Override
public Tuple2<ByteBuf, Integer> encode(TupleDocument document) {
return document.content();
}
@Override
public TupleDocument newDocument(String id, int expiry, Tuple2<ByteBuf, Integer> content, long cas) {
return new TupleDocument(id, expiry, content, cas);
}
@Override
public TupleDocument newDocument(String id, int expiry, Tuple2<ByteBuf, Integer> content, long cas,
MutationToken mutationToken) {
return new TupleDocument(id, expiry, content, cas);
}
@Override
public Class<TupleDocument> documentType() {
return TupleDocument.class;
}
};
public CouchbaseWriter(CouchbaseEnvironment couchbaseEnvironment, Config config) {
List<String> hosts = ConfigUtils.getStringList(config, CouchbaseWriterConfigurationKeys.BOOTSTRAP_SERVERS);
_cluster = CouchbaseCluster.create(couchbaseEnvironment, hosts);
String bucketName = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.BUCKET,
CouchbaseWriterConfigurationKeys.BUCKET_DEFAULT);
String password = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.PASSWORD, "");
_bucket = _cluster.openBucket(bucketName, password,
Collections.<Transcoder<? extends Document, ?>>singletonList(_tupleDocumentTranscoder));
_operationTimeout = ConfigUtils.getLong(config, CouchbaseWriterConfigurationKeys.OPERATION_TIMEOUT_MILLIS,
CouchbaseWriterConfigurationKeys.OPERATION_TIMEOUT_DEFAULT);
_operationTimeunit = TimeUnit.MILLISECONDS;
_defaultWriteResponseMapper = new GenericWriteResponseWrapper<>();
log.info("Couchbase writer configured with: hosts: {}, bucketName: {}, operationTimeoutInMillis: {}",
hosts, bucketName, _operationTimeout);
}
@VisibleForTesting
Bucket getBucket() {
return _bucket;
}
private void assertRecordWritable(D record) {
boolean recordIsTupleDocument = (record instanceof TupleDocument);
boolean recordIsJsonDocument = (record instanceof RawJsonDocument);
Preconditions.checkArgument(recordIsTupleDocument || recordIsJsonDocument,
"This writer only supports TupleDocument or RawJsonDocument. Found " + record.getClass().getName());
}
@Override
public Future<WriteResponse> write(final D record, final WriteCallback callback) {
assertRecordWritable(record);
if (record instanceof TupleDocument) {
((TupleDocument) record).content().value1().retain();
}
Observable<D> observable = _bucket.async().upsert(record);
if (callback == null) {
return new WriteResponseFuture<>(
observable.timeout(_operationTimeout, _operationTimeunit).toBlocking().toFuture(),
_defaultWriteResponseMapper);
} else {
final AtomicBoolean callbackFired = new AtomicBoolean(false);
final BlockingQueue<Pair<WriteResponse, Throwable>> writeResponseQueue = new ArrayBlockingQueue<>(1);
final Future<WriteResponse> writeResponseFuture = new Future<WriteResponse>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return callbackFired.get();
}
@Override
public WriteResponse get()
throws InterruptedException, ExecutionException {
Pair<WriteResponse, Throwable> writeResponseThrowablePair = writeResponseQueue.take();
return getWriteResponseorThrow(writeResponseThrowablePair);
}
@Override
public WriteResponse get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
Pair<WriteResponse, Throwable> writeResponseThrowablePair = writeResponseQueue.poll(timeout, unit);
if (writeResponseThrowablePair == null) {
throw new TimeoutException("Timeout exceeded while waiting for future to be done");
} else {
return getWriteResponseorThrow(writeResponseThrowablePair);
}
}
};
observable.timeout(_operationTimeout, _operationTimeunit)
.subscribe(new Subscriber<D>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
callbackFired.set(true);
writeResponseQueue.add(new Pair<WriteResponse, Throwable>(null, e));
callback.onFailure(e);
}
@Override
public void onNext(D doc) {
try {
callbackFired.set(true);
WriteResponse writeResponse = new GenericWriteResponse<D>(doc);
writeResponseQueue.add(new Pair<WriteResponse, Throwable>(writeResponse, null));
callback.onSuccess(writeResponse);
} finally {
if (doc instanceof TupleDocument) {
((TupleDocument) doc).content().value1().release();
}
}
}
});
return writeResponseFuture;
}
}
@Override
public void flush()
throws IOException {
}
private WriteResponse getWriteResponseorThrow(Pair<WriteResponse, Throwable> writeResponseThrowablePair)
throws ExecutionException {
if (writeResponseThrowablePair.getFirst() != null) {
return writeResponseThrowablePair.getFirst();
} else if (writeResponseThrowablePair.getSecond() != null) {
throw new ExecutionException(writeResponseThrowablePair.getSecond());
} else {
throw new ExecutionException(new RuntimeException("Could not find non-null WriteResponse pair"));
}
}
@Override
public void cleanup()
throws IOException {
}
@Override
public WriteResponse write(D record)
throws IOException {
try {
D doc = _bucket.upsert(record);
return new GenericWriteResponse(doc);
} catch (Exception e) {
throw new IOException("Failed to write to Couchbase cluster", e);
}
}
@Override
public void close() {
if (!_bucket.isClosed()) {
try {
_bucket.close();
} catch (Exception e) {
log.warn("Failed to close bucket", e);
}
}
try {
_cluster.disconnect();
} catch (Exception e) {
log.warn("Failed to disconnect from cluster", e);
}
}
}
|
/*
* 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.lucene.spatial.util;
/**
* Reusable geo-relation utility methods
*/
public class GeoRelationUtils {
// No instance:
private GeoRelationUtils() {
}
/**
* Determine if a bbox (defined by minLat, maxLat, minLon, maxLon) contains the provided point (defined by lat, lon)
* NOTE: this is a basic method that does not handle dateline or pole crossing. Unwrapping must be done before
* calling this method.
*/
public static boolean pointInRectPrecise(final double lat, final double lon,
final double minLat, final double maxLat,
final double minLon, final double maxLon) {
return lat >= minLat && lat <= maxLat && lon >= minLon && lon <= maxLon;
}
/////////////////////////
// Rectangle relations
/////////////////////////
/**
* Computes whether two rectangles are disjoint
*/
private static boolean rectDisjoint(final double aMinLat, final double aMaxLat, final double aMinLon, final double aMaxLon,
final double bMinLat, final double bMaxLat, final double bMinLon, final double bMaxLon) {
return (aMaxLon < bMinLon || aMinLon > bMaxLon || aMaxLat < bMinLat || aMinLat > bMaxLat);
}
/**
* Computes whether the first (a) rectangle is wholly within another (b) rectangle (shared boundaries allowed)
*/
public static boolean rectWithin(final double aMinLat, final double aMaxLat, final double aMinLon, final double aMaxLon,
final double bMinLat, final double bMaxLat, final double bMinLon, final double bMaxLon) {
return !(aMinLon < bMinLon || aMinLat < bMinLat || aMaxLon > bMaxLon || aMaxLat > bMaxLat);
}
/**
* Computes whether two rectangles cross
*/
public static boolean rectCrosses(final double aMinLat, final double aMaxLat, final double aMinLon, final double aMaxLon,
final double bMinLat, final double bMaxLat, final double bMinLon, final double bMaxLon) {
return !(rectDisjoint(aMinLat, aMaxLat, aMinLon, aMaxLon, bMinLat, bMaxLat, bMinLon, bMaxLon) ||
rectWithin(aMinLat, aMaxLat, aMinLon, aMaxLon, bMinLat, bMaxLat, bMinLon, bMaxLon));
}
/**
* Computes whether a rectangle intersects another rectangle (crosses, within, touching, etc)
*/
public static boolean rectIntersects(final double aMinLat, final double aMaxLat, final double aMinLon, final double aMaxLon,
final double bMinLat, final double bMaxLat, final double bMinLon, final double bMaxLon) {
return !((aMaxLon < bMinLon || aMinLon > bMaxLon || aMaxLat < bMinLat || aMinLat > bMaxLat));
}
}
|
/*
* Copyright 2012 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.android.apps.mytracks.maps;
import com.google.android.apps.mytracks.MapOverlay.CachedLocation;
import com.google.android.apps.mytracks.stats.TripStatistics;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.Polyline;
import java.util.ArrayList;
import java.util.List;
/**
* A track path.
*
* @author Jimmy Shih
*/
public interface TrackPath {
/**
* Updates state.
*
* @param tripStatistics the trip statistics
* @return true if the state is updated.
*/
boolean updateState(TripStatistics tripStatistics);
/**
* Updates the path.
*
* @param startIndex the start index
* @param points the points
*/
void updatePath(GoogleMap googleMap, ArrayList<Polyline> paths, int startIndex,
List<CachedLocation> points);
}
|
package algo.divideandconquer;
/**
* Created by orca on 2018/12/27.
* 问题:大数据排序。输入输出为10G以上文件。环境:单机 RAM=4G
*/
public class BigDataSort {
}
|
/*
* Copyright 2015-2020 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.codecommit.model;
import javax.annotation.Generated;
/**
* <p>
* An approval state is required, but was not specified.
* </p>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ApprovalStateRequiredException extends com.amazonaws.services.codecommit.model.AWSCodeCommitException {
private static final long serialVersionUID = 1L;
/**
* Constructs a new ApprovalStateRequiredException with the specified error message.
*
* @param message
* Describes the error encountered.
*/
public ApprovalStateRequiredException(String message) {
super(message);
}
}
|
//package me.dolphago.service;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import me.dolphago.client.TestClient;
//
//@Service
//public class ClientTestService{
// //@Autowired를 통해 방금 작성한 client 의존성 주입
// @Autowired
// TestClient testClient;
//
// // client의 기능을 사용할 메소드 testFeign 작성
// public String testFeign() {
// return testClient.testFeign();
// }
//}
|
/*******************************************************************************
* Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.debug.tests.eval;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.jdt.debug.core.IJavaPrimitiveValue;
import org.eclipse.jdt.internal.debug.core.model.JDIObjectValue;
public class QualifiedStaticFieldValueTests2 extends Tests {
public QualifiedStaticFieldValueTests2(String arg) {
super(arg);
}
protected void init() throws Exception {
initializeFrame("EvalTypeTests", 73, 1);
}
protected void end() throws Exception {
destroyFrame();
}
public void testByteStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldByte);
String typeName = value.getReferenceTypeName();
assertEquals("byte field value : wrong type : ", "byte", typeName);
byte byteValue = ((IJavaPrimitiveValue) value).getByteValue();
assertEquals("byte field value : wrong result : ", xStaticFieldByteValue, byteValue);
value = eval("EvalTypeTests." + yStaticFieldByte);
typeName = value.getReferenceTypeName();
assertEquals("byte field value : wrong type : ", "byte", typeName);
byteValue = ((IJavaPrimitiveValue) value).getByteValue();
assertEquals("byte field value : wrong result : ", yStaticFieldByteValue, byteValue);
} finally {
end();
}
}
public void testCharStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldChar);
String typeName = value.getReferenceTypeName();
assertEquals("char field value : wrong type : ", "char", typeName);
char charValue = ((IJavaPrimitiveValue) value).getCharValue();
assertEquals("char field value : wrong result : ", xStaticFieldCharValue, charValue);
value = eval("EvalTypeTests." + yStaticFieldChar);
typeName = value.getReferenceTypeName();
assertEquals("char field value : wrong type : ", "char", typeName);
charValue = ((IJavaPrimitiveValue) value).getCharValue();
assertEquals("char field value : wrong result : ", yStaticFieldCharValue, charValue);
} finally {
end();
}
}
public void testShortStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldShort);
String typeName = value.getReferenceTypeName();
assertEquals("short field value : wrong type : ", "short", typeName);
short shortValue = ((IJavaPrimitiveValue) value).getShortValue();
assertEquals("short field value : wrong result : ", xStaticFieldShortValue, shortValue);
value = eval("EvalTypeTests." + yStaticFieldShort);
typeName = value.getReferenceTypeName();
assertEquals("short field value : wrong type : ", "short", typeName);
shortValue = ((IJavaPrimitiveValue) value).getShortValue();
assertEquals("short field value : wrong result : ", yStaticFieldShortValue, shortValue);
} finally {
end();
}
}
public void testIntStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldInt);
String typeName = value.getReferenceTypeName();
assertEquals("int field value : wrong type : ", "int", typeName);
int intValue = ((IJavaPrimitiveValue) value).getIntValue();
assertEquals("int field value : wrong result : ", xStaticFieldIntValue, intValue);
value = eval("EvalTypeTests." + yStaticFieldInt);
typeName = value.getReferenceTypeName();
assertEquals("int field value : wrong type : ", "int", typeName);
intValue = ((IJavaPrimitiveValue) value).getIntValue();
assertEquals("int field value : wrong result : ", yStaticFieldIntValue, intValue);
} finally {
end();
}
}
public void testLongStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldLong);
String typeName = value.getReferenceTypeName();
assertEquals("long field value : wrong type : ", "long", typeName);
long longValue = ((IJavaPrimitiveValue) value).getLongValue();
assertEquals("long field value : wrong result : ", xStaticFieldLongValue, longValue);
value = eval("EvalTypeTests." + yStaticFieldLong);
typeName = value.getReferenceTypeName();
assertEquals("long field value : wrong type : ", "long", typeName);
longValue = ((IJavaPrimitiveValue) value).getLongValue();
assertEquals("long field value : wrong result : ", yStaticFieldLongValue, longValue);
} finally {
end();
}
}
public void testFloatStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldFloat);
String typeName = value.getReferenceTypeName();
assertEquals("float field value : wrong type : ", "float", typeName);
float floatValue = ((IJavaPrimitiveValue) value).getFloatValue();
assertEquals("float field value : wrong result : ", xStaticFieldFloatValue, floatValue, 0);
value = eval("EvalTypeTests." + yStaticFieldFloat);
typeName = value.getReferenceTypeName();
assertEquals("float field value : wrong type : ", "float", typeName);
floatValue = ((IJavaPrimitiveValue) value).getFloatValue();
assertEquals("float field value : wrong result : ", yStaticFieldFloatValue, floatValue, 0);
} finally {
end();
}
}
public void testDoubleStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldDouble);
String typeName = value.getReferenceTypeName();
assertEquals("double field value : wrong type : ", "double", typeName);
double doubleValue = ((IJavaPrimitiveValue) value).getDoubleValue();
assertEquals("double field value : wrong result : ", xStaticFieldDoubleValue, doubleValue, 0);
value = eval("EvalTypeTests." + yStaticFieldDouble);
typeName = value.getReferenceTypeName();
assertEquals("double field value : wrong type : ", "double", typeName);
doubleValue = ((IJavaPrimitiveValue) value).getDoubleValue();
assertEquals("double field value : wrong result : ", yStaticFieldDoubleValue, doubleValue, 0);
} finally {
end();
}
}
public void testStringStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldString);
String typeName = value.getReferenceTypeName();
assertEquals("java.lang.String field value : wrong type : ", "java.lang.String", typeName);
String stringValue = ((JDIObjectValue) value).getValueString();
assertEquals("java.lang.String field value : wrong result : ", xStaticFieldStringValue, stringValue);
value = eval("EvalTypeTests." + yStaticFieldString);
typeName = value.getReferenceTypeName();
assertEquals("java.lang.String field value : wrong type : ", "java.lang.String", typeName);
stringValue = ((JDIObjectValue) value).getValueString();
assertEquals("java.lang.String field value : wrong result : ", yStaticFieldStringValue, stringValue);
} finally {
end();
}
}
public void testBooleanStaticFieldValue() throws Throwable {
try {
init();
IValue value = eval("EvalTypeTests." + xStaticFieldBoolean);
String typeName = value.getReferenceTypeName();
assertEquals("boolean field value : wrong type : ", "boolean", typeName);
boolean booleanValue = ((IJavaPrimitiveValue) value).getBooleanValue();
assertEquals("boolean field value : wrong result : ", xStaticFieldBooleanValue, booleanValue);
value = eval("EvalTypeTests." + yStaticFieldBoolean);
typeName = value.getReferenceTypeName();
assertEquals("boolean field value : wrong type : ", "boolean", typeName);
booleanValue = ((IJavaPrimitiveValue) value).getBooleanValue();
assertEquals("boolean field value : wrong result : ", yStaticFieldBooleanValue, booleanValue);
} finally {
end();
}
}
}
|
/* Generated By:JavaCC: Do not edit this line. TurtleParserTokenManager.java */
/*
* 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.
*/
/**********************************************************************************
* Copyright (c) 2011, Monnet Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Monnet Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE MONNET PROJECT BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*********************************************************************************/
package eu.monnetproject.lemon.impl.io.turtle;
/** Token Manager. */
public class TurtleParserTokenManager implements TurtleParserConstants
{
/** Debug output. */
public java.io.PrintStream debugStream = System.out;
/** Set debug output. */
public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private int jjStopAtPos(int pos, int kind)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
return pos + 1;
}
private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 9:
jjmatchedKind = 7;
return jjMoveNfa_0(0, 0);
case 10:
jjmatchedKind = 8;
return jjMoveNfa_0(0, 0);
case 12:
jjmatchedKind = 10;
return jjMoveNfa_0(0, 0);
case 13:
jjmatchedKind = 9;
return jjMoveNfa_0(0, 0);
case 32:
jjmatchedKind = 6;
return jjMoveNfa_0(0, 0);
case 33:
jjmatchedKind = 1;
return jjMoveNfa_0(0, 0);
case 36:
jjmatchedKind = 51;
return jjMoveNfa_0(0, 0);
case 40:
jjmatchedKind = 38;
return jjMoveNfa_0(0, 0);
case 41:
jjmatchedKind = 39;
return jjMoveNfa_0(0, 0);
case 42:
jjmatchedKind = 55;
return jjMoveNfa_0(0, 0);
case 44:
jjmatchedKind = 47;
return jjMoveNfa_0(0, 0);
case 45:
return jjMoveStringLiteralDfa1_0(0x10L);
case 46:
jjmatchedKind = 48;
return jjMoveNfa_0(0, 0);
case 47:
jjmatchedKind = 56;
return jjMoveNfa_0(0, 0);
case 58:
jjmatchedKind = 54;
return jjMoveNfa_0(0, 0);
case 59:
jjmatchedKind = 46;
return jjMoveNfa_0(0, 0);
case 60:
return jjMoveStringLiteralDfa1_0(0x20L);
case 61:
jjmatchedKind = 49;
return jjMoveStringLiteralDfa1_0(0x4000000000000L);
case 63:
jjmatchedKind = 52;
return jjMoveNfa_0(0, 0);
case 64:
jjmatchedKind = 60;
return jjMoveStringLiteralDfa1_0(0xc000L);
case 70:
return jjMoveStringLiteralDfa1_0(0x20000L);
case 84:
return jjMoveStringLiteralDfa1_0(0x10000L);
case 91:
jjmatchedKind = 43;
return jjMoveNfa_0(0, 0);
case 92:
jjmatchedKind = 57;
return jjMoveNfa_0(0, 0);
case 93:
jjmatchedKind = 44;
return jjMoveNfa_0(0, 0);
case 94:
jjmatchedKind = 3;
return jjMoveStringLiteralDfa1_0(0x800000000000000L);
case 97:
jjmatchedKind = 13;
return jjMoveNfa_0(0, 0);
case 102:
return jjMoveStringLiteralDfa1_0(0x20000L);
case 116:
return jjMoveStringLiteralDfa1_0(0x10000L);
case 123:
jjmatchedKind = 41;
return jjMoveNfa_0(0, 0);
case 124:
jjmatchedKind = 2;
return jjMoveNfa_0(0, 0);
case 125:
jjmatchedKind = 42;
return jjMoveNfa_0(0, 0);
case 126:
jjmatchedKind = 53;
return jjMoveNfa_0(0, 0);
case 65279:
jjmatchedKind = 58;
return jjMoveNfa_0(0, 0);
default :
return jjMoveNfa_0(0, 0);
}
}
private int jjMoveStringLiteralDfa1_0(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 0);
}
switch(curChar)
{
case 45:
if ((active0 & 0x20L) != 0L)
{
jjmatchedKind = 5;
jjmatchedPos = 1;
}
break;
case 62:
if ((active0 & 0x10L) != 0L)
{
jjmatchedKind = 4;
jjmatchedPos = 1;
}
else if ((active0 & 0x4000000000000L) != 0L)
{
jjmatchedKind = 50;
jjmatchedPos = 1;
}
break;
case 65:
return jjMoveStringLiteralDfa2_0(active0, 0x20000L);
case 82:
return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
case 94:
if ((active0 & 0x800000000000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
break;
case 97:
return jjMoveStringLiteralDfa2_0(active0, 0x20000L);
case 98:
return jjMoveStringLiteralDfa2_0(active0, 0x8000L);
case 112:
return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
case 114:
return jjMoveStringLiteralDfa2_0(active0, 0x10000L);
default :
break;
}
return jjMoveNfa_0(0, 1);
}
private int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 1);
}
switch(curChar)
{
case 76:
return jjMoveStringLiteralDfa3_0(active0, 0x20000L);
case 85:
return jjMoveStringLiteralDfa3_0(active0, 0x10000L);
case 97:
return jjMoveStringLiteralDfa3_0(active0, 0x8000L);
case 108:
return jjMoveStringLiteralDfa3_0(active0, 0x20000L);
case 114:
return jjMoveStringLiteralDfa3_0(active0, 0x4000L);
case 117:
return jjMoveStringLiteralDfa3_0(active0, 0x10000L);
default :
break;
}
return jjMoveNfa_0(0, 2);
}
private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 2);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 2);
}
switch(curChar)
{
case 69:
if ((active0 & 0x10000L) != 0L)
{
jjmatchedKind = 16;
jjmatchedPos = 3;
}
break;
case 83:
return jjMoveStringLiteralDfa4_0(active0, 0x20000L);
case 101:
if ((active0 & 0x10000L) != 0L)
{
jjmatchedKind = 16;
jjmatchedPos = 3;
}
return jjMoveStringLiteralDfa4_0(active0, 0x4000L);
case 115:
return jjMoveStringLiteralDfa4_0(active0, 0x28000L);
default :
break;
}
return jjMoveNfa_0(0, 3);
}
private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 3);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 3);
}
switch(curChar)
{
case 69:
if ((active0 & 0x20000L) != 0L)
{
jjmatchedKind = 17;
jjmatchedPos = 4;
}
break;
case 101:
if ((active0 & 0x8000L) != 0L)
{
jjmatchedKind = 15;
jjmatchedPos = 4;
}
else if ((active0 & 0x20000L) != 0L)
{
jjmatchedKind = 17;
jjmatchedPos = 4;
}
break;
case 102:
return jjMoveStringLiteralDfa5_0(active0, 0x4000L);
default :
break;
}
return jjMoveNfa_0(0, 4);
}
private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 4);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 4);
}
switch(curChar)
{
case 105:
return jjMoveStringLiteralDfa6_0(active0, 0x4000L);
default :
break;
}
return jjMoveNfa_0(0, 5);
}
private int jjMoveStringLiteralDfa6_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 5);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 5);
}
switch(curChar)
{
case 120:
if ((active0 & 0x4000L) != 0L)
{
jjmatchedKind = 14;
jjmatchedPos = 6;
}
break;
default :
break;
}
return jjMoveNfa_0(0, 6);
}
static final long[] jjbitVec0 = {
0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec2 = {
0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec3 = {
0xfffe7000fffffff6L, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x7e00000000ffffffL
};
static final long[] jjbitVec4 = {
0x0L, 0x0L, 0x0L, 0xff7fffffff7fffffL
};
static final long[] jjbitVec5 = {
0x0L, 0xbfff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec6 = {
0x3000L, 0xffff000000000000L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec7 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffL, 0x0L
};
static final long[] jjbitVec8 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffL
};
static final long[] jjbitVec9 = {
0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0x3fffffffffffffffL
};
static final long[] jjbitVec10 = {
0x0L, 0x0L, 0x80000000000000L, 0xff7fffffff7fffffL
};
static final long[] jjbitVec11 = {
0xffffffffffffffffL, 0xbfffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static final long[] jjbitVec12 = {
0x8000000000003000L, 0xffff000000000001L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
private int jjMoveNfa_0(int startState, int curPos)
{
int strKind = jjmatchedKind;
int strPos = jjmatchedPos;
int seenUpto;
input_stream.backup(seenUpto = curPos + 1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { throw new Error("Internal Error"); }
curPos = 0;
int startsAt = 0;
jjnewStateCnt = 109;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64)
{
long l = 1L << curChar;
do
{
switch(jjstateSet[--i])
{
case 0:
if ((0x3ff000000000000L & l) != 0L)
{
if (kind > 18)
kind = 18;
jjCheckNAddStates(0, 7);
}
else if ((0x280000000000L & l) != 0L)
jjCheckNAddStates(8, 12);
else if (curChar == 58)
{
if (kind > 31)
kind = 31;
jjCheckNAdd(105);
}
else if (curChar == 46)
jjCheckNAddTwoStates(78, 80);
else if (curChar == 40)
jjCheckNAddStates(13, 15);
else if (curChar == 60)
jjCheckNAddTwoStates(42, 43);
else if (curChar == 34)
jjstateSet[jjnewStateCnt++] = 39;
else if (curChar == 39)
jjstateSet[jjnewStateCnt++] = 27;
else if (curChar == 35)
{
if (kind > 12)
kind = 12;
jjCheckNAddStates(16, 18);
}
else if (curChar == 63)
jjstateSet[jjnewStateCnt++] = 50;
if (curChar == 34)
jjCheckNAddStates(19, 21);
else if (curChar == 39)
jjCheckNAddStates(22, 24);
break;
case 1:
if ((0xffffffffffffdbffL & l) == 0L)
break;
if (kind > 12)
kind = 12;
jjCheckNAddStates(16, 18);
break;
case 2:
if ((0x2400L & l) != 0L && kind > 12)
kind = 12;
break;
case 3:
if (curChar == 10 && kind > 12)
kind = 12;
break;
case 4:
if (curChar == 13)
jjstateSet[jjnewStateCnt++] = 3;
break;
case 6:
if ((0x8400000000L & l) != 0L && kind > 24)
kind = 24;
break;
case 7:
if (curChar == 39)
jjCheckNAddStates(22, 24);
break;
case 8:
if ((0xffffff7fffffdbffL & l) != 0L)
jjCheckNAddStates(22, 24);
break;
case 10:
if ((0x8400000000L & l) != 0L)
jjCheckNAddStates(22, 24);
break;
case 11:
if (curChar == 39 && kind > 25)
kind = 25;
break;
case 12:
if (curChar == 34)
jjCheckNAddStates(19, 21);
break;
case 13:
if ((0xfffffffbffffdbffL & l) != 0L)
jjCheckNAddStates(19, 21);
break;
case 15:
if ((0x8400000000L & l) != 0L)
jjCheckNAddStates(19, 21);
break;
case 16:
if (curChar == 34 && kind > 26)
kind = 26;
break;
case 17:
if (curChar == 39)
jjCheckNAddStates(25, 28);
break;
case 18:
case 22:
if ((0xffffff7fffffffffL & l) != 0L)
jjCheckNAddStates(25, 28);
break;
case 20:
if ((0x8400000000L & l) != 0L)
jjCheckNAddStates(25, 28);
break;
case 21:
case 24:
if (curChar == 39)
jjCheckNAdd(22);
break;
case 23:
if (curChar == 39)
jjAddStates(29, 30);
break;
case 25:
if (curChar == 39 && kind > 27)
kind = 27;
break;
case 26:
if (curChar == 39)
jjstateSet[jjnewStateCnt++] = 25;
break;
case 27:
if (curChar == 39)
jjstateSet[jjnewStateCnt++] = 17;
break;
case 28:
if (curChar == 39)
jjstateSet[jjnewStateCnt++] = 27;
break;
case 29:
if (curChar == 34)
jjCheckNAddStates(31, 34);
break;
case 30:
case 34:
if ((0xfffffffbffffffffL & l) != 0L)
jjCheckNAddStates(31, 34);
break;
case 32:
if ((0x8400000000L & l) != 0L)
jjCheckNAddStates(31, 34);
break;
case 33:
case 36:
if (curChar == 34)
jjCheckNAdd(34);
break;
case 35:
if (curChar == 34)
jjAddStates(35, 36);
break;
case 37:
if (curChar == 34 && kind > 28)
kind = 28;
break;
case 38:
if (curChar == 34)
jjstateSet[jjnewStateCnt++] = 37;
break;
case 39:
if (curChar == 34)
jjstateSet[jjnewStateCnt++] = 29;
break;
case 40:
if (curChar == 34)
jjstateSet[jjnewStateCnt++] = 39;
break;
case 41:
if (curChar == 60)
jjCheckNAddTwoStates(42, 43);
break;
case 42:
if ((0xaffffffa00000000L & l) != 0L)
jjCheckNAddTwoStates(42, 43);
break;
case 43:
if (curChar == 62 && kind > 30)
kind = 30;
break;
case 44:
if (curChar == 58)
jjstateSet[jjnewStateCnt++] = 45;
break;
case 45:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 33)
kind = 33;
jjCheckNAddTwoStates(46, 47);
break;
case 46:
if ((0x3ff600000000000L & l) != 0L)
jjCheckNAddTwoStates(46, 47);
break;
case 47:
if ((0x3ff200000000000L & l) != 0L && kind > 33)
kind = 33;
break;
case 49:
if (curChar == 63)
jjstateSet[jjnewStateCnt++] = 50;
break;
case 50:
case 51:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 34)
kind = 34;
jjCheckNAdd(51);
break;
case 54:
if (curChar == 45)
jjCheckNAdd(55);
break;
case 55:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 35)
kind = 35;
jjCheckNAddTwoStates(54, 55);
break;
case 56:
if (curChar == 40)
jjCheckNAddStates(13, 15);
break;
case 57:
if (curChar == 35)
jjCheckNAddStates(37, 42);
break;
case 58:
if ((0xffffffffffffdbffL & l) != 0L)
jjCheckNAddStates(37, 42);
break;
case 59:
if ((0x2400L & l) != 0L)
jjCheckNAddStates(13, 15);
break;
case 60:
if ((0x100003600L & l) != 0L)
jjCheckNAddStates(13, 15);
break;
case 61:
if (curChar == 41 && kind > 40)
kind = 40;
break;
case 62:
if (curChar == 10)
jjCheckNAddStates(13, 15);
break;
case 63:
if (curChar == 13)
jjstateSet[jjnewStateCnt++] = 62;
break;
case 65:
if (curChar == 35)
jjCheckNAddStates(43, 48);
break;
case 66:
if ((0xffffffffffffdbffL & l) != 0L)
jjCheckNAddStates(43, 48);
break;
case 67:
if ((0x2400L & l) != 0L)
jjCheckNAddStates(49, 51);
break;
case 68:
if ((0x100003600L & l) != 0L)
jjCheckNAddStates(49, 51);
break;
case 70:
if (curChar == 10)
jjCheckNAddStates(49, 51);
break;
case 71:
if (curChar == 13)
jjstateSet[jjnewStateCnt++] = 70;
break;
case 72:
if ((0x280000000000L & l) != 0L)
jjCheckNAddStates(8, 12);
break;
case 73:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 18)
kind = 18;
jjCheckNAdd(73);
break;
case 74:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(74, 75);
break;
case 75:
if (curChar != 46)
break;
if (kind > 19)
kind = 19;
jjCheckNAdd(76);
break;
case 76:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 19)
kind = 19;
jjCheckNAdd(76);
break;
case 77:
if (curChar == 46)
jjCheckNAdd(78);
break;
case 78:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 19)
kind = 19;
jjCheckNAdd(78);
break;
case 79:
if (curChar == 46)
jjCheckNAdd(80);
break;
case 80:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(80, 81);
break;
case 82:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(83);
break;
case 83:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(83);
break;
case 84:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddStates(52, 55);
break;
case 85:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(85, 86);
break;
case 86:
if (curChar == 46)
jjCheckNAddTwoStates(87, 88);
break;
case 87:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(87, 88);
break;
case 89:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(90);
break;
case 90:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(90);
break;
case 91:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(91, 92);
break;
case 93:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(94);
break;
case 94:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 20)
kind = 20;
jjCheckNAdd(94);
break;
case 95:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 18)
kind = 18;
jjCheckNAddStates(0, 7);
break;
case 96:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 29)
kind = 29;
jjCheckNAdd(96);
break;
case 97:
if (curChar == 46)
jjCheckNAddTwoStates(78, 80);
break;
case 99:
if ((0x3ff600000000000L & l) != 0L)
jjAddStates(56, 57);
break;
case 100:
if ((0x3ff200000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 101;
break;
case 101:
if (curChar == 58 && kind > 31)
kind = 31;
break;
case 102:
if ((0x3ff600000000000L & l) != 0L)
jjAddStates(58, 59);
break;
case 103:
if ((0x3ff200000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 104;
break;
case 104:
if (curChar == 58)
jjCheckNAdd(105);
break;
case 105:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 32)
kind = 32;
jjCheckNAddTwoStates(106, 107);
break;
case 106:
if ((0x3ff600000000000L & l) != 0L)
jjCheckNAddTwoStates(106, 107);
break;
case 107:
if ((0x3ff200000000000L & l) != 0L && kind > 32)
kind = 32;
break;
case 108:
if (curChar != 58)
break;
if (kind > 31)
kind = 31;
jjCheckNAdd(105);
break;
default : break;
}
} while(i != startsAt);
}
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 0:
if ((0x7fffffe07fffffeL & l) != 0L)
jjCheckNAddStates(60, 65);
else if (curChar == 91)
jjCheckNAddStates(49, 51);
else if (curChar == 64)
jjCheckNAdd(53);
else if (curChar == 95)
jjstateSet[jjnewStateCnt++] = 44;
else if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 6;
break;
case 1:
if (kind > 12)
kind = 12;
jjAddStates(16, 18);
break;
case 5:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 6;
break;
case 6:
if ((0x14404410144044L & l) != 0L && kind > 24)
kind = 24;
break;
case 8:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(22, 24);
break;
case 9:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 10;
break;
case 10:
if ((0x14404410144044L & l) != 0L)
jjCheckNAddStates(22, 24);
break;
case 13:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(19, 21);
break;
case 14:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 15;
break;
case 15:
if ((0x14404410144044L & l) != 0L)
jjCheckNAddStates(19, 21);
break;
case 18:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(25, 28);
break;
case 19:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 20;
break;
case 20:
if ((0x14404410144044L & l) != 0L)
jjCheckNAddStates(25, 28);
break;
case 22:
jjCheckNAddStates(25, 28);
break;
case 30:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(31, 34);
break;
case 31:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 32;
break;
case 32:
if ((0x14404410144044L & l) != 0L)
jjCheckNAddStates(31, 34);
break;
case 34:
jjCheckNAddStates(31, 34);
break;
case 42:
if ((0xc7fffffeafffffffL & l) != 0L)
jjAddStates(66, 67);
break;
case 45:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
if (kind > 33)
kind = 33;
jjCheckNAddTwoStates(46, 47);
break;
case 46:
if ((0x7fffffe87fffffeL & l) != 0L)
jjCheckNAddTwoStates(46, 47);
break;
case 47:
if ((0x7fffffe87fffffeL & l) != 0L && kind > 33)
kind = 33;
break;
case 48:
if (curChar == 95)
jjstateSet[jjnewStateCnt++] = 44;
break;
case 50:
case 51:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
if (kind > 34)
kind = 34;
jjCheckNAdd(51);
break;
case 52:
if (curChar == 64)
jjCheckNAdd(53);
break;
case 53:
if ((0x7fffffe07fffffeL & l) == 0L)
break;
if (kind > 35)
kind = 35;
jjCheckNAddTwoStates(53, 54);
break;
case 55:
if ((0x7fffffe07fffffeL & l) == 0L)
break;
if (kind > 35)
kind = 35;
jjCheckNAddTwoStates(54, 55);
break;
case 58:
jjAddStates(37, 42);
break;
case 64:
if (curChar == 91)
jjCheckNAddStates(49, 51);
break;
case 66:
jjCheckNAddStates(43, 48);
break;
case 69:
if (curChar == 93 && kind > 45)
kind = 45;
break;
case 81:
if ((0x2000000020L & l) != 0L)
jjAddStates(68, 69);
break;
case 88:
if ((0x2000000020L & l) != 0L)
jjAddStates(70, 71);
break;
case 92:
if ((0x2000000020L & l) != 0L)
jjAddStates(72, 73);
break;
case 98:
if ((0x7fffffe07fffffeL & l) != 0L)
jjCheckNAddStates(60, 65);
break;
case 99:
if ((0x7fffffe87fffffeL & l) != 0L)
jjCheckNAddTwoStates(99, 100);
break;
case 100:
if ((0x7fffffe87fffffeL & l) != 0L)
jjCheckNAdd(101);
break;
case 102:
if ((0x7fffffe87fffffeL & l) != 0L)
jjCheckNAddTwoStates(102, 103);
break;
case 103:
if ((0x7fffffe87fffffeL & l) != 0L)
jjCheckNAdd(104);
break;
case 105:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
if (kind > 32)
kind = 32;
jjCheckNAddTwoStates(106, 107);
break;
case 106:
if ((0x7fffffe87fffffeL & l) != 0L)
jjCheckNAddTwoStates(106, 107);
break;
case 107:
if ((0x7fffffe87fffffeL & l) != 0L && kind > 32)
kind = 32;
break;
default : break;
}
} while(i != startsAt);
}
else
{
int hiByte = (int)(curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 0:
if (jjCanMove_1(hiByte, i1, i2, l1, l2))
jjCheckNAddStates(60, 65);
break;
case 1:
if (!jjCanMove_0(hiByte, i1, i2, l1, l2))
break;
if (kind > 12)
kind = 12;
jjAddStates(16, 18);
break;
case 8:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(22, 24);
break;
case 13:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(19, 21);
break;
case 18:
case 22:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjCheckNAddStates(25, 28);
break;
case 30:
case 34:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjCheckNAddStates(31, 34);
break;
case 42:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(66, 67);
break;
case 45:
if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
break;
if (kind > 33)
kind = 33;
jjCheckNAddTwoStates(46, 47);
break;
case 46:
if (jjCanMove_2(hiByte, i1, i2, l1, l2))
jjCheckNAddTwoStates(46, 47);
break;
case 47:
if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 33)
kind = 33;
break;
case 50:
if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
break;
if (kind > 34)
kind = 34;
jjCheckNAdd(51);
break;
case 51:
if (!jjCanMove_2(hiByte, i1, i2, l1, l2))
break;
if (kind > 34)
kind = 34;
jjCheckNAdd(51);
break;
case 58:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(37, 42);
break;
case 66:
if (jjCanMove_0(hiByte, i1, i2, l1, l2))
jjAddStates(43, 48);
break;
case 99:
if (jjCanMove_2(hiByte, i1, i2, l1, l2))
jjCheckNAddTwoStates(99, 100);
break;
case 100:
if (jjCanMove_2(hiByte, i1, i2, l1, l2))
jjCheckNAdd(101);
break;
case 102:
if (jjCanMove_2(hiByte, i1, i2, l1, l2))
jjCheckNAddTwoStates(102, 103);
break;
case 103:
if (jjCanMove_2(hiByte, i1, i2, l1, l2))
jjCheckNAdd(104);
break;
case 105:
if (!jjCanMove_1(hiByte, i1, i2, l1, l2))
break;
if (kind > 32)
kind = 32;
jjCheckNAddTwoStates(106, 107);
break;
case 106:
if (jjCanMove_2(hiByte, i1, i2, l1, l2))
jjCheckNAddTwoStates(106, 107);
break;
case 107:
if (jjCanMove_2(hiByte, i1, i2, l1, l2) && kind > 32)
kind = 32;
break;
default : break;
}
} while(i != startsAt);
}
if (kind != 0x7fffffff)
{
jjmatchedKind = kind;
jjmatchedPos = curPos;
kind = 0x7fffffff;
}
++curPos;
if ((i = jjnewStateCnt) == (startsAt = 109 - (jjnewStateCnt = startsAt)))
break;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { break; }
}
if (jjmatchedPos > strPos)
return curPos;
int toRet = Math.max(curPos, seenUpto);
if (curPos < toRet)
for (i = toRet - Math.min(curPos, seenUpto); i-- > 0; )
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { throw new Error("Internal Error : Please send a bug report."); }
if (jjmatchedPos < strPos)
{
jjmatchedKind = strKind;
jjmatchedPos = strPos;
}
else if (jjmatchedPos == strPos && jjmatchedKind > strKind)
jjmatchedKind = strKind;
return toRet;
}
static final int[] jjnextStates = {
73, 74, 75, 85, 86, 91, 92, 96, 73, 74, 77, 79, 84, 57, 60, 61,
1, 2, 4, 13, 14, 16, 8, 9, 11, 18, 19, 21, 23, 24, 26, 30,
31, 33, 35, 36, 38, 57, 58, 59, 63, 60, 61, 65, 66, 67, 71, 68,
69, 65, 68, 69, 85, 86, 91, 92, 99, 100, 102, 103, 99, 100, 101, 102,
103, 104, 42, 43, 82, 83, 89, 90, 93, 94,
};
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec2[i2] & l2) != 0L);
default :
if ((jjbitVec0[i1] & l1) != 0L)
return true;
return false;
}
}
private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec4[i2] & l2) != 0L);
case 3:
return ((jjbitVec5[i2] & l2) != 0L);
case 32:
return ((jjbitVec6[i2] & l2) != 0L);
case 33:
return ((jjbitVec7[i2] & l2) != 0L);
case 47:
return ((jjbitVec8[i2] & l2) != 0L);
case 48:
return ((jjbitVec0[i2] & l2) != 0L);
case 255:
return ((jjbitVec9[i2] & l2) != 0L);
default :
if ((jjbitVec3[i1] & l1) != 0L)
return true;
return false;
}
}
private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec10[i2] & l2) != 0L);
case 3:
return ((jjbitVec11[i2] & l2) != 0L);
case 32:
return ((jjbitVec12[i2] & l2) != 0L);
case 33:
return ((jjbitVec7[i2] & l2) != 0L);
case 47:
return ((jjbitVec8[i2] & l2) != 0L);
case 48:
return ((jjbitVec0[i2] & l2) != 0L);
case 255:
return ((jjbitVec9[i2] & l2) != 0L);
default :
if ((jjbitVec3[i1] & l1) != 0L)
return true;
return false;
}
}
/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", "\41", "\174", "\136", "\55\76", "\74\55", null, null, null, null, null,
null, null, "\141", "\100\160\162\145\146\151\170", "\100\142\141\163\145", null,
null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, "\50", "\51", null, "\173", "\175",
"\133", "\135", null, "\73", "\54", "\56", "\75", "\75\76", "\44", "\77", "\176",
"\72", "\52", "\57", "\134", "\ufeff", "\136\136", "\100", null, null, null, null,
null, null, null, };
/** Lexer state names. */
public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
0x1fffffcfff1fe03fL, 0x0L,
};
static final long[] jjtoSkip = {
0x17c0L, 0x0L,
};
static final long[] jjtoSpecial = {
0x1000L, 0x0L,
};
protected JavaCharStream input_stream;
private final int[] jjrounds = new int[109];
private final int[] jjstateSet = new int[218];
protected char curChar;
/** Constructor. */
public TurtleParserTokenManager(JavaCharStream stream){
if (JavaCharStream.staticFlag)
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
input_stream = stream;
}
/** Constructor. */
public TurtleParserTokenManager(JavaCharStream stream, int lexState){
this(stream);
SwitchTo(lexState);
}
/** Reinitialise parser. */
public void ReInit(JavaCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
}
private void ReInitRounds()
{
int i;
jjround = 0x80000001;
for (i = 109; i-- > 0;)
jjrounds[i] = 0x80000000;
}
/** Reinitialise parser. */
public void ReInit(JavaCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
}
/** Switch to specified lex state. */
public void SwitchTo(int lexState)
{
if (lexState >= 1 || lexState < 0)
throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
else
curLexState = lexState;
}
protected Token jjFillToken()
{
final Token t;
final String curTokenImage;
final int beginLine;
final int endLine;
final int beginColumn;
final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
curTokenImage = (im == null) ? input_stream.GetImage() : im;
beginLine = input_stream.getBeginLine();
beginColumn = input_stream.getBeginColumn();
endLine = input_stream.getEndLine();
endColumn = input_stream.getEndColumn();
t = Token.newToken(jjmatchedKind, curTokenImage);
t.beginLine = beginLine;
t.endLine = endLine;
t.beginColumn = beginColumn;
t.endColumn = endColumn;
return t;
}
int curLexState = 0;
int defaultLexState = 0;
int jjnewStateCnt;
int jjround;
int jjmatchedPos;
int jjmatchedKind;
/** Get the next Token. */
public Token getNextToken()
{
Token specialToken = null;
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(java.io.IOException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
matchedToken.specialToken = specialToken;
return matchedToken;
}
else
{
if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
if (specialToken == null)
specialToken = matchedToken;
else
{
matchedToken.specialToken = specialToken;
specialToken = (specialToken.next = matchedToken);
}
}
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (java.io.IOException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
}
private void jjCheckNAdd(int state)
{
if (jjrounds[state] != jjround)
{
jjstateSet[jjnewStateCnt++] = state;
jjrounds[state] = jjround;
}
}
private void jjAddStates(int start, int end)
{
do {
jjstateSet[jjnewStateCnt++] = jjnextStates[start];
} while (start++ != end);
}
private void jjCheckNAddTwoStates(int state1, int state2)
{
jjCheckNAdd(state1);
jjCheckNAdd(state2);
}
private void jjCheckNAddStates(int start, int end)
{
do {
jjCheckNAdd(jjnextStates[start]);
} while (start++ != end);
}
}
|
package comjuffreycalauod.gmail.httpswww.RODatabase;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
/**
* Created by Mr.Darkycible on 8/17/2017.
*/
public class OneHandedAxesRecyclerAdapter extends RecyclerView.Adapter<OneHandedAxesRecyclerAdapter.OneHandedAxesHolder>
{
Context context;
ArrayList<DataProvider> arrayList = new ArrayList<>();
public OneHandedAxesRecyclerAdapter (ArrayList<DataProvider> arrayList,Context context)
{
this.arrayList = arrayList;
this.context = context;
}
@Override
public OneHandedAxesHolder onCreateViewHolder (ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.onehandedaxes_layout,parent,false);
OneHandedAxesHolder oneHandedAxesHolder = new OneHandedAxesHolder(view);
return oneHandedAxesHolder;
}
@Override
public void onBindViewHolder(final OneHandedAxesHolder holder, int position) {
final DataProvider dataProvider = arrayList.get(position);
Glide.with(context).load(dataProvider.getImg_res()).into(holder.imageview);
holder.textview.setText(dataProvider.getText_res());
holder.textview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(),Onehandedaxes_details.class);
intent.putExtra("NAME",dataProvider.getText_res());
intent.putExtra("IMG",dataProvider.getImg_res());
intent.putExtra("POSITION",holder.getAdapterPosition());
v.getContext().startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return arrayList.size();
}
public static class OneHandedAxesHolder extends RecyclerView.ViewHolder
{
ImageView imageview;
TextView textview;
public OneHandedAxesHolder(View view)
{
super(view);
imageview = (ImageView) view.findViewById(R.id.axe_img);
textview = (TextView) view.findViewById(R.id.axe_text);
}
}
public void setFilter (ArrayList<DataProvider> searchList)
{
arrayList = new ArrayList<>();
arrayList.addAll(searchList);
notifyDataSetChanged();
}
}
|
/**
* This package contains helper classes for the {@link com.tiyb.tev.controller controller} package.
*/
package com.tiyb.tev.controller.helper;
|
/**
* Copyright note: Redistribution and use in source, with or without modification, are permitted.
*
* Created: March 2016;
*
* @author: Uwe Hahne SICK AG, Waldkirch email: techsupport0905@sick.de Last commit: $Date: 2015-01-21 13:56:28 +0100 (Mi,
* 21 Jan 2015) $ Last editor: $Author: hahneuw $
*
* Version "$Revision: 9661 $"
*
*/
package de.sick.svs.api.samples;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import de.sick.svs.api.AbstractDataListener;
import de.sick.svs.api.DataReceiverFactory;
import de.sick.svs.api.DeviceFactory;
import de.sick.svs.api.IData;
import de.sick.svs.api.IDataChannel;
import de.sick.svs.api.IDataReceiver;
import de.sick.svs.api.IDevice;
import de.sick.svs.api.ag.ICartesianData;
import de.sick.svs.api.ag.IDepthMapData;
import de.sick.svs.api.ag.IPolar2DData;
import de.sick.svs.api.geometry.IMatrix4f;
import de.sick.svs.api.geometry.IVector3f;
import de.sick.svs.api.internal.geometry.Vector3f;
/**
* Demonstrator class for data reception
*
*/
public class DataReceptionDemonstrator
{
/**
* This method demonstrates the data reception. It retrieves data frames for one second and prints out the distance of
* the center pixel.
*/
public static void receiveData(String ipAddress)
{
// Initialize data receiver
IDataReceiver dataReceiver = DataReceiverFactory.obtainDataReceiver(ipAddress);
// Initialize data listener (where the data processing should be done)
AbstractDataListener myDataListener = new AbstractDataListener()
{
/**
* This method is called by the data receiver after a new frame has been received and data has been extracted.
* Here, you should do whatever you want with the data. In this example the distance value of the center pixel
* is printed to the console.
*/
@Override
public void handleIncomingData(IData data)
{
System.out.println("New incoming data:\n");
if (data.getAvailableChannels().contains(IDataChannel.DEPTHMAP))
{
System.out.println("Data contains a depthmap:");
IDepthMapData dmData = data.getCopy().getDepthMapData();
// Extract distance map from the incoming data blob.
int[][] distanceMap = DataReceptionHelper.getDistanceMapFromData(dmData);
// and in the same way for confidence and intensity
int[][] intensityMap = DataReceptionHelper.getIntensityMapFromData(dmData);
int[][] confidenceMap = DataReceptionHelper.getConfidenceMapFromData(dmData);
// Print the distance value of the center pixel
int numCols = dmData.getCameraParameters().getNumberOfColumns();
int numRows = dmData.getCameraParameters().getNumberOfRows();
int midHorizontal = numCols / 2;
int midVertical = numRows / 2;
System.out.println("Center pixel is at a distance of " + distanceMap[midHorizontal][midVertical] +
" mm.");
System.out.println("and has a intensity of " + intensityMap[midHorizontal][midVertical]);
System.out.println("and a confidence of " + confidenceMap[midHorizontal][midVertical]);
System.out.println("Timestamp: " + dmData.getTimestamp());
System.out.println("Data quality is " + dmData.getDataQuality());
System.out.println("Device status is " + dmData.getStatus());
System.out.println(" --> End of depth map data.\n");
}
if (data.getAvailableChannels().contains(IDataChannel.POLAR2D))
{
System.out.println("Data contains polar scan data:");
IPolar2DData polarData = data.getPolar2DData();
float angleFirstScanPoint = polarData.getAngleOfFirstDataPoint();
float angularResolution = polarData.getAngularResolution();
int numScans = polarData.getFloatData().size();
System.out.println("Angle of first scan point = " + angleFirstScanPoint);
System.out.println("Angular resolution = " + angularResolution);
System.out.println("Number of scan points = " + numScans);
System.out.println("Incoming scan data:");
Iterator<Float> floatListIterator = polarData.getFloatData().iterator();
while (floatListIterator.hasNext())
{
System.out.print(floatListIterator.next() + ", ");
}
System.out.println(" --> data complete.");
// Comparison to Sopas parameters
float startAngle = angleFirstScanPoint - (angularResolution / 2);
float endAngle = angleFirstScanPoint + (angularResolution * (numScans - 0.5f));
System.out.println("Start angle (Sopas) = " + startAngle);
System.out.println("End angle (Sopas) = " + endAngle);
System.out.println("Number of sectors (Sopas) = " + numScans);
System.out.println(" --> End of polar scan data.\n");
}
if (data.getAvailableChannels().contains(IDataChannel.CARTESIAN))
{
System.out.println("Data contains Cartesian data:");
ICartesianData cartData = data.getCartesianData();
List<IVector3f> pointCloud = cartData.getPointCloud();
List<Float> confidenceValues = cartData.getConfidenceValues();
// assert that pointCloud and confidence valus have same amount
if (pointCloud.size() == confidenceValues.size())
{
System.out.println("Cartesian point cloud (with confidence values):");
for (int i = 0; i < pointCloud.size(); i++)
{
System.out.print(String.format("[%.2f, %.2f, %.2f] (%.2f), ",
pointCloud.get(i).x(),
pointCloud.get(i).y(),
pointCloud.get(i).z(),
confidenceValues.get(i)));
}
System.out.println("");
}
else
{
System.out.println("ERROR: pointCloud.size() != confidenceValues.size()");
}
}
}
@Override
public IData getData()
{
// Not needed in this example
return null;
}
@Override
public int getDataCount()
{
// Not needed in this example
return 0;
}
@Override
public void reset()
{
// Not needed in this example
}
};
// Add data listener to receiver
dataReceiver.addListener(myDataListener);
// Start data reception
dataReceiver.startListening();
// check if connection is established
if (!dataReceiver.isListening())
{
System.out.println("Failed to connect.");
return;
}
// wait for incoming data
try
{
Thread.sleep(2000L);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
// Stop data reception
dataReceiver.stopListening();
}
/**
* Demonstrates how to obtain data with connecting to the control channel of the device in order to change device
* settings.
*/
public static void receiveDataWithDeviceControl(String ipAddress, String filename)
{
// Initialize device
System.out.print("Init device...");
IDevice device = DeviceFactory.obtainDevice(ipAddress, filename);
System.out.println("done.");
System.out.print("Trying to connect...");
device.connect();
if (device.isConnected())
{
System.out.println("done.");
boolean imageAcquisitonWasStarted = false;
if (device.isImageAcquisitionStarted())
{
imageAcquisitonWasStarted = true;
System.out.println("Stopping image acquisition.");
device.stopImageAcquisition();
try
{
// wait until image acquisition is stopped.
Thread.sleep(1000L);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
// Initialize data receiver
IDataReceiver dataReceiver = DataReceiverFactory.obtainDataReceiver(ipAddress);
// Initialize data listener (where the data processing should be
// done)
AbstractDataListener myDataListener = new AbstractDataListener()
{
private int m_dataCount = 0;
private IData m_data = null;
/**
* This method is called by the data receiver after a new frame has been received and data has been
* extracted. The processing of the data should be done in this method.
*/
@Override
public void handleIncomingData(IData incomingData)
{
m_dataCount++;
m_data = incomingData;
}
@Override
public IData getData()
{
// Return last obtained data
return m_data;
}
@Override
public int getDataCount()
{
// Simply return data count
return m_dataCount;
}
@Override
public void reset()
{
// Reset data but not the counter
m_data = null;
m_dataCount = 0;
}
};
// Add data listener to receiver
dataReceiver.addListener(myDataListener);
IData myData = null;
// Acquiring frames via single step
dataReceiver.startListening(); // Start data reception
System.out.println("Single step acquisition");
device.triggerSingleImageAcquisition();
boolean dataReceived = false;
while (!dataReceived)
{
System.out.println("Checking if data is available.");
try
{
// waiting for the data to be transferred to the host.
Thread.sleep(50L);
// Note that usually 50 milliseconds is a good waiting time, but if some other system task (e.g.
// garbage collector) is interfering with the data receiver, it might take up to 1.5 seconds until the
// next frame is received.
}
catch (InterruptedException e)
{
e.printStackTrace();
}
myData = myDataListener.getData();
if (myData != null)
{
dataReceived = true;
}
}
myDataListener.reset(); // Reset frame counter
dataReceiver.stopListening(); // Stop data reception
if (myData.getAvailableChannels().contains(IDataChannel.DEPTHMAP))
{
IDepthMapData dmData = myData.getDepthMapData();
int[][] distanceMap = DataReceptionHelper.getDistanceMapFromData(dmData);
int[][] intensityMap = DataReceptionHelper.getIntensityMapFromData(dmData);
int[][] confidenceMap = DataReceptionHelper.getConfidenceMapFromData(dmData);
// save maps as .PNG file
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("hhmmsss");
DataReceptionHelper.saveMapToImage(distanceMap, String.format("distance_%s.png", sdf.format(now)), 0,
7500);
DataReceptionHelper.saveMapToImage(intensityMap, String.format("intensity_%s.png", sdf.format(now)), 0,
2 * Short.MAX_VALUE);
DataReceptionHelper.saveMapToImage(confidenceMap, String.format("confidence_%s.png", sdf.format(now)),
0,
2 * Short.MAX_VALUE);
double[][] pointCloudCam = DataReceptionHelper.getPointCloudFromDataInCameraSpace(dmData);
// Print the x,y and z values of the central data point
int numCols = dmData.getCameraParameters().getNumberOfColumns();
// compute the index of the point corresponding to the center pixel
float cX = dmData.getCameraParameters().getCenter().x();
float cY = dmData.getCameraParameters().getCenter().y();
int midIndex = (int) ((cY - 1) * numCols + cX);
System.out.println("Center data point is at XYZ = (" + pointCloudCam[0][midIndex] + ", " +
pointCloudCam[1][midIndex] + ", " + pointCloudCam[2][midIndex] + ")");
// Transform the point cloud from camera coordinates into world
// coordinates.
double[][] pointCloudWorld = new double[3][pointCloudCam[0].length];
// get camera to world transformation matrix
IMatrix4f cameraToWorldMatrix = dmData.getCameraParameters().getCameraToWorldMatrix();
for (int i = 0; i < pointCloudCam[0].length; i++)
{
// point coordinates in camera space
float xCam = (float) pointCloudCam[0][i];
float yCam = (float) pointCloudCam[1][i];
float zCam = (float) pointCloudCam[2][i];
// transform point into world space
IVector3f xyzWorld = cameraToWorldMatrix.transform(Vector3f.xyz(xCam, yCam, zCam));
pointCloudWorld[0][i] = xyzWorld.x();
pointCloudWorld[1][i] = xyzWorld.y();
pointCloudWorld[2][i] = xyzWorld.z();
}
// save point clouds as PCD file
DataReceptionHelper.savePointCloudAsPCDFile(pointCloudCam, "cloud_camera.pcd");
DataReceptionHelper.savePointCloudAsPCDFile(pointCloudWorld, "cloud_world.pcd");
}
// restart image acquisition if it was started in order to not
// change the device state
if (imageAcquisitonWasStarted)
{
device.startImageAcquisition();
}
// Disconnect device
device.disconnect();
}
else
{
System.out.println("Failed to connect.");
}
}
/**
* Checks if the connection can be established.
*/
public static boolean checkConnection(String ipAddress, String filename)
{
boolean result = false;
System.out.print("Init device...");
IDevice device = DeviceFactory.obtainDevice(ipAddress, filename);
System.out.println("done.");
System.out.print("Trying to connect...");
device.connect();
if (device.isConnected())
{
System.out.println("done.");
result = true;
// Disconnect device
device.disconnect();
}
else
{
System.out.println("Failed to connect.");
}
return result;
}
}
|
package com.geektcp.alpha.design.statemachine.state;
public interface StateListener {
/**
* preState --> postState 状态变化时触发的操作
*/
void stateChanged(String uuid, int preState, int postState);
}
|
package ADT.Graph.ShortestPath;
import ADT.Graph.EdgeWeightedDirected.DirectedEdge;
import ADT.Graph.EdgeWeightedDirected.EdgeWeightedDigraph;
import edu.princeton.cs.algs4.IndexMinPQ;
import edu.princeton.cs.algs4.Stack;
、、
public class DijkstraSP {
private DirectedEdge[] edgeTo;
private double[] distTo;
private IndexMinPQ<Double> pq;
public DijkstraSP(EdgeWeightedDigraph G, int s) {
edgeTo = new DirectedEdge[G.V()];
distTo = new double[G.V()];
pq = new IndexMinPQ<>(G.V());
for (int v = 0; v < G.V(); v++)
distTo[v] = Double.POSITIVE_INFINITY;
distTo[s] = 0;
pq.insert(s, 0.0);
while(!pq.isEmpty())
relax(G, pq.delMin());
}
private void relax(DirectedEdge e) {
int v = e.from(), w = e.to();
if (distTo[w] > distTo[v] + e.weight()) {
distTo[w] = distTo[v] + e.weight();
edgeTo[w] = e;
if(pq.contains(w)) pq.change(w, distTo[w]);
else pq.insert(w, distTo[w]);
}
}
private void relax(EdgeWeightedDigraph G, int v) {
for (DirectedEdge e : G.adj(v))
relax(e);
}
public double distTo(int v) {
return distTo[v];
}
public boolean hasPathTo(int v) {
return distTo[v] != Double.POSITIVE_INFINITY;
}
public Iterable<DirectedEdge> pathTo(int v) {
if (!hasPathTo(v)) return null;
Stack<DirectedEdge> path = new Stack<>();
for (DirectedEdge e = edgeTo[v]; e != null; e = edgeTo[e.from()])
path.push(e);
return path;
}
}
|
package org.spongycastle.crypto.engines;
import org.spongycastle.util.Pack;
/**
* Implementation of Daniel J. Bernstein's XSalsa20 stream cipher - Salsa20 with an extended nonce.
* <p>
* XSalsa20 requires a 256 bit key, and a 192 bit nonce.
*/
public class XSalsa20Engine extends Salsa20Engine
{
public String getAlgorithmName()
{
return "XSalsa20";
}
protected int getNonceSize()
{
return 24;
}
/**
* XSalsa20 key generation: process 256 bit input key and 128 bits of the input nonce
* using a core Salsa20 function without input addition to produce 256 bit working key
* and use that with the remaining 64 bits of nonce to initialize a standard Salsa20 engine state.
*/
protected void setKey(byte[] keyBytes, byte[] ivBytes)
{
if (keyBytes == null)
{
throw new IllegalArgumentException(getAlgorithmName() + " doesn't support re-init with null key");
}
if (keyBytes.length != 32)
{
throw new IllegalArgumentException(getAlgorithmName() + " requires a 256 bit key");
}
// Set key for HSalsa20
super.setKey(keyBytes, ivBytes);
// Pack next 64 bits of IV into engine state instead of counter
engineState[8] = Pack.littleEndianToInt(ivBytes, 8);
engineState[9] = Pack.littleEndianToInt(ivBytes, 12);
// Process engine state to generate Salsa20 key
int[] hsalsa20Out = new int[engineState.length];
salsaCore(20, engineState, hsalsa20Out);
// Set new key, removing addition in last round of salsaCore
engineState[1] = hsalsa20Out[0] - engineState[0];
engineState[2] = hsalsa20Out[5] - engineState[5];
engineState[3] = hsalsa20Out[10] - engineState[10];
engineState[4] = hsalsa20Out[15] - engineState[15];
engineState[11] = hsalsa20Out[6] - engineState[6];
engineState[12] = hsalsa20Out[7] - engineState[7];
engineState[13] = hsalsa20Out[8] - engineState[8];
engineState[14] = hsalsa20Out[9] - engineState[9];
// Last 64 bits of input IV
engineState[6] = Pack.littleEndianToInt(ivBytes, 16);
engineState[7] = Pack.littleEndianToInt(ivBytes, 20);
}
}
|
package cn.monitor.modules.common.interceptor;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.NamedThreadLocal;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import cn.monitor.core.utils.DateUtils;
import cn.monitor.modules.sys.utils.LogUtils;
/**
*
*
* @title: LogInterceptor.java
* @package cn.monitor.modules.common.interceptor
* @description: 访问日志拦截器
* @author: blue
* @date: 2017年7月11日 下午12:17:54
* @version V1.0
* @copyright: 2017 www.monitor.cn Inc. All rights reserved.
*
*/
public class LogInterceptor implements HandlerInterceptor {
private Boolean openAccessLog = Boolean.FALSE;
public void setOpenAccessLog(Boolean openAccessLog) {
this.openAccessLog = openAccessLog;
}
private static final ThreadLocal<Long> startTimeThreadLocal = new NamedThreadLocal<Long>("ThreadLocal StartTime");
/**
* 日志对象
*/
protected Logger logger = LoggerFactory.getLogger(getClass());
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
if (logger.isDebugEnabled()) {
long beginTime = System.currentTimeMillis();// 1、开始时间
startTimeThreadLocal.set(beginTime); // 线程绑定变量(该数据只有当前请求的线程可见)
logger.debug("开始计时: {} URI: {}", new SimpleDateFormat("hh:mm:ss.SSS").format(beginTime),
request.getRequestURI());
}
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
if (modelAndView != null) {
//logger.info("ViewName: " + modelAndView.getViewName());
}
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex)
throws Exception {
if (openAccessLog) {
// 保存日志
LogUtils.saveLog(request, handler, ex, null);
// 打印JVM信息。
if (logger.isDebugEnabled()) {
long beginTime = startTimeThreadLocal.get();// 得到线程绑定的局部变量(开始时间)
long endTime = System.currentTimeMillis(); // 2、结束时间
logger.debug("计时结束:{} 耗时:{} URI: {} 最大内存: {}m 已分配内存: {}m 已分配内存中的剩余空间: {}m 最大可用内存: {}m",
new SimpleDateFormat("hh:mm:ss.SSS").format(endTime),
DateUtils.formatDateTime(endTime - beginTime), request.getRequestURI(),
Runtime.getRuntime().maxMemory() / 1024 / 1024,
Runtime.getRuntime().totalMemory() / 1024 / 1024,
Runtime.getRuntime().freeMemory() / 1024 / 1024,
(Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory()
+ Runtime.getRuntime().freeMemory()) / 1024 / 1024);
}
}
}
}
|
/*
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.transaction.event;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.AliasFor;
/**
* An {@link EventListener} that is invoked according to a {@link TransactionPhase}.
* This is an annotation-based equivalent of {@link TransactionalApplicationListener}.
*
* <p>If the event is not published within an active transaction, the event is discarded
* unless the {@link #fallbackExecution} flag is explicitly set. If a transaction is
* running, the event is handled according to its {@code TransactionPhase}.
*
* <p>Adding {@link org.springframework.core.annotation.Order @Order} to your annotated
* method allows you to prioritize that listener amongst other listeners running before
* or after transaction completion.
*
* <p><b>NOTE: Transactional event listeners only work with thread-bound transactions
* managed by a {@link org.springframework.transaction.PlatformTransactionManager
* PlatformTransactionManager}.</b> A reactive transaction managed by a
* {@link org.springframework.transaction.ReactiveTransactionManager ReactiveTransactionManager}
* uses the Reactor context instead of thread-local variables, so from the perspective of
* an event listener, there is no compatible active transaction that it can participate in.
*
* <p><strong>WARNING:</strong> if the {@code TransactionPhase} is set to
* {@link TransactionPhase#AFTER_COMMIT AFTER_COMMIT} (the default),
* {@link TransactionPhase#AFTER_ROLLBACK AFTER_ROLLBACK}, or
* {@link TransactionPhase#AFTER_COMPLETION AFTER_COMPLETION}, the transaction will
* have been committed or rolled back already, but the transactional resources might
* still be active and accessible. As a consequence, any data access code triggered
* at this point will still "participate" in the original transaction, but changes
* will not be committed to the transactional resource. See
* {@link org.springframework.transaction.support.TransactionSynchronization#afterCompletion(int)
* TransactionSynchronization.afterCompletion(int)} for details.
*
* @author Stephane Nicoll
* @author Sam Brannen
* @author Oliver Drotbohm
* @since 4.2
* @see TransactionalApplicationListener
* @see TransactionalApplicationListenerMethodAdapter
*/
@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@EventListener
public @interface TransactionalEventListener {
/**
* Phase to bind the handling of an event to.
* <p>The default phase is {@link TransactionPhase#AFTER_COMMIT}.
* <p>If no transaction is in progress, the event is not processed at
* all unless {@link #fallbackExecution} has been enabled explicitly.
*/
TransactionPhase phase() default TransactionPhase.AFTER_COMMIT;
/**
* Whether the event should be handled if no transaction is running.
*/
boolean fallbackExecution() default false;
/**
* Alias for {@link #classes}.
*/
@AliasFor(annotation = EventListener.class, attribute = "classes")
Class<?>[] value() default {};
/**
* The event classes that this listener handles.
* <p>If this attribute is specified with a single value, the annotated
* method may optionally accept a single parameter. However, if this
* attribute is specified with multiple values, the annotated method
* must <em>not</em> declare any parameters.
*/
@AliasFor(annotation = EventListener.class, attribute = "classes")
Class<?>[] classes() default {};
/**
* Spring Expression Language (SpEL) attribute used for making the event
* handling conditional.
* <p>The default is {@code ""}, meaning the event is always handled.
* @see EventListener#condition
*/
@AliasFor(annotation = EventListener.class, attribute = "condition")
String condition() default "";
/**
* An optional identifier for the listener, defaulting to the fully-qualified
* signature of the declaring method (e.g. "mypackage.MyClass.myMethod()").
* @since 5.3
* @see EventListener#id
* @see TransactionalApplicationListener#getListenerId()
*/
@AliasFor(annotation = EventListener.class, attribute = "id")
String id() default "";
}
|
package CSharp.editor;
/*Generated by MPS */
import jetbrains.mps.nodeEditor.DefaultNodeEditor;
import jetbrains.mps.openapi.editor.cells.EditorCell;
import jetbrains.mps.openapi.editor.EditorContext;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.nodeEditor.cells.EditorCell_Collection;
import jetbrains.mps.lang.editor.cellProviders.SingleRoleCellProvider;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.openapi.editor.cells.DefaultSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.OldNewCompositeSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.DefaultChildSubstituteInfo;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
public class Event_declaration_block_1_1_2_Editor extends DefaultNodeEditor {
public EditorCell createEditorCell(EditorContext editorContext, SNode node) {
return this.createCollection_2yvurt_a(editorContext, node);
}
private EditorCell createCollection_2yvurt_a(EditorContext editorContext, SNode node) {
EditorCell_Collection editorCell = EditorCell_Collection.createIndent2(editorContext, node);
editorCell.setCellId("Collection_2yvurt_a");
editorCell.setBig(true);
editorCell.addEditorCell(this.createRefNode_2yvurt_a0(editorContext, node));
editorCell.addEditorCell(this.createConstant_2yvurt_b0(editorContext, node));
editorCell.addEditorCell(this.createRefNode_2yvurt_c0(editorContext, node));
editorCell.addEditorCell(this.createConstant_2yvurt_d0(editorContext, node));
return editorCell;
}
private EditorCell createRefNode_2yvurt_a0(EditorContext editorContext, SNode node) {
SingleRoleCellProvider provider = new Event_declaration_block_1_1_2_Editor.Member_name_1SingleRoleHandler_2yvurt_a0(node, MetaAdapterFactory.getContainmentLink(0x5f522167449a4486L, 0x94654f30de6e5cecL, 0x70aadf795f70b1L, 0x70aadf795f73d4L, "Member_name_1"), editorContext);
return provider.createCell();
}
private class Member_name_1SingleRoleHandler_2yvurt_a0 extends SingleRoleCellProvider {
public Member_name_1SingleRoleHandler_2yvurt_a0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(ownerNode, containmentLink, context);
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = super.createChildCell(child);
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new OldNewCompositeSubstituteInfo(myEditorContext, new SChildSubstituteInfo(editorCell, myOwnerNode, MetaAdapterFactory.getContainmentLink(0x5f522167449a4486L, 0x94654f30de6e5cecL, 0x70aadf795f70b1L, 0x70aadf795f73d4L, "Member_name_1"), child), new DefaultChildSubstituteInfo(myOwnerNode, myContainmentLink.getDeclarationNode(), myEditorContext)));
}
if (editorCell.getRole() == null) {
editorCell.setRole("Member_name_1");
}
}
@Override
protected EditorCell createEmptyCell() {
EditorCell editorCell = createEmptyCell_internal(myEditorContext, myOwnerNode);
installCellInfo(null, editorCell);
return editorCell;
}
private EditorCell createEmptyCell_internal(EditorContext editorContext, SNode node) {
return this.createConstant_2yvurt_a0a(editorContext, node);
}
private EditorCell createConstant_2yvurt_a0a(EditorContext editorContext, SNode node) {
EditorCell_Constant editorCell = new EditorCell_Constant(editorContext, node, " ");
editorCell.setCellId("Constant_2yvurt_a0a");
editorCell.setDefaultText("");
return editorCell;
}
}
private EditorCell createConstant_2yvurt_b0(EditorContext editorContext, SNode node) {
EditorCell_Constant editorCell = new EditorCell_Constant(editorContext, node, "{");
editorCell.setCellId("Constant_2yvurt_b0");
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createRefNode_2yvurt_c0(EditorContext editorContext, SNode node) {
SingleRoleCellProvider provider = new Event_declaration_block_1_1_2_Editor.Event_accessor_declarations_2SingleRoleHandler_2yvurt_c0(node, MetaAdapterFactory.getContainmentLink(0x5f522167449a4486L, 0x94654f30de6e5cecL, 0x70aadf795f70b1L, 0x70aadf795f73d5L, "Event_accessor_declarations_2"), editorContext);
return provider.createCell();
}
private class Event_accessor_declarations_2SingleRoleHandler_2yvurt_c0 extends SingleRoleCellProvider {
public Event_accessor_declarations_2SingleRoleHandler_2yvurt_c0(SNode ownerNode, SContainmentLink containmentLink, EditorContext context) {
super(ownerNode, containmentLink, context);
}
protected EditorCell createChildCell(SNode child) {
EditorCell editorCell = super.createChildCell(child);
installCellInfo(child, editorCell);
return editorCell;
}
private void installCellInfo(SNode child, EditorCell editorCell) {
if (editorCell.getSubstituteInfo() == null || editorCell.getSubstituteInfo() instanceof DefaultSubstituteInfo) {
editorCell.setSubstituteInfo(new OldNewCompositeSubstituteInfo(myEditorContext, new SChildSubstituteInfo(editorCell, myOwnerNode, MetaAdapterFactory.getContainmentLink(0x5f522167449a4486L, 0x94654f30de6e5cecL, 0x70aadf795f70b1L, 0x70aadf795f73d5L, "Event_accessor_declarations_2"), child), new DefaultChildSubstituteInfo(myOwnerNode, myContainmentLink.getDeclarationNode(), myEditorContext)));
}
if (editorCell.getRole() == null) {
editorCell.setRole("Event_accessor_declarations_2");
}
}
@Override
protected EditorCell createEmptyCell() {
EditorCell editorCell = createEmptyCell_internal(myEditorContext, myOwnerNode);
installCellInfo(null, editorCell);
return editorCell;
}
private EditorCell createEmptyCell_internal(EditorContext editorContext, SNode node) {
return this.createConstant_2yvurt_a2a(editorContext, node);
}
private EditorCell createConstant_2yvurt_a2a(EditorContext editorContext, SNode node) {
EditorCell_Constant editorCell = new EditorCell_Constant(editorContext, node, " ");
editorCell.setCellId("Constant_2yvurt_a2a");
editorCell.setDefaultText("");
return editorCell;
}
}
private EditorCell createConstant_2yvurt_d0(EditorContext editorContext, SNode node) {
EditorCell_Constant editorCell = new EditorCell_Constant(editorContext, node, "}");
editorCell.setCellId("Constant_2yvurt_d0");
editorCell.setDefaultText("");
return editorCell;
}
}
|
package seedu.address.logic.parser;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.parser.ParserUtil.MESSAGE_INVALID_INDEX;
import static seedu.address.model.transaction.Date.DATE_PATTERN;
import static seedu.address.testutil.Assert.assertThrows;
import static seedu.address.testutil.TypicalIndexes.INDEX_FIRST;
import java.time.LocalDate;
import java.time.Month;
import java.time.Year;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.junit.jupiter.api.Test;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Phone;
import seedu.address.model.tag.Tag;
import seedu.address.model.transaction.Amount;
import seedu.address.model.transaction.Date;
public class ParserUtilTest {
private static final String INVALID_NAME = "R@chel";
private static final String INVALID_PHONE = "+651234";
private static final String INVALID_EMAIL = "example.com";
private static final String INVALID_AMOUNT = "91a";
private static final String INVALID_TAG = "#friend";
private static final String INVALID_DATE_1 = "11 May 2019";
private static final String INVALID_DATE_2 = "11.11.2020";
private static final String INVALID_DATE_3 = "30/02/2020";
private static final String INVALID_DATE_4 = "2/2/2020";
private static final String INVALID_MONTH = "JANUARY";
private static final String INVALID_YEAR = "twenty twenty";
private static final String VALID_NAME = "Rachel Walker";
private static final String VALID_PHONE = "123456";
private static final String VALID_EMAIL = "rachel@example.com";
private static final String VALID_AMOUNT = "5";
private static final String VALID_TAG_1 = "friend";
private static final String VALID_TAG_2 = "neighbour";
private static final String VALID_DATE = "02/02/2020";
private static final String VALID_MONTH = "02";
private static final String VALID_YEAR = "2020";
private static final String WHITESPACE = " \t\r\n";
@Test
public void parseIndex_invalidInput_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseIndex("10 a"));
}
@Test
public void parseIndex_outOfRangeInput_throwsParseException() {
assertThrows(ParseException.class, MESSAGE_INVALID_INDEX, () ->
ParserUtil.parseIndex(Long.toString(Integer.MAX_VALUE + 1)));
}
@Test
public void parseIndex_validInput_success() throws Exception {
// No whitespaces
assertEquals(INDEX_FIRST, ParserUtil.parseIndex("1"));
// Leading and trailing whitespaces
assertEquals(INDEX_FIRST, ParserUtil.parseIndex(" 1 "));
}
@Test
public void parseName_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseName(null));
}
@Test
public void parseName_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseName(INVALID_NAME));
}
@Test
public void parseName_validValueWithoutWhitespace_returnsName() throws Exception {
Name expectedName = new Name(VALID_NAME);
assertEquals(expectedName, ParserUtil.parseName(VALID_NAME));
}
@Test
public void parseName_validValueWithWhitespace_returnsTrimmedName() throws Exception {
String nameWithWhitespace = WHITESPACE + VALID_NAME + WHITESPACE;
Name expectedName = new Name(VALID_NAME);
assertEquals(expectedName, ParserUtil.parseName(nameWithWhitespace));
}
@Test
public void parsePhone_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parsePhone(null));
}
@Test
public void parsePhone_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parsePhone(INVALID_PHONE));
}
@Test
public void parsePhone_validValueWithoutWhitespace_returnsPhone() throws Exception {
Phone expectedPhone = new Phone(VALID_PHONE);
assertEquals(expectedPhone, ParserUtil.parsePhone(VALID_PHONE));
}
@Test
public void parsePhone_validValueWithWhitespace_returnsTrimmedPhone() throws Exception {
String phoneWithWhitespace = WHITESPACE + VALID_PHONE + WHITESPACE;
Phone expectedPhone = new Phone(VALID_PHONE);
assertEquals(expectedPhone, ParserUtil.parsePhone(phoneWithWhitespace));
}
@Test
public void parseEmail_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseEmail(null));
}
@Test
public void parseEmail_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseEmail(INVALID_EMAIL));
}
@Test
public void parseEmail_validValueWithoutWhitespace_returnsEmail() throws Exception {
Email expectedEmail = new Email(VALID_EMAIL);
assertEquals(expectedEmail, ParserUtil.parseEmail(VALID_EMAIL));
}
@Test
public void parseEmail_validValueWithWhitespace_returnsTrimmedEmail() throws Exception {
String emailWithWhitespace = WHITESPACE + VALID_EMAIL + WHITESPACE;
Email expectedEmail = new Email(VALID_EMAIL);
assertEquals(expectedEmail, ParserUtil.parseEmail(emailWithWhitespace));
}
// @@author cheyannesim
@Test
public void parseAmount_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseAmount(null));
}
@Test
public void parseAmount_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseAmount(INVALID_AMOUNT));
}
@Test
public void parseAmount_validValueWithoutWhitespace_returnsAmount() throws Exception {
Amount expectedAmount = new Amount(Double.parseDouble(VALID_AMOUNT));
assertEquals(expectedAmount, ParserUtil.parseAmount(VALID_AMOUNT));
}
@Test
public void parseAmount_validValueWithWhitespace_returnsTrimmedAmount() throws Exception {
String amountWithWhitespace = WHITESPACE + VALID_AMOUNT + WHITESPACE;
Amount expectedAmount = new Amount(Double.parseDouble(VALID_AMOUNT));
assertEquals(expectedAmount, ParserUtil.parseAmount(amountWithWhitespace));
}
@Test
public void parseDate_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseDate(null));
}
// @@author
@Test
public void parseDate_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseDate(INVALID_DATE_1));
assertThrows(ParseException.class, () -> ParserUtil.parseDate(INVALID_DATE_2));
assertThrows(ParseException.class, () -> ParserUtil.parseDate(INVALID_DATE_3));
assertThrows(ParseException.class, () -> ParserUtil.parseDate(INVALID_DATE_4));
}
@Test
public void parseDate_validValueWithoutWhitespace_returnsDate() throws Exception {
Date date = new Date(LocalDate.parse(VALID_DATE, DateTimeFormatter.ofPattern(DATE_PATTERN)));
assertEquals(date, ParserUtil.parseDate(VALID_DATE));
}
@Test
public void parseDate_validValueWithWhitespace_returnsDate() throws Exception {
Date date = new Date(LocalDate.parse(VALID_DATE, DateTimeFormatter.ofPattern(DATE_PATTERN)));
assertEquals(date, ParserUtil.parseDate(WHITESPACE + VALID_DATE + WHITESPACE));
}
@Test
public void parseMonth_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseMonth(null));
}
@Test
public void parseMonth_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseMonth(INVALID_MONTH));
}
@Test
public void parseMonth_validValueWithoutWhitespace_returnsMonth() throws Exception {
Month month = Month.of(Integer.parseInt(VALID_MONTH));
assertEquals(month, ParserUtil.parseMonth(VALID_MONTH));
}
@Test
public void parseMonth_validValueWithWhitespace_returnsMonth() throws Exception {
Month month = Month.of(Integer.parseInt(VALID_MONTH));
assertEquals(month, ParserUtil.parseMonth(WHITESPACE + VALID_MONTH + WHITESPACE));
}
@Test
public void parseYear_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseYear(null));
}
@Test
public void parseYear_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseYear(INVALID_YEAR));
}
@Test
public void parseYear_validValueWithoutWhitespace_returnsMonth() throws Exception {
Year year = Year.of(Integer.parseInt(VALID_YEAR));
assertEquals(year, ParserUtil.parseYear(VALID_YEAR));
}
@Test
public void parseYear_validValueWithWhitespace_returnsMonth() throws Exception {
Year year = Year.of(Integer.parseInt(VALID_YEAR));
assertEquals(year, ParserUtil.parseYear(WHITESPACE + VALID_YEAR + WHITESPACE));
}
@Test
public void parseTag_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseTag(null));
}
@Test
public void parseTag_invalidValue_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseTag(INVALID_TAG));
}
@Test
public void parseTag_validValueWithoutWhitespace_returnsTag() throws Exception {
Tag expectedTag = new Tag(VALID_TAG_1);
assertEquals(expectedTag, ParserUtil.parseTag(VALID_TAG_1));
}
@Test
public void parseTag_validValueWithWhitespace_returnsTrimmedTag() throws Exception {
String tagWithWhitespace = WHITESPACE + VALID_TAG_1 + WHITESPACE;
Tag expectedTag = new Tag(VALID_TAG_1);
assertEquals(expectedTag, ParserUtil.parseTag(tagWithWhitespace));
}
@Test
public void parseTags_null_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> ParserUtil.parseTags(null));
}
@Test
public void parseTags_collectionWithInvalidTags_throwsParseException() {
assertThrows(ParseException.class, () -> ParserUtil.parseTags(Arrays.asList(VALID_TAG_1, INVALID_TAG)));
}
@Test
public void parseTags_emptyCollection_returnsEmptySet() throws Exception {
assertTrue(ParserUtil.parseTags(Collections.emptyList()).isEmpty());
}
@Test
public void parseTags_collectionWithValidTags_returnsTagSet() throws Exception {
Set<Tag> actualTagSet = ParserUtil.parseTags(Arrays.asList(VALID_TAG_1, VALID_TAG_2));
Set<Tag> expectedTagSet = new HashSet<Tag>(Arrays.asList(new Tag(VALID_TAG_1), new Tag(VALID_TAG_2)));
assertEquals(expectedTagSet, actualTagSet);
}
}
|
package org.apereo.cas.digest.config;
import lombok.extern.slf4j.Slf4j;
import org.apereo.cas.authentication.adaptive.AdaptiveAuthenticationPolicy;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.configuration.model.support.digest.DigestProperties;
import org.apereo.cas.digest.DefaultDigestHashedCredentialRetriever;
import org.apereo.cas.digest.DigestHashedCredentialRetriever;
import org.apereo.cas.digest.web.flow.DigestAuthenticationAction;
import org.apereo.cas.digest.web.flow.DigestAuthenticationWebflowConfigurer;
import org.apereo.cas.web.flow.CasWebflowConfigurer;
import org.apereo.cas.web.flow.CasWebflowExecutionPlan;
import org.apereo.cas.web.flow.CasWebflowExecutionPlanConfigurer;
import org.apereo.cas.web.flow.resolver.CasDelegatingWebflowEventResolver;
import org.apereo.cas.web.flow.resolver.CasWebflowEventResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.webflow.definition.registry.FlowDefinitionRegistry;
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
import org.springframework.webflow.execution.Action;
/**
* This is {@link DigestAuthenticationConfiguration}.
*
* @author Misagh Moayyed
* @since 5.0.0
*/
@Configuration("digestAuthenticationConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
@Slf4j
public class DigestAuthenticationConfiguration implements CasWebflowExecutionPlanConfigurer {
@Autowired
private CasConfigurationProperties casProperties;
@Autowired
@Qualifier("loginFlowRegistry")
private FlowDefinitionRegistry loginFlowDefinitionRegistry;
@Autowired
private FlowBuilderServices flowBuilderServices;
@Autowired
@Qualifier("adaptiveAuthenticationPolicy")
private AdaptiveAuthenticationPolicy adaptiveAuthenticationPolicy;
@Autowired
private ApplicationContext applicationContext;
@Autowired
@Qualifier("serviceTicketRequestWebflowEventResolver")
private CasWebflowEventResolver serviceTicketRequestWebflowEventResolver;
@Autowired
@Qualifier("initialAuthenticationAttemptWebflowEventResolver")
private CasDelegatingWebflowEventResolver initialAuthenticationAttemptWebflowEventResolver;
@ConditionalOnMissingBean(name = "digestAuthenticationWebflowConfigurer")
@Bean
@DependsOn("defaultWebflowConfigurer")
public CasWebflowConfigurer digestAuthenticationWebflowConfigurer() {
return new DigestAuthenticationWebflowConfigurer(flowBuilderServices, loginFlowDefinitionRegistry, applicationContext, casProperties);
}
@Autowired
@Bean
public Action digestAuthenticationAction(@Qualifier("defaultDigestCredentialRetriever")
final DigestHashedCredentialRetriever defaultDigestCredentialRetriever) {
return new DigestAuthenticationAction(initialAuthenticationAttemptWebflowEventResolver,
serviceTicketRequestWebflowEventResolver,
adaptiveAuthenticationPolicy,
casProperties.getAuthn().getDigest().getRealm(),
casProperties.getAuthn().getDigest().getAuthenticationMethod(),
defaultDigestCredentialRetriever);
}
@ConditionalOnMissingBean(name = "defaultDigestCredentialRetriever")
@Bean
@RefreshScope
public DigestHashedCredentialRetriever defaultDigestCredentialRetriever() {
final DigestProperties digest = casProperties.getAuthn().getDigest();
return new DefaultDigestHashedCredentialRetriever(digest.getUsers());
}
@Override
public void configureWebflowExecutionPlan(final CasWebflowExecutionPlan plan) {
plan.registerWebflowConfigurer(digestAuthenticationWebflowConfigurer());
}
}
|
package com.amazon.jenkins.ec2fleet;
import com.google.common.annotations.VisibleForTesting;
import hudson.Extension;
import hudson.model.Label;
import hudson.model.LoadStatistics;
import hudson.slaves.Cloud;
import hudson.slaves.NodeProvisioner;
import jenkins.model.Jenkins;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Implementation of {@link NodeProvisioner.Strategy} which will provision a new node immediately as
* a task enter the queue.
* Now that EC2 is billed by the minute, we don't really need to wait before provisioning a new node.
* <p>
* As based we are used
* <a href="https://github.com/jenkinsci/ec2-plugin/blob/master/src/main/java/hudson/plugins/ec2/NoDelayProvisionerStrategy.java">EC2 Jenkins Plugin</a>
*/
@Extension(ordinal = 100)
public class NoDelayProvisionStrategy extends NodeProvisioner.Strategy {
private static final Logger LOGGER = Logger.getLogger(NoDelayProvisionStrategy.class.getName());
@Override
public NodeProvisioner.StrategyDecision apply(final NodeProvisioner.StrategyState strategyState) {
final Label label = strategyState.getLabel();
final LoadStatistics.LoadStatisticsSnapshot snapshot = strategyState.getSnapshot();
final int availableCapacity =
snapshot.getAvailableExecutors() // live executors
+ snapshot.getConnectingExecutors() // executors present but not yet connected
+ strategyState.getPlannedCapacitySnapshot() // capacity added by previous strategies from previous rounds
+ strategyState.getAdditionalPlannedCapacity(); // capacity added by previous strategies _this round_
int currentDemand = snapshot.getQueueLength() - availableCapacity;
LOGGER.log(Level.INFO, "Available capacity={0}, currentDemand={1}",
new Object[]{availableCapacity, currentDemand});
for (final Cloud cloud : getClouds()) {
if (currentDemand < 1) break;
if (!(cloud instanceof EC2FleetCloud)) continue;
if (!cloud.canProvision(label)) continue;
final EC2FleetCloud ec2 = (EC2FleetCloud) cloud;
if (!ec2.isNoDelayProvision()) continue;
final Collection<NodeProvisioner.PlannedNode> plannedNodes = cloud.provision(label, currentDemand);
currentDemand -= plannedNodes.size();
LOGGER.log(Level.FINE, "Planned {0} new nodes", plannedNodes.size());
strategyState.recordPendingLaunches(plannedNodes);
LOGGER.log(Level.FINE, "After provisioning, available capacity={0}, currentDemand={1}",
new Object[]{availableCapacity, currentDemand});
}
if (currentDemand < 1) {
LOGGER.log(Level.FINE, "Provisioning completed");
return NodeProvisioner.StrategyDecision.PROVISIONING_COMPLETED;
} else {
LOGGER.log(Level.FINE, "Provisioning not complete, consulting remaining strategies");
return NodeProvisioner.StrategyDecision.CONSULT_REMAINING_STRATEGIES;
}
}
@VisibleForTesting
protected List<Cloud> getClouds() {
final Jenkins jenkins = Jenkins.getInstance();
return jenkins == null ? Collections.<Cloud>emptyList() : jenkins.clouds;
}
}
|
/*
* Created on May 27, 2007
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package biomight.chemistry.pharma.hypertensive;
import biomight.chemistry.compound.Compound;
/**
* @author SurferJim
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Clonidine extends Compound {
}
|
package blobs.models.behavors;
import blobs.interfaces.Blob;
public class Aggressive extends AbstractBehavior {
private static final int AGGRESSIVE_DAMAGE_MULTIPLY = 2;
private static final int AGGRESSIVE_DAMAGE_DECREMENT = 5;
private int sourceInitialDamage;
@Override
public void trigger(Blob blob) {
this.sourceInitialDamage = blob.getDamage();
super.setIsTriggered(true);
blob.setDamage(blob.getDamage() * AGGRESSIVE_DAMAGE_MULTIPLY);
}
@Override
public void applyRecurrentEffect(Blob blob) {
blob.setDamage(blob.getDamage() - AGGRESSIVE_DAMAGE_DECREMENT);
if (blob.getDamage() <= this.sourceInitialDamage) {
blob.setDamage(this.sourceInitialDamage);
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.