content
stringlengths 10
4.9M
|
---|
/* Helper: allocate a new escape_filter_ctx and fill in its escape char */
void *
client_new_escape_filter_ctx(int escape_char)
{
struct escape_filter_ctx *ret;
ret = xcalloc(1, sizeof(*ret));
ret->escape_pending = 0;
ret->escape_char = escape_char;
return (void *)ret;
}
|
import pytest
from great_expectations.datasource import (
PandasDatasource,
SparkDFDatasource,
SqlAlchemyDatasource,
)
@pytest.fixture(scope="module")
def basic_pandas_datasource():
return PandasDatasource("basic_pandas_datasource")
@pytest.fixture
def postgresql_sqlalchemy_datasource(postgresql_engine):
return SqlAlchemyDatasource(
"postgresql_sqlalchemy_datasource", engine=postgresql_engine
)
@pytest.fixture(scope="module")
def basic_sparkdf_datasource(test_backends):
if "SparkDFDataset" not in test_backends:
pytest.skip("Spark has not been enabled, so this test must be skipped.")
return SparkDFDatasource("basic_sparkdf_datasource")
|
<gh_stars>1-10
package com.eu.habbo.habbohotel.items.interactions.wired.effects;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.games.Game;
import com.eu.habbo.habbohotel.games.GameTeam;
import com.eu.habbo.habbohotel.games.GameTeamColors;
import com.eu.habbo.habbohotel.items.Item;
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
import com.eu.habbo.habbohotel.rooms.Room;
import com.eu.habbo.habbohotel.rooms.RoomUnit;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.wired.WiredEffectType;
import com.eu.habbo.messages.ClientMessage;
import com.eu.habbo.messages.ServerMessage;
import gnu.trove.map.hash.TIntIntHashMap;
import java.sql.ResultSet;
import java.sql.SQLException;
public class WiredEffectGiveScoreToTeam extends InteractionWiredEffect
{
public static final WiredEffectType type = WiredEffectType.GIVE_SCORE_TEAM;
private int points;
private int count;
private GameTeamColors teamColor = GameTeamColors.RED;
private TIntIntHashMap startTimes = new TIntIntHashMap();
public WiredEffectGiveScoreToTeam(int id, int userId, Item item, String extradata, int limitedStack, int limitedSells)
{
super(id, userId, item, extradata, limitedStack, limitedSells);
}
public WiredEffectGiveScoreToTeam(ResultSet set, Item baseItem) throws SQLException
{
super(set, baseItem);
}
@Override
public boolean execute(RoomUnit roomUnit, Room room, Object[] stuff)
{
Habbo habbo = room.getHabbo(roomUnit);
if(habbo != null)
{
Class<? extends Game> game = habbo.getHabboInfo().getCurrentGame();
if(game != null)
{
Game g = room.getGame(game);
if(g != null)
{
int c = this.startTimes.get(g.getStartTime());
if(c < this.count)
{
GameTeam team = g.getTeam(this.teamColor);
if(team != null)
{
team.addTeamScore(this.points);
this.startTimes.put(g.getStartTime(), c++);
return true;
}
}
}
}
}
return false;
}
@Override
public String getWiredData()
{
return this.points + ";" + this.count + ";" + this.teamColor.type + ";" + this.getDelay();
}
@Override
public void loadWiredData(ResultSet set, Room room) throws SQLException
{
String[] data = set.getString("wired_data").split(";");
if(data.length == 4)
{
this.points = Integer.valueOf(data[0]);
this.count = Integer.valueOf(data[1]);
this.teamColor = GameTeamColors.values()[Integer.valueOf(data[2])];
this.setDelay(Integer.valueOf(data[3]));
}
}
@Override
public void onPickUp()
{
this.startTimes.clear();
this.points = 0;
this.count = 0;
this.teamColor = GameTeamColors.RED;
this.setDelay(0);
}
@Override
public WiredEffectType getType()
{
return type;
}
@Override
public void serializeWiredData(ServerMessage message, Room room)
{
message.appendBoolean(false);
message.appendInt(5);
message.appendInt(0);
message.appendInt(this.getBaseItem().getSpriteId());
message.appendInt(this.getId());
message.appendString("");
message.appendInt(3);
message.appendInt(this.points);
message.appendInt(this.count);
message.appendInt(this.teamColor.type + 1);
message.appendInt(0);
message.appendInt(this.getType().code);
message.appendInt(this.getDelay());
message.appendInt(0);
}
@Override
public boolean saveData(ClientMessage packet, GameClient gameClient)
{
packet.readInt();
this.points = packet.readInt();
this.count = packet.readInt();
this.teamColor = GameTeamColors.values()[packet.readInt() - 1];
packet.readString();
packet.readInt();
this.setDelay(packet.readInt());
return true;
}
}
|
def creat_xs_fc(outpath, outname, spatial_ref, is_shp=True):
shp = None
if not is_shp:
shp = os.path.join (outpath , '{0}.shp'.format (outname))
if arcpy.Exists(shp):
arcpy.Delete_management(shp)
arcpy.CreateFeatureclass_management (outpath , '{0}.shp'.format (outname) , geometry_type="POLYLINE" ,
has_m="DISABLED" ,
has_z="DISABLED" , spatial_reference=spatial_ref)
else:
shp = os.path.join (outpath , '{0}'.format (outname))
if arcpy.Exists(shp):
arcpy.Delete_management(shp)
arcpy.CreateFeatureclass_management (outpath , '{0}'.format (outname) , geometry_type="POLYLINE" ,
has_m="DISABLED" ,
has_z="DISABLED" , spatial_reference=spatial_ref)
arcpy.AddField_management (shp , field_name="Tributary" , field_alias="Tributary" , field_type="TEXT" ,
field_length=25 , )
arcpy.AddField_management (shp , field_name="Station" , field_alias="Station" , field_type="TEXT" ,
field_length=25 , )
return shp
|
Shieldmaidens are not a myth! A recent archaeological discovery has shattered the stereotype of exclusively male Viking warriors sailing out to war while their long-suffering wives wait at home with baby Vikings. (We knew it! We always knew it.) Plus, some other findings are challenging that whole “rape and pillage” thing, too. (Updated 9/3, see below.)
Researchers at the University of Western Australia decided to revamp the way they studied Viking remains. Previously, researchers had misidentified skeletons as male simply because they were buried with their swords and shields. (Female remains were identified by their oval brooches, and not much else.) By studying osteological signs of gender within the bones themselves, researchers discovered that approximately half of the remains were actually female warriors, given a proper burial with their weapons.
It’s been so difficult for people to envision women’s historical contributions as solely getting married and dying in childbirth, but you can’t argue with numbers—and fifty/fifty is pretty damn good. The presence of female warriors also has researchers now wondering just how accurate the stereotypes of raping and pillaging actually are:
Women may have accompanied male Vikings in those early invasions of England, in much greater numbers than scholars earlier supposed, (Researcher) McLeod concludes. Rather than the ravaging rovers of legend, the Vikings arrived as marriage-minded colonists.
In many ways, this discovery is well-timed with the recent uproar over Thor becoming a title for both sexes instead of an exclusively male name. Fingers crossed this means that pop culture could start including more female warriors than just Sif and Lagertha (from The History Channel’s Vikings, above). Just so long as they’re not wearing boob plate armor.
Because, as we’re always re-learning, women have always fought.
UPDATE: Commenter Andrew W. gives a wonderfully precise and informative look at the findings in this comment below, adding some context to the idea of female Viking warriors.
[USA Today via Jezebel]
Photo: The History Channel
|
<reponame>kocircuit/kocircuit
//
// Copyright © 2018 Aljabr, 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 os
import (
"os"
go_eval "github.com/kocircuit/kocircuit/lang/go/eval"
"github.com/kocircuit/kocircuit/lang/go/runtime"
)
func init() {
go_eval.RegisterNamedEvalGate("Mkdir", new(goMkdir))
go_eval.RegisterNamedEvalGate("Env", new(goEnv))
go_eval.RegisterNamedEvalGate("TempDir", new(goTempDir))
go_eval.RegisterNamedEvalGate("Exit", new(goExit))
}
type goMkdir struct {
Path string `ko:"name=path,monadic"`
}
func (mkdir *goMkdir) Play(ctx *runtime.Context) error {
return os.MkdirAll(mkdir.Path, 0755)
}
func (*goMkdir) Doc() string { return "Mkdir(path?) creates the given directory and all its parents" }
func (*goMkdir) Help() string { return "Mkdir(path?)" }
type goEnv struct {
Name string `ko:"name=name,monadic"`
}
func (env *goEnv) Play(ctx *runtime.Context) string {
return os.Getenv(env.Name)
}
func (*goEnv) Doc() string {
return "Env(name?) returns the value of the environment variable with given name"
}
func (*goEnv) Help() string { return "Env(name?)" }
type goTempDir struct{}
func (goTempDir) Play(ctx *runtime.Context) string {
return os.TempDir()
}
func (*goTempDir) Doc() string { return "TempDir() returns the full path of the temporary directory" }
func (*goTempDir) Help() string { return "TempDir()" }
type goExit struct {
ExitCode int `ko:"name=code,monadic"`
}
func (g *goExit) Play(ctx *runtime.Context) error {
os.Exit(g.ExitCode)
return nil
}
func (*goExit) Doc() string { return "Exit(code?) terminates the process with given exit code" }
func (*goExit) Help() string { return "Exit(code?)" }
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.divudi.bean.hr;
import com.divudi.bean.common.CommonController;
import com.divudi.bean.common.SessionController;
import com.divudi.bean.common.UtilityController;
import com.divudi.data.SystemTimeStamp;
import com.divudi.data.hr.DayType;
import com.divudi.data.hr.ReportKeyWord;
import com.divudi.data.hr.Times;
import com.divudi.ejb.HumanResourceBean;
import com.divudi.entity.Department;
import com.divudi.entity.Staff;
import com.divudi.entity.hr.AdditionalForm;
import com.divudi.entity.hr.HrForm;
import com.divudi.entity.hr.Roster;
import com.divudi.entity.hr.SalaryCycle;
import com.divudi.entity.hr.Shift;
import com.divudi.entity.hr.StaffSalary;
import com.divudi.entity.hr.StaffShift;
import com.divudi.entity.hr.StaffShiftExtra;
import com.divudi.facade.AdditionalFormFacade;
import com.divudi.facade.HrFormFacade;
import com.divudi.facade.SalaryCycleFacade;
import com.divudi.facade.ShiftFacade;
import com.divudi.facade.StaffShiftFacade;
import com.divudi.facade.util.JsfUtil;
import com.divudi.java.CommonFunctions;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.TemporalType;
/**
*
* @author Sniper 619
*/
@Named(value = "staffAdditionalFormController")
@SessionScoped
public class StaffAdditionalFormController implements Serializable {
private AdditionalForm currentAdditionalForm;
@EJB
private AdditionalFormFacade additionalFormFacade;
@Inject
private SessionController sessionController;
@Inject
CommonController commonController;
Date date;
List<StaffShift> staffShifts;
List<AditionalWithTime> aditionalWithTimes;
@EJB
StaffShiftFacade staffShiftFacade;
@EJB
SalaryCycleFacade salaryCycleFacade;
@EJB
HumanResourceBean humanResourceBean;
SystemTimeStamp fromSystemTimeStamp;
SystemTimeStamp toSystemTimeStamp;
List<AdditionalForm> additionalForms;
Department department;
Staff staff;
Staff approvedStaff;
Date fromDate;
Date toDate;
double totalInTime;
double totalOutTime;
double totalAllTime;
public void timeSelectListener() {
if (getCurrentAdditionalForm().getStaffShift() == null) {
return;
}
Times times = getCurrentAdditionalForm().getTimes();
if (times == null) {
return;
}
if (times == Times.inTime && getCurrentAdditionalForm().getStaffShift().getShiftStartTime() != null) {
getCurrentAdditionalForm().setToTime(getCurrentAdditionalForm().getStaffShift().getShiftStartTime());
getToSystemTimeStamp().processTime(getCurrentAdditionalForm().getToTime());
return;
}
if (times == Times.outTime && getCurrentAdditionalForm().getStaffShift().getShiftEndTime() != null) {
getCurrentAdditionalForm().setFromTime(getCurrentAdditionalForm().getStaffShift().getShiftEndTime());
getFromSystemTimeStamp().processTime(getCurrentAdditionalForm().getFromTime());
// return;
}
}
public void timeEnterListenerFrom() {
// System.err.println("Starting From ");
getCurrentAdditionalForm().setFromTime(getFromSystemTimeStamp().getTime());
// System.err.println("Ending From ");
}
public void timeEnterListenerTo() {
getCurrentAdditionalForm().setToTime(getToSystemTimeStamp().getTime());
}
public void timeSelectListenerFrom() {
// System.err.println("Starting Select From ");
getFromSystemTimeStamp().processTime(getCurrentAdditionalForm().getFromTime());
// System.err.println("Ending Select From ");
}
public void timeSelectListenerTo() {
// System.err.println("Starting Select To ");
getToSystemTimeStamp().processTime(getCurrentAdditionalForm().getToTime());
// System.err.println("Ending Select To ");
}
public boolean errorCheckAdditionalForm() {
if (getCurrentAdditionalForm() == null) {
JsfUtil.addErrorMessage("Nothing to Delete");
return true;
}
if (getCurrentAdditionalForm().getRetireComments() == null) {
JsfUtil.addErrorMessage("Nothing to Delete");
return true;
}
if (getCurrentAdditionalForm().getStaffShift() == null) {
JsfUtil.addErrorMessage("Nothing to Delete");
return true;
}
return false;
}
public void onDateSelect() {
getCurrentAdditionalForm().setFromTime(date);
getCurrentAdditionalForm().setToTime(date);
getFromSystemTimeStamp().processTime(date);
getToSystemTimeStamp().processTime(date);
}
public void deleteAdditionalForm() {
if (getCurrentAdditionalForm() != null) {
if (getCurrentAdditionalForm().getStaffShift() != null) {
getCurrentAdditionalForm().getStaffShift().resetExtraTime();
if (getCurrentAdditionalForm().getStaffShift() instanceof StaffShiftExtra) {
getCurrentAdditionalForm().getStaffShift().setRetired(true);
getCurrentAdditionalForm().getStaffShift().setRetirer(sessionController.getLoggedUser());
}
if (getCurrentAdditionalForm().getStaffShift().getReferenceStaffShift() != null) {
getCurrentAdditionalForm().getStaffShift().getReferenceStaffShift().setRetired(false);
staffShiftFacade.edit(getCurrentAdditionalForm().getStaffShift().getReferenceStaffShift());
}
staffShiftFacade.edit(getCurrentAdditionalForm().getStaffShift());
}
currentAdditionalForm.setRetired(true);
currentAdditionalForm.setRetirer(getSessionController().getLoggedUser());
currentAdditionalForm.setRetiredAt(new Date());
getAdditionalFormFacade().edit(currentAdditionalForm);
JsfUtil.addSuccessMessage("Sucessfuly Deleted.");
clear();
} else {
JsfUtil.addErrorMessage("Nothing to Delete");
}
}
public List<StaffShift> fetchStaffShiftWithShiftAdditional(Date d, Staff staff) {
// List<StaffShift> tmp=new ArrayList<>();
String sql;
HashMap hm = new HashMap();
sql = "select st From StaffShift st "
+ " where st.retired=false "
+ " and st.additionalForm is not null"
+ " and st.shiftDate=:dt "
+ " and st.staff=:rs"
+ " and st.shift is not null"
+ " order by st.staff.codeInterger";
hm.put("dt", d);
hm.put("rs", staff);
List<StaffShift> tmp = getStaffShiftFacade().findBySQLWithoutCache(sql, hm, TemporalType.DATE);
// System.err.println("fetchStaffShiftWithShift:: " + tmp);
return tmp;
}
ReportKeyWord reportKeyWord;
public ReportKeyWord getReportKeyWord() {
if (reportKeyWord == null) {
reportKeyWord = new ReportKeyWord();
}
return reportKeyWord;
}
public void setReportKeyWord(ReportKeyWord reportKeyWord) {
this.reportKeyWord = reportKeyWord;
}
public String createKeyWord(Map m) {
String sql = "";
if (getReportKeyWord().getInstitution() != null) {
sql += " and a.staffShift.staff.workingDepartment.institution=:ins ";
m.put("ins", getReportKeyWord().getInstitution());
}
if (getReportKeyWord().getDepartment() != null) {
sql += " and a.staffShift.staff.workingDepartment=:dept ";
m.put("dept", getReportKeyWord().getDepartment());
}
if (getReportKeyWord().getTimes() != null) {
sql += " and a.times=:t ";
m.put("t", getReportKeyWord().getTimes());
}
if (getReportKeyWord().getDayTypes() != null && !Arrays.asList(getReportKeyWord().getDayTypes()).isEmpty()) {
sql += " and a.staffShift.dayType in :dtp ";
m.put("dtp", Arrays.asList(getReportKeyWord().getDayTypes()));
}
if (getReportKeyWord().getStaff() != null) {
sql += " and a.staffShift.staff=:st ";
m.put("st", getReportKeyWord().getStaff());
}
if (getReportKeyWord().getStaffCategory() != null) {
sql += " and a.staffShift.staff.staffCategory=:stCat ";
m.put("stCat", getReportKeyWord().getStaffCategory());
}
if (getReportKeyWord().getDesignation() != null) {
sql += " and a.staffShift.staff.designation=:des ";
m.put("des", getReportKeyWord().getDesignation());
}
if (getReportKeyWord().getRoster() != null) {
sql += " and a.staffShift.roster=:rs ";
m.put("rs", getReportKeyWord().getRoster());
}
return sql;
}
public void searchByCreatedDate() {
Date startTime = new Date();
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where"
+ " a.retired=false "
+ " and a.createdAt between :fd and :td ";
// + " and a.times=:tm ";
m.put("fd", fromDate);
m.put("td", toDate);
// m.put("tm", Times.All);
sql += createKeyWord(m);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
// calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Additional form report vertification(/faces/hr/hr_form_staff_additional_report.xhtml)");
}
public void calTotals(List<AdditionalForm> list) {
for (AdditionalForm a : list) {
totalInTime = 0.0;
totalOutTime = 0.0;
totalAllTime = 0.0;
if (!(a.getTimes() == Times.All && (a.getStaffShift().getDayType() == DayType.Poya || a.getStaffShift().getDayType() == DayType.DayOff || a.getStaffShift().getDayType() == DayType.MurchantileHoliday))) {
// totalInTime+=;
// totalOutTime+=;
// totalAllTime+=;
}
}
}
List<HrForm> hrForms;
@EJB
HrFormFacade hrFormFacade;
public void searchFormByCreatedDate() {
Date startTime = new Date();
String sql = "";
Map m = new HashMap();
sql = " select a from HrForm a where "
+ " a.createdAt between :fd and :td"
+ " and ( a.staffShift.startRecord is null "
+ " or a.staffShift.endRecord is null "
+ " or a.staffShift.startRecord.recordTimeStamp is null "
+ " or a.staffShift.endRecord.recordTimeStamp is null ) ";
// + " and a.times=:tm ";
m.put("fd", fromDate);
m.put("td", toDate);
// m.put("tm", Times.All);
sql += createKeyWord(m);
hrForms = hrFormFacade.findBySQL(sql, m, TemporalType.TIMESTAMP);
// calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Form report that not comes toanalys(/faces/hr/hr_form_staff_form_report.xhtml)");
}
// public void searchFormByApprovedDate() {
// String sql = "";
// Map m = new HashMap();
//
// sql = " select a from HrForm a where "
// + " a.approvedDate between :fd and :td"
// + " and (a.staffShift.startRecord.recordTimeStamp is null or"
// + " a.staffShift.endRecord.recordTimeStamp is null ) ";
//// + " and a.times=:tm ";
// m.put("fd", fromDate);
// m.put("td", toDate);
//// m.put("tm", Times.All);
// sql += createKeyWord(m);
//
// System.err.println("SQL " + sql);
// hrForms = hrFormFacade.findBySQL(sql, m, TemporalType.TIMESTAMP);
//
//// calMinitsAditional(additionalForms);
// }
public void searchFormByShiftDate() {
Date startTime = new Date();
String sql = "";
Map m = new HashMap();
sql = " select a from HrForm a where "
+ " a.staffShift.shiftDate between :fd and :td"
+ " and (a.staffShift.startRecord.recordTimeStamp is null or"
+ " a.staffShift.endRecord.recordTimeStamp is null ) ";
// + " and a.times=:tm ";
m.put("fd", fromDate);
m.put("td", toDate);
// m.put("tm", Times.All);
sql += createKeyWord(m);
hrForms = hrFormFacade.findBySQL(sql, m, TemporalType.TIMESTAMP);
// calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Form report that not comes toanalys(/faces/hr/hr_form_staff_form_report.xhtml)");
}
public List<HrForm> getHrForms() {
return hrForms;
}
public void setHrForms(List<HrForm> hrForms) {
this.hrForms = hrForms;
}
public void searchByShiftDate() {
Date startTime = new Date();
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.retired=false "
+ " and a.staffShift.shiftDate between :fd and :td ";
// + " and a.times=:tm ";
m.put("fd", fromDate);
m.put("td", toDate);
// m.put("tm", Times.All);
sql += createKeyWord(m);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
// calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Additional form report vertification(/faces/hr/hr_form_staff_additional_report.xhtml)");
}
public void searchByApproveDate() {
Date startTime = new Date();
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.retired=false "
+ " and a.approvedDate between :fd and :td ";
// + " and a.times=:tm ";
m.put("fd", fromDate);
m.put("td", toDate);
// m.put("tm", Times.All);
sql += createKeyWord(m);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
// calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Additional form report vertification(/faces/hr/hr_form_staff_additional_report.xhtml)");
}
public void createAmmendmentTable() {
Date startTime = new Date();
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.createdAt between :fd and :td";
// + " and a.times=:tm ";
// m.put("tm", Times.All);
if (department != null) {
sql += " and a.department=:dept ";
m.put("dept", department);
}
if (staff != null) {
sql += " and a.staff=:st ";
m.put("st", staff);
}
if (approvedStaff != null) {
sql += " and a.approvedStaff=:app ";
m.put("app", approvedStaff);
}
m.put("fd", fromDate);
m.put("td", toDate);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Additional form report(/faces/hr/hr_form_staff_additional_report_1.xhtml)");
}
public void calMinitsAditional(List<AdditionalForm> additionalForms) {
aditionalWithTimes = new ArrayList<>();
for (AdditionalForm a : additionalForms) {
AditionalWithTime awt = new AditionalWithTime();
if (a.getFromTime() != null && a.getToTime() != null) {
Calendar frmCal = Calendar.getInstance();
frmCal.setTime(a.getFromTime());
//System.out.println("frmCal = " + frmCal);
Calendar toCal = Calendar.getInstance();
frmCal.setTime(a.getToTime());
//System.out.println("toCal = " + toCal);
//System.out.println("toCal.getTimeInMillis() = " + toCal.getTimeInMillis());
//System.out.println("frmCal.getTimeInMillis() = " + frmCal.getTimeInMillis());
//System.out.println("toCal.getTimeInMillis()-frmCal.getTimeInMillis() = " + (toCal.getTimeInMillis() - frmCal.getTimeInMillis()));
long time = ((toCal.getTime().getTime() - frmCal.getTime().getTime()) / (1000 * 60));
awt.setAf(a);
awt.setTime(time);
//System.out.println("awt.getAf() = " + awt.getAf());
//System.out.println("awt.getTime() = " + awt.getTime());
aditionalWithTimes.add(awt);
}
}
}
public void update(HrForm hrForm) {
hrFormFacade.edit(hrForm);
}
public void createAmmendmentTableApprovedDate() {
Date startTime = new Date();
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.approvedAt between :fd and :td ";
if (department != null) {
sql += " and a.department=:dept ";
m.put("dept", department);
}
if (staff != null) {
sql += " and a.staff=:st ";
m.put("st", staff);
}
if (approvedStaff != null) {
sql += " and a.approvedStaff=:app ";
m.put("app", approvedStaff);
}
m.put("fd", fromDate);
m.put("td", toDate);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Additional form report(Search Approved Date)(/faces/hr/hr_form_staff_additional_report_1.xhtml)");
}
public void createAmmendmentTableShiftDate() {
Date startTime = new Date();
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.staffShift.shiftDate between :fd and :td ";
if (department != null) {
sql += " and a.department=:dept ";
m.put("dept", department);
}
if (staff != null) {
sql += " and a.staff=:st ";
m.put("st", staff);
}
if (approvedStaff != null) {
sql += " and a.approvedStaff=:app ";
m.put("app", approvedStaff);
}
m.put("fd", fromDate);
m.put("td", toDate);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
calMinitsAditional(additionalForms);
commonController.printReportDetails(fromDate, toDate, startTime, "HR/Reports/Forms/Additional form report(Search Shift Date)(/faces/hr/hr_form_staff_additional_report_1.xhtml)");
}
public void createAmmendmentTableShiftDateExtraShift() {
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.staffShift.shiftDate between :fd and :td "
+ " and a.times!=:tm";
m.put("tm", Times.All);
if (department != null) {
sql += " and a.department=:dept ";
m.put("dept", department);
}
if (staff != null) {
sql += " and a.staff=:st ";
m.put("st", staff);
}
if (approvedStaff != null) {
sql += " and a.approvedStaff=:app ";
m.put("app", approvedStaff);
}
m.put("fd", fromDate);
m.put("td", toDate);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.TIMESTAMP);
}
public void createAmmendmentTableShiftDateAdditionalShift() {
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.staffShift.shiftDate between :fd and :td "
+ " and a.times=:tm"
+ " and a.staffShift.shift.dayType=:dtp";
m.put("dtp", DayType.Extra);
m.put("tm", Times.All);
if (department != null) {
sql += " and a.department=:dept ";
m.put("dept", department);
}
if (staff != null) {
sql += " and a.staff=:st ";
m.put("st", staff);
}
if (approvedStaff != null) {
sql += " and a.approvedStaff=:app ";
m.put("app", approvedStaff);
}
m.put("fd", fromDate);
m.put("td", toDate);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.DATE);
}
public void createAmmendmentTableShiftDateAdditionalShiftDayOff() {
String sql;
Map m = new HashMap();
sql = " select a from AdditionalForm a where "
+ " a.staffShift.shiftDate between :fd and :td "
+ " and a.times=:tm "
+ " and a.staffShift.shift.dayType!=:dtp";
m.put("dtp", DayType.Extra);
m.put("tm", Times.All);
if (department != null) {
sql += " and a.department=:dept ";
m.put("dept", department);
}
if (staff != null) {
sql += " and a.staff=:st ";
m.put("st", staff);
}
if (approvedStaff != null) {
sql += " and a.approvedStaff=:app ";
m.put("app", approvedStaff);
}
m.put("fd", fromDate);
m.put("td", toDate);
additionalForms = getAdditionalFormFacade().findBySQL(sql, m, TemporalType.DATE);
}
public void viewAdditionalForm(AdditionalForm additionalForm) {
date = additionalForm.getFromTime();
fetchStaffShift(date, additionalForm.getStaff());
currentAdditionalForm = additionalForm;
// shift = currentAdditionalForm.getStaffShift().getShift();
}
public void fetchStaffShift() {
HashMap hm = new HashMap();
String sql = "select c from "
+ " StaffShift c"
+ " where c.retired=false "
+ " and type(c)!=:cl "
+ " and c.shift is not null "
// + " and c.shift.dayType!=:dtp1 "
// + " and c.shift.dayType!=:dtp2 "
+ " and c.shiftDate =:dt "
+ " and c.staff=:stf ";
// hm.put("dtp1", DayType.DayOff);
// hm.put("dtp2", DayType.SleepingDay);
hm.put("cl", StaffShiftExtra.class);
hm.put("dt", getDate());
hm.put("stf", getCurrentAdditionalForm().getStaff());
staffShifts = staffShiftFacade.findBySQL(sql, hm, TemporalType.DATE);
hm.clear();
sql = "select c from "
+ " StaffShiftExtra c"
+ " where c.retired=false "
+ " and c.shiftDate =:dt "
+ " and c.staff=:stf ";
hm.put("dt", getDate());
hm.put("stf", getCurrentAdditionalForm().getStaff());
staffShifts.addAll(staffShiftFacade.findBySQL(sql, hm, TemporalType.DATE));
}
public void fetchStaffShiftNotNormal() {
HashMap hm = new HashMap();
String sql = "select c from "
+ " StaffShift c"
+ " where c.retired=false "
+ " and type(c)!=:cl "
+ " and c.shift is not null "
+ " and c.shift.dayType in :dtp "
+ " and c.shiftDate =:dt "
+ " and c.staff=:stf ";
hm.put("dtp", Arrays.asList(new DayType[]{DayType.DayOff, DayType.Poya, DayType.PublicHoliday, DayType.MurchantileHoliday}));
hm.put("cl", StaffShiftExtra.class);
hm.put("dt", getDate());
hm.put("stf", getCurrentAdditionalForm().getStaff());
staffShifts = staffShiftFacade.findBySQL(sql, hm, TemporalType.DATE);
System.out.println("sql = " + sql);
}
public void fetchStaffShift(Date date, Staff staff) {
HashMap hm = new HashMap();
String sql = "select c from "
+ " StaffShift c"
+ " where c.retired=false "
// + " and c.shift is not null "
+ " and c.shiftDate=:dt "
+ " and c.staff=:stf ";
hm.put("dt", date);
hm.put("stf", staff);
staffShifts = staffShiftFacade.findBySQL(sql, hm, TemporalType.DATE);
}
public List<StaffShift> getStaffShifts() {
return staffShifts;
}
public void setStaffShifts(List<StaffShift> staffShifts) {
this.staffShifts = staffShifts;
}
public StaffShiftFacade getStaffShiftFacade() {
return staffShiftFacade;
}
public void setStaffShiftFacade(StaffShiftFacade staffShiftFacade) {
this.staffShiftFacade = staffShiftFacade;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public StaffAdditionalFormController() {
}
public void clear() {
currentAdditionalForm = null;
staffShifts = null;
date = null;
newStaffShift = false;
additionalForms = null;
}
public boolean errorCheckExtra() {
if (currentAdditionalForm.getStaff() == null) {
JsfUtil.addErrorMessage("Please Enter Staff");
return true;
}
if (currentAdditionalForm.getStaffShift() == null) {
JsfUtil.addErrorMessage("Please Enter Staff Shift");
return true;
}
if (currentAdditionalForm.getCode().isEmpty()) {
JsfUtil.addErrorMessage("Please Enter Form Number");
return true;
}
if (currentAdditionalForm.getFromTime() == null) {
JsfUtil.addErrorMessage("Please Select From Time");
return true;
}
if (currentAdditionalForm.getToTime() == null) {
JsfUtil.addErrorMessage("Please Select From Time");
return true;
}
Long timePeriod = CommonFunctions.calTimePeriod(currentAdditionalForm.getFromTime(), currentAdditionalForm.getToTime());
if (timePeriod < 0 || (timePeriod / 24) > 1) {
JsfUtil.addErrorMessage("Please Check From Time and To Time Range");
return true;
}
if (currentAdditionalForm.getApprovedStaff() == null) {
JsfUtil.addErrorMessage("Please Select Approved Person");
return true;
}
// if (currentAdditionalForm.getApprovedAt() == null) {
// JsfUtil.addErrorMessage("Please Select Approved Date");
// return true;
// }
// if (currentAdditionalForm.getComments() == null || "".equals(currentAdditionalForm.getComments())) {
// JsfUtil.addErrorMessage("Please Add Comment");
// return true;
// }
if (currentAdditionalForm.getTimes() == null) {
JsfUtil.addErrorMessage("Please Select Time Type");
return true;
}
if (date == null) {
JsfUtil.addErrorMessage("Please Select Date");
return true;
}
if (getCurrentAdditionalForm().getTimes() != Times.All && currentAdditionalForm.getStaffShift() == null) {
JsfUtil.addErrorMessage("Please Select Staff Shiftt");
return true;
}
if (getCurrentAdditionalForm().getTimes() == Times.All && currentAdditionalForm.getStaffShift() != null) {
JsfUtil.addErrorMessage("Please Un Select Staff Shiftt");
return true;
}
// if (fetchCurrentSalaryCycle(date) != null) {
// SalaryCycle s = fetchCurrentSalaryCycle(date);
// System.out.println("s.getWorkedFromDate() = " + s.getWorkedFromDate());
// System.out.println("s.getWorkedToDate() = " + s.getWorkedToDate());
// System.out.println("s.getDayOffPhFromDate() = " + s.getDayOffPhFromDate());
// System.out.println("s.getDayOffPhToDate() = " + s.getDayOffPhToDate());
// Date nowDate = CommonFunctions.getEndOfDay();
// System.out.println("nowDate = " + nowDate);
// if (nowDate.getTime() > s.getDayOffPhToDate().getTime()) {
// double d = (nowDate.getTime() - s.getDayOffPhToDate().getTime()) / (1000 * 60 * 60 * 24);
// System.out.println("d = " + d);
// if (d > 3) {
// JsfUtil.addErrorMessage("You Can't Add This Addional."
// + "because you can add only additionls within 3 days after Day off / PH To Date");
// return true;
// }
// }
// }
//
// if (fetchCurrentSalaryCycle(date) != null) {
// StaffSalary s = humanResourceBean.getStaffSalary(currentAdditionalForm.getStaff(), fetchCurrentSalaryCycle(date));
// if (s.getId() != null) {
// JsfUtil.addErrorMessage("You Can't Add This Addional."
// + "because this salary was createed");
// return true;
// }
// }
//NEED To Check StaffSHift if not selected is there any shift time on that day
return false;
}
public boolean errorCheckShiftDayOff() {
if (currentAdditionalForm.getStaff() == null) {
JsfUtil.addErrorMessage("Please Enter Staff");
return true;
}
if (currentAdditionalForm.getCode().isEmpty()) {
JsfUtil.addErrorMessage("Please Enter Form Number");
return true;
}
if (currentAdditionalForm.getFromTime() == null) {
JsfUtil.addErrorMessage("Please Select From Time");
return true;
}
if (currentAdditionalForm.getToTime() == null) {
JsfUtil.addErrorMessage("Please Select From Time");
return true;
}
Long timePeriod = CommonFunctions.calTimePeriod(currentAdditionalForm.getFromTime(), currentAdditionalForm.getToTime());
if (timePeriod <= 0 || (timePeriod / 24) > 1) {
JsfUtil.addErrorMessage("Please Check From Time and To Time Range");
return true;
}
if (currentAdditionalForm.getApprovedStaff() == null) {
JsfUtil.addErrorMessage("Please Select Approved Person");
return true;
}
if (currentAdditionalForm.getApprovedAt() == null) {
JsfUtil.addErrorMessage("Please Select Approved Date");
return true;
}
if (currentAdditionalForm.getComments() == null || "".equals(currentAdditionalForm.getComments())) {
JsfUtil.addErrorMessage("Please Add Comment");
return true;
}
// if (currentAdditionalForm.getTimes() == null) {
// JsfUtil.addErrorMessage("Please Select Time Type");
// return true;
// }
if (date == null) {
JsfUtil.addErrorMessage("Please Select Date");
return true;
}
if (fetchCurrentSalaryCycle(date) != null) {
SalaryCycle s = fetchCurrentSalaryCycle(date);
System.out.println("s.getWorkedFromDate() = " + s.getWorkedFromDate());
System.out.println("s.getWorkedToDate() = " + s.getWorkedToDate());
System.out.println("s.getDayOffPhFromDate() = " + s.getDayOffPhFromDate());
Date nowDate = CommonFunctions.getEndOfDay();
if (nowDate.getTime() > s.getDayOffPhToDate().getTime()) {
double d = (nowDate.getTime() - s.getDayOffPhToDate().getTime()) / (1000 * 60 * 60 * 24);
if (d > 3) {
JsfUtil.addErrorMessage("You Can't Add This Addional."
+ "because you can add only additionls within 3 days after Day off / PH To Date");
return true;
}
}
}
if (fetchCurrentSalaryCycle(date) != null) {
StaffSalary s = humanResourceBean.getStaffSalary(currentAdditionalForm.getStaff(), fetchCurrentSalaryCycle(date));
if (s.getId() != null) {
JsfUtil.addErrorMessage("You Can't Add This Addional."
+ "because this salary was createed");
return true;
}
}
// if (getCurrentAdditionalForm().getTimes() != Times.All && currentAdditionalForm.getStaffShift() == null) {
// JsfUtil.addErrorMessage("Please Select Staff Shiftt");
// return true;
// }
//
// if (getCurrentAdditionalForm().getTimes() == Times.All && currentAdditionalForm.getStaffShift() != null) {
// JsfUtil.addErrorMessage("Please Un Select Staff Shiftt");
// return true;
// }
//NEED To Check StaffSHift if not selected is there any shift time on that day
return false;
}
public boolean errorCheckShift() {
if (currentAdditionalForm.getStaff() == null) {
JsfUtil.addErrorMessage("Please Enter Staff");
return true;
}
if (currentAdditionalForm.getCode().isEmpty()) {
JsfUtil.addErrorMessage("Please Enter Form Number");
return true;
}
if (currentAdditionalForm.getFromTime() == null) {
JsfUtil.addErrorMessage("Please Select From Time");
return true;
}
if (currentAdditionalForm.getToTime() == null) {
JsfUtil.addErrorMessage("Please Select From Time");
return true;
}
Long timePeriod = CommonFunctions.calTimePeriod(currentAdditionalForm.getFromTime(), currentAdditionalForm.getToTime());
if (timePeriod <= 0 || (timePeriod / 24) > 1) {
JsfUtil.addErrorMessage("Please Check From Time and To Time Range");
return true;
}
if (currentAdditionalForm.getApprovedStaff() == null) {
JsfUtil.addErrorMessage("Please Select Approved Person");
return true;
}
if (currentAdditionalForm.getApprovedAt() == null) {
JsfUtil.addErrorMessage("Please Select Approved Date");
return true;
}
if (currentAdditionalForm.getComments() == null || "".equals(currentAdditionalForm.getComments())) {
JsfUtil.addErrorMessage("Please Add Comment");
return true;
}
// if (currentAdditionalForm.getTimes() == null) {
// JsfUtil.addErrorMessage("Please Select Time Type");
// return true;
// }
if (date == null) {
JsfUtil.addErrorMessage("Please Select Date");
return true;
}
// if (fetchCurrentSalaryCycle(date) != null) {
// SalaryCycle s = fetchCurrentSalaryCycle(date);
// System.out.println("s.getWorkedFromDate() = " + s.getWorkedFromDate());
// System.out.println("s.getWorkedToDate() = " + s.getWorkedToDate());
// System.out.println("s.getDayOffPhFromDate() = " + s.getDayOffPhFromDate());
// System.out.println("s.getDayOffPhToDate() = " + s.getDayOffPhToDate());
// Date nowDate = CommonFunctions.getEndOfDay();
// System.out.println("nowDate = " + nowDate);
// if (nowDate.getTime() > s.getDayOffPhToDate().getTime()) {
// double d = (nowDate.getTime() - s.getDayOffPhToDate().getTime()) / (1000 * 60 * 60 * 24);
// System.out.println("d = " + d);
// if (d > 3) {
// JsfUtil.addErrorMessage("You Can't Add This Addional."
// + "because you can add only additionls within 3 days after Day off / PH To Date");
// return true;
// }
// }
// }
//
// if (fetchCurrentSalaryCycle(date) != null) {
// StaffSalary s = humanResourceBean.getStaffSalary(currentAdditionalForm.getStaff(), fetchCurrentSalaryCycle(date));
// if (s.getId() != null) {
// JsfUtil.addErrorMessage("You Can't Add This Addional."
// + "because this salary was createed");
// return true;
// }
// }
// if (getCurrentAdditionalForm().getTimes() != Times.All && currentAdditionalForm.getStaffShift() == null) {
// JsfUtil.addErrorMessage("Please Select Staff Shiftt");
// return true;
// }
//
// if (getCurrentAdditionalForm().getTimes() == Times.All && currentAdditionalForm.getStaffShift() != null) {
// JsfUtil.addErrorMessage("Please Un Select Staff Shiftt");
// return true;
// }
//NEED To Check StaffSHift if not selected is there any shift time on that day
return false;
}
public SalaryCycle fetchCurrentSalaryCycle(Date d) {
String sql;
Map m = new HashMap();
sql = "select c from SalaryCycle c "
+ " where c.retired=false "
+ " and c.dayOffPhFromDate<:d "
+ " and c.dayOffPhToDate>:d ";
m.put("d", d);
return salaryCycleFacade.findFirstBySQL(sql, m, TemporalType.TIMESTAMP);
}
@Inject
PhDateController phDateController;
public void saveAdditionalFormExtra() {
if (errorCheckExtra()) {
return;
}
currentAdditionalForm.setCreatedAt(new Date());
currentAdditionalForm.setCreater(getSessionController().getLoggedUser());
if (currentAdditionalForm.getId() == null) {
getAdditionalFormFacade().create(currentAdditionalForm);
} else {
getAdditionalFormFacade().edit(currentAdditionalForm);
}
currentAdditionalForm.getStaffShift().resetExtraTime();
currentAdditionalForm.getStaffShift().setAdditionalForm(currentAdditionalForm);
staffShiftFacade.edit(currentAdditionalForm.getStaffShift());
JsfUtil.addSuccessMessage("Sucessfully Saved");
clear();
}
boolean newStaffShift;
public boolean isNewStaffShift() {
return newStaffShift;
}
public void setNewStaffShift(boolean newStaffShift) {
this.newStaffShift = newStaffShift;
}
public void saveAdditionalFormShiftDayOff() {
if (errorCheckShiftDayOff()) {
return;
}
StaffShift staffShift = staffShiftFacade.find(currentAdditionalForm.getStaffShift().getId());
System.out.println("staffShift = " + staffShift);
System.out.println("staffShift.getDayType() = " + staffShift.getDayType());
Shift shift = null;
if (currentAdditionalForm.getStaffShift() == null) {
UtilityController.addErrorMessage("Please Un Select Staff Shift");
return;
}
DayType dayType;
if (currentAdditionalForm.getStaffShift().getDayType() != null || currentAdditionalForm.getStaffShift().getDayType() == DayType.DayOff
|| currentAdditionalForm.getStaffShift().getShift().isHalfShift()) {
dayType = currentAdditionalForm.getStaffShift().getDayType();
System.out.println("currentAdditionalForm.getStaffShift().getShift().isHalfShift() = " + currentAdditionalForm.getStaffShift().getShift().isHalfShift());
} else {
dayType = phDateController.getHolidayType(date);
}
shift = currentAdditionalForm.getStaffShift().getShift();
if (shift == null) {
shift = fetchShift(currentAdditionalForm.getStaff().getRoster(), dayType);
}
// if(dayType==DayType.Poya && currentAdditionalForm.getStaffShift().getShift()!=null){
// shift=currentAdditionalForm.getStaffShift().getShift();
// }else{
// shift = fetchShift(currentAdditionalForm.getStaff().getRoster(), dayType);
// }
currentAdditionalForm.setTimes(Times.All);
currentAdditionalForm.setCreatedAt(new Date());
currentAdditionalForm.setCreater(getSessionController().getLoggedUser());
if (currentAdditionalForm.getId() == null) {
getAdditionalFormFacade().create(currentAdditionalForm);
} else {
getAdditionalFormFacade().edit(currentAdditionalForm);
}
StaffShiftExtra staffShiftExtra = new StaffShiftExtra();
staffShiftFacade.create(staffShiftExtra);
if (currentAdditionalForm.getStaffShift() != null) {
staffShiftExtra.copy(currentAdditionalForm.getStaffShift());
if (staffShiftExtra.getPreviousStaffShift() != null) {
staffShiftExtra.getPreviousStaffShift().setNextStaffShift(staffShiftExtra);
staffShiftFacade.edit(staffShiftExtra.getPreviousStaffShift());
}
staffShiftExtra.setReferenceStaffShift(currentAdditionalForm.getStaffShift());
currentAdditionalForm.getStaffShift().setRetired(true);
currentAdditionalForm.getStaffShift().setRetiredAt(new Date());
currentAdditionalForm.getStaffShift().setRetirer(sessionController.getLoggedUser());
staffShiftFacade.edit(currentAdditionalForm.getStaffShift());
}
// } else {
staffShiftExtra.setStaff(currentAdditionalForm.getStaff());
staffShiftExtra.setRoster(currentAdditionalForm.getStaff().getRoster());
if (shift != null) {
staffShiftExtra.setShift(shift);
}
// }
staffShiftExtra.setCreatedAt(new Date());
staffShiftExtra.setCreater(sessionController.getLoggedUser());
staffShiftExtra.setAdditionalForm(currentAdditionalForm);
staffShiftExtra.setShiftDate(date);
staffShiftExtra.setShiftStartTime(currentAdditionalForm.getFromTime());
staffShiftExtra.setShiftEndTime(currentAdditionalForm.getToTime());
System.err.println("staffShiftExtra.getDayType() = " + staffShiftExtra.getDayType());
System.err.println("dayType = " + dayType);
staffShiftExtra.setDayType(dayType);
staffShiftFacade.edit(staffShiftExtra);
currentAdditionalForm.setStaffShift(staffShiftExtra);
additionalFormFacade.edit(currentAdditionalForm);
JsfUtil.addSuccessMessage("Sucessfully Saved");
clear();
}
public void saveAdditionalFormShift() {
if (errorCheckShift()) {
return;
}
Shift shift = null;
shift = fetchShift(currentAdditionalForm.getStaff().getRoster(), DayType.Extra);
currentAdditionalForm.setTimes(Times.All);
currentAdditionalForm.setCreatedAt(new Date());
currentAdditionalForm.setCreater(getSessionController().getLoggedUser());
if (currentAdditionalForm.getId() == null) {
getAdditionalFormFacade().create(currentAdditionalForm);
} else {
getAdditionalFormFacade().edit(currentAdditionalForm);
}
StaffShiftExtra staffShiftExtra = new StaffShiftExtra();
staffShiftFacade.create(staffShiftExtra);
if (currentAdditionalForm.getStaffShift() != null) {
staffShiftExtra.copy(currentAdditionalForm.getStaffShift());
if (staffShiftExtra.getPreviousStaffShift() != null) {
staffShiftExtra.getPreviousStaffShift().setNextStaffShift(staffShiftExtra);
staffShiftFacade.edit(staffShiftExtra.getPreviousStaffShift());
}
staffShiftExtra.setReferenceStaffShift(currentAdditionalForm.getStaffShift());
currentAdditionalForm.getStaffShift().setRetired(true);
currentAdditionalForm.getStaffShift().setRetiredAt(new Date());
currentAdditionalForm.getStaffShift().setRetirer(sessionController.getLoggedUser());
staffShiftFacade.edit(currentAdditionalForm.getStaffShift());
}
// } else {
staffShiftExtra.setStaff(currentAdditionalForm.getStaff());
staffShiftExtra.setRoster(currentAdditionalForm.getStaff().getRoster());
if (shift != null) {
staffShiftExtra.setShift(shift);
}
// }
staffShiftExtra.setDayType(DayType.Extra);
staffShiftExtra.setCreatedAt(new Date());
staffShiftExtra.setCreater(sessionController.getLoggedUser());
staffShiftExtra.setAdditionalForm(currentAdditionalForm);
staffShiftExtra.setShiftDate(date);
staffShiftExtra.setShiftStartTime(currentAdditionalForm.getFromTime());
staffShiftExtra.setShiftEndTime(currentAdditionalForm.getToTime());
staffShiftFacade.edit(staffShiftExtra);
currentAdditionalForm.setStaffShift(staffShiftExtra);
additionalFormFacade.edit(currentAdditionalForm);
JsfUtil.addSuccessMessage("Sucessfully Saved");
clear();
}
@EJB
ShiftFacade shiftFacade;
private Shift fetchShift(Roster roster, DayType dayType) {
if (dayType == null || roster == null) {
return null;
}
String sql = "select s from Shift s "
+ " where s.retired=false "
+ " and s.roster=:rs"
+ " and s.dayType=:dtp ";
HashMap hm = new HashMap();
hm.put("rs", roster);
hm.put("dtp", dayType);
Shift sh = shiftFacade.findFirstBySQL(sql, hm, TemporalType.DATE);
if (sh == null) {
sh = new Shift();
sh.setCreatedAt(new Date());
sh.setCreater(sessionController.getLoggedUser());
sh.setDayType(dayType);
sh.setRoster(roster);
sh.setName(dayType.toString());
sh.setStartingTime(null);
sh.setEndingTime(null);
shiftFacade.create(sh);
}
// System.out.println("sh.getName() = " + sh.getShift().getName());
return sh;
}
private Shift fetchShift(Roster roster, DayType dayType, Staff staff) {
if (dayType == null || roster == null) {
return null;
}
String sql = "select s from Shift s "
+ " where s.retired=false "
+ " and s.roster=:rs"
+ " and s.dayType=:dtp "
+ " and s.staff=:stf";
HashMap hm = new HashMap();
hm.put("rs", roster);
hm.put("dtp", dayType);
Shift sh = shiftFacade.findFirstBySQL(sql, hm, TemporalType.DATE);
if (sh == null) {
sh = new Shift();
sh.setCreatedAt(new Date());
sh.setCreater(sessionController.getLoggedUser());
sh.setDayType(dayType);
sh.setRoster(roster);
sh.setName(dayType.toString());
sh.setStartingTime(null);
sh.setEndingTime(null);
shiftFacade.create(sh);
}
return sh;
}
private Shift fetchShift(Roster roster) {
if (roster == null) {
return null;
}
String sql = "select s from Shift s "
+ " where s.retired=false "
+ " and s.roster=:rs"
+ " and (s.dayType=:dtp1 or s.dayType=:dtp2 )";
HashMap hm = new HashMap();
hm.put("rs", roster);
hm.put("dtp1", DayType.DayOff);
hm.put("dtp2", DayType.SleepingDay);
Shift sh = shiftFacade.findFirstBySQL(sql, hm, TemporalType.DATE);
return sh;
}
private Shift fetchShift(Roster roster, Date date) {
if (roster == null) {
return null;
}
String sql = "select s from Shift s "
+ " where s.retired=false "
+ " and s.roster=:rs"
+ " and (s.dayType=:dtp1 or s.dayType=:dtp2 )";
HashMap hm = new HashMap();
hm.put("rs", roster);
hm.put("dtp1", DayType.DayOff);
hm.put("dtp2", DayType.SleepingDay);
Shift sh = shiftFacade.findFirstBySQL(sql, hm, TemporalType.DATE);
return sh;
}
List<Shift> shifts;
public class AditionalWithTime {
AdditionalForm af;
long time;
public AdditionalForm getAf() {
return af;
}
public void setAf(AdditionalForm af) {
this.af = af;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
}
public PhDateController getPhDateController() {
return phDateController;
}
public void setPhDateController(PhDateController phDateController) {
this.phDateController = phDateController;
}
public ShiftFacade getShiftFacade() {
return shiftFacade;
}
public void setShiftFacade(ShiftFacade shiftFacade) {
this.shiftFacade = shiftFacade;
}
public List<Shift> getShifts() {
return shifts;
}
public void setShifts(List<Shift> shifts) {
this.shifts = shifts;
}
// public void fetchShift() {
// if (getCurrentAdditionalForm().getStaff() == null) {
// UtilityController.addErrorMessage("Please Select Staff");
// return;
// }
//
// if (getDate() == null) {
// UtilityController.addErrorMessage("Please Select Date");
// return;
// }
//
// shifts = new ArrayList<>();
//
// DayType dayType = phDateController.getHolidayType(date);
// shift = fetchShiftForPh(currentAdditionalForm.getStaff().getRoster(), dayType);
//
// if (shift != null) {
// shifts.add(shift);
// return;
// }
//
// HashMap hm = new HashMap();
// String sql = " select c from "
// + " Shift c "
// + " where c.retired=false "
// + " and c.dayType in :dtp"
// + " and c.roster=:rs ";
//
// hm.put("dtp", new DayType[]{DayType.DayOff, DayType.MurchantileHoliday, DayType.Poya, DayType.SleepingDay});
// hm.put("rs", getCurrentAdditionalForm().getStaff().getRoster());
// shifts = shiftFacade.findBySQL(sql, hm);
// }
public AdditionalForm getCurrentAdditionalForm() {
if (currentAdditionalForm == null) {
currentAdditionalForm = new AdditionalForm();
}
return currentAdditionalForm;
}
public void setCurrentAdditionalForm(AdditionalForm currentAdditionalForm) {
this.currentAdditionalForm = currentAdditionalForm;
}
public AdditionalFormFacade getAdditionalFormFacade() {
return additionalFormFacade;
}
public void setAdditionalFormFacade(AdditionalFormFacade additionalFormFacade) {
this.additionalFormFacade = additionalFormFacade;
}
public SessionController getSessionController() {
return sessionController;
}
public void setSessionController(SessionController sessionController) {
this.sessionController = sessionController;
}
public List<AdditionalForm> getAdditionalForms() {
return additionalForms;
}
public void setAdditionalForms(List<AdditionalForm> additionalForms) {
this.additionalForms = additionalForms;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
public Staff getStaff() {
return staff;
}
public void setStaff(Staff staff) {
this.staff = staff;
}
public Staff getApprovedStaff() {
return approvedStaff;
}
public void setApprovedStaff(Staff approvedStaff) {
this.approvedStaff = approvedStaff;
}
public Date getFromDate() {
if (fromDate == null) {
fromDate = CommonFunctions.getStartOfMonth(new Date());
}
return fromDate;
}
public void setFromDate(Date fromDate) {
this.fromDate = fromDate;
}
public Date getToDate() {
if (toDate == null) {
toDate = CommonFunctions.getEndOfMonth(new Date());
}
return toDate;
}
public void setToDate(Date toDate) {
this.toDate = toDate;
}
public SystemTimeStamp getFromSystemTimeStamp() {
if (fromSystemTimeStamp == null) {
fromSystemTimeStamp = new SystemTimeStamp();
}
return fromSystemTimeStamp;
}
public void setFromSystemTimeStamp(SystemTimeStamp fromSystemTimeStamp) {
this.fromSystemTimeStamp = fromSystemTimeStamp;
}
public SystemTimeStamp getToSystemTimeStamp() {
if (toSystemTimeStamp == null) {
toSystemTimeStamp = new SystemTimeStamp();
}
return toSystemTimeStamp;
}
public void setToSystemTimeStamp(SystemTimeStamp toSystemTimeStamp) {
this.toSystemTimeStamp = toSystemTimeStamp;
}
public List<AditionalWithTime> getAditionalWithTimes() {
return aditionalWithTimes;
}
public void setAditionalWithTimes(List<AditionalWithTime> aditionalWithTimes) {
this.aditionalWithTimes = aditionalWithTimes;
}
public double getTotalInTime() {
return totalInTime;
}
public void setTotalInTime(double totalInTime) {
this.totalInTime = totalInTime;
}
public double getTotalOutTime() {
return totalOutTime;
}
public void setTotalOutTime(double totalOutTime) {
this.totalOutTime = totalOutTime;
}
public double getTotalAllTime() {
return totalAllTime;
}
public void setTotalAllTime(double totalAllTime) {
this.totalAllTime = totalAllTime;
}
public CommonController getCommonController() {
return commonController;
}
public void setCommonController(CommonController commonController) {
this.commonController = commonController;
}
}
|
export type Commands = Record<string, () => unknown>;
export type CoreSpec = {
name: 'core';
config: {
projectId: string;
fixturesDir: string;
fixtureFileSuffix: string;
devServerOn: boolean;
webRendererUrl: null | string;
};
state: {
commands: Commands;
};
methods: {
registerCommands(commands: Commands): () => void;
runCommand(name: string): unknown;
getProjectId(): string;
getFixtureFileVars(): { fixturesDir: string; fixtureFileSuffix: string };
isDevServerOn(): boolean;
getWebRendererUrl(): null | string;
};
};
|
/**
* For Prism reports of a block being placed or broken, parse player name,
* block type and action.
*/
@SuppressWarnings("unused")
void placeBreak(IChatComponent chat, Matcher m)
{
_player = m.group(1);
String blockAndCount = m.group(2);
boolean parsedNumericType = false;
int id = 0;
int data = 0;
if (m.group(3) != null && m.group(4) != null)
{
try
{
id = Integer.parseInt(m.group(3));
data = Integer.parseInt(m.group(4));
parsedNumericType = true;
}
catch (NumberFormatException ex)
{
}
}
String time = m.group(6);
String action = m.group(6);
if (parsedNumericType && id != 0)
{
_type = BlockTypeRegistry.instance.getBlockTypeByIdData(id, data);
}
else
{
Matcher countMatch = COUNT_PATTERN.matcher(blockAndCount);
String block = countMatch.find() ? blockAndCount.substring(0, m.start())
: blockAndCount;
_type = BlockTypeRegistry.instance.getBlockTypeByName(block);
}
_created = !action.equals("break");
_expectingDateTimeCoords = true;
}
|
import { DepartmentMultiselectComponent } from './components/roles/department-multiselect/department-multiselect.component';
import { RolesPermissionGridComponent } from './components/roles/roles-permission/roles-permission-grid/roles-permission-grid.component';
import { RolesPermissionComponent } from './components/roles/roles-permission/roles-permission.component';
import { RolesComponent } from './components/roles/roles.component';
import { RolesRoutes } from './roles.routing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { LayoutModule } from '@progress/kendo-angular-layout';
import { GridModule } from '@progress/kendo-angular-grid';
import { InputsModule } from '@progress/kendo-angular-inputs';
import { DialogModule } from '@progress/kendo-angular-dialog';
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
import { LabelModule } from '@progress/kendo-angular-label';
@NgModule({
imports: [
CommonModule,
DialogModule,
InputsModule,
LayoutModule,
GridModule,
FormsModule,
ReactiveFormsModule,
RolesRoutes,
LabelModule,
DropDownsModule],
declarations: [
RolesComponent,
RolesPermissionComponent,
DepartmentMultiselectComponent,
RolesPermissionGridComponent,
],
providers: [
],
})
export class RolesModule { }
|
<gh_stars>0
# ExoQuantPY (ExoQuant v0.7)
#
# Copyright (c) 2019 <NAME>
# Copyright (c) 2004 <NAME>
#
# 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.
#/******************************************************************************
#* Usage:
#* ------
#*
#* exq = ExoQuant() // init quantizer (per image)
#* exq.feed(<byte array of rgba32 data>) // feed pixel data (32bpp)
#* exq.quantize(<num of colors>) // find palette
#* rgba32Palette = exq.get_palette(<num of colors>) // get palette
#* indexData = exq.map_image(<num of pixels>, <byte array of rgba32 data>)
#* or:
#* indexData = exq.map_image_ordered(<width>, <height>, <byte array of rgba32 data>)
#* // map image to palette
#*
#* Notes:
#* ------
#*
#* All 32bpp data (input data and palette data) is considered a byte stream
#* of the format:
#* R0 G0 B0 A0 R1 G1 B1 A1 ...
#* If you want to use a different order, the easiest way to do this is to
#* change the SCALE_x constants in expquant.h, as those are the only differences
#* between the channels.
#*
#******************************************************************************/
import math
import random
_EXQ_HASH_BITS = 16
_EXQ_HASH_SIZE = 1 << _EXQ_HASH_BITS
_EXQ_SCALE_R = 1.0
_EXQ_SCALE_G = 1.2
_EXQ_SCALE_B = 0.8
_EXQ_SCALE_A = 1.0
class ExqColor:
def __init__(self):
self.r = 0.0
self.g = 0.0
self.b = 0.0
self.a = 0.0
class ExqHistogramEntry:
def __init__(self):
self.color = ExqColor()
self.ored = 0 # byte
self.ogreen = 0 # byte
self.oblue = 0 # byte
self.oalpha = 0 # byte
self.palIndex = 0 # int
self.ditherScale = ExqColor()
self.ditherIndex = [0] * 4 # int[4]
self.num = 0 # int
self.pNext = None # ExqHistogramEntry
self.pNextInHash = None # ExqHistogramEntry
class ExqNode:
def __init__(self):
self.dir = ExqColor() # ExqColor
self.avg = ExqColor() # ExqColor
self.vdif = 0.0 # double
self.err = 0.0 # double
self.num = 0 # int
self.pHistogram = None # ExqHistogramEntry
self.pSplit = None # ExqHistogramEntry
class ExqData:
def __init__(self):
self.pHash = [None] * _EXQ_HASH_SIZE # ExqHistogramEntry[_EXQ_HASH_SIZE]
self.node = [None] * 256 # ExqNode[256]
self.numColors = 0 # int
self.numBitsPerChannel = 0 # int
self.optimized = False # bool
self.transparency = False # bool
class ExoQuant:
def __init__(self):
self.sortDir = ExqColor()
self.pExq = ExqData()
for i in range(256):
self.pExq.node[i] = ExqNode()
for i in range(_EXQ_HASH_SIZE):
self.pExq.pHash[i] = None
self.pExq.numColors = 0
self.pExq.optimized = False
self.pExq.transparency = True
self.pExq.numBitsPerChannel = 8
def no_transparency(self):
self.pExq.transparency = False
def make_hash(self, rgba):
rgba -= (rgba >> 13) | (rgba << 19)
rgba &= 0xFFFFFFFF
rgba -= (rgba >> 13) | (rgba << 19)
rgba &= 0xFFFFFFFF
rgba -= (rgba >> 13) | (rgba << 19)
rgba &= 0xFFFFFFFF
rgba -= (rgba >> 13) | (rgba << 19)
rgba &= 0xFFFFFFFF
rgba -= (rgba >> 13) | (rgba << 19)
rgba &= (_EXQ_HASH_SIZE - 1)
return rgba
def to_rgba(self, r, g, b, a):
return r | (g << 8) | (b << 16) | (a << 24)
def feed(self, pData):
channelMask = 0xFF00 >> self.pExq.numBitsPerChannel
nPixels = len(pData) // 4
for i in range(nPixels):
r = pData[i * 4 + 0]
g = pData[i * 4 + 1]
b = pData[i * 4 + 2]
a = pData[i * 4 + 3]
hash = self.make_hash(self.to_rgba(r, g, b, a))
pCur = self.pExq.pHash[hash]
while (pCur != None and (pCur.ored != r or pCur.ogreen != g or pCur.oblue != b or pCur.oalpha != a)):
pCur = pCur.pNextInHash
if (pCur != None):
pCur.num += 1
else:
pCur = ExqHistogramEntry()
pCur.pNextInHash = self.pExq.pHash[hash]
self.pExq.pHash[hash] = pCur
pCur.ored = r
pCur.ogreen = g
pCur.oblue = b
pCur.oalpha = a
r &= channelMask
g &= channelMask
b &= channelMask
pCur.color.r = r / 255.0 * _EXQ_SCALE_R
pCur.color.g = g / 255.0 * _EXQ_SCALE_G
pCur.color.b = b / 255.0 * _EXQ_SCALE_B
pCur.color.a = a / 255.0 * _EXQ_SCALE_A
if self.pExq.transparency:
pCur.color.r *= pCur.color.a
pCur.color.g *= pCur.color.a
pCur.color.b *= pCur.color.a
pCur.num = 1
pCur.palIndex = -1
pCur.ditherScale.r = pCur.ditherScale.g = pCur.ditherScale.b = pCur.ditherScale.a = -1
pCur.ditherIndex[0] = pCur.ditherIndex[1] = pCur.ditherIndex[2] = pCur.ditherIndex[3] = -1
def quantize(self, nColors):
self.quantize_ex(nColors, False)
def quantize_hq(self, nColors):
self.quantize_ex(nColors, True)
def quantize_ex(self, nColors, hq):
pCur = None
pNext = None
if (nColors > 256):
nColors = 256
if (self.pExq.numColors == 0):
self.pExq.node[0].pHistogram = None
for i in range(_EXQ_HASH_SIZE):
pCur = self.pExq.pHash[i]
while (pCur != None):
pCur.pNext = self.pExq.node[0].pHistogram
self.pExq.node[0].pHistogram = pCur
pCur = pCur.pNextInHash
self.sum_node(self.pExq.node[0])
self.pExq.numColors = 1
for i in range(self.pExq.numColors, nColors):
beste = 0
besti = 0
for j in range(i):
if (self.pExq.node[j].vdif >= beste):
beste = self.pExq.node[j].vdif
besti = j
pCur = self.pExq.node[besti].pHistogram
self.pExq.node[besti].pHistogram = None
self.pExq.node[i].pHistogram = None
while (pCur != None and pCur != self.pExq.node[besti].pSplit):
pNext = pCur.pNext
pCur.pNext = self.pExq.node[i].pHistogram
self.pExq.node[i].pHistogram = pCur
pCur = pNext
while (pCur != None):
pNext = pCur.pNext
pCur.pNext = self.pExq.node[besti].pHistogram
self.pExq.node[besti].pHistogram = pCur
pCur = pNext
self.sum_node(self.pExq.node[besti])
self.sum_node(self.pExq.node[i])
self.pExq.numColors = i + 1
if (hq):
self.optimize_palette(1)
self.pExq.optimized = False
def get_mean_error(self):
n = 0
err = 0
for i in range(self.pExq.numColors):
n += self.pExq.node[i].num
err += self.pExq.node[i].err
return math.sqrt(err / n) * 256
def get_palette(self, nColors):
channelMask = 0xff00 >> self.pExq.numBitsPerChannel
pPal = [0] * (nColors * 4)
if nColors > self.pExq.numColors:
nColors = self.pExq.numColors
if not self.pExq.optimized:
self.optimize_palette(4)
for i in range(nColors):
r = self.pExq.node[i].avg.r
g = self.pExq.node[i].avg.g
b = self.pExq.node[i].avg.b
a = self.pExq.node[i].avg.a
if self.pExq.transparency and a != 0:
r /= a
g /= a
b /= a
pPalIndex = i * 4
pPal[pPalIndex + 0] = r / _EXQ_SCALE_R * 255.9
pPal[pPalIndex + 1] = g / _EXQ_SCALE_G * 255.9
pPal[pPalIndex + 2] = b / _EXQ_SCALE_B * 255.9
pPal[pPalIndex + 3] = a / _EXQ_SCALE_A * 255.9
for j in range(3):
pPal[pPalIndex + j] = int(pPal[pPalIndex + j] + (1 << (8 - self.pExq.numBitsPerChannel)) // 2) & channelMask
return pPal
def set_palette(self, pPal, nColors):
self.pExq.numColors = nColors
for i in range(nColors):
self.pExq.node[i].avg.r = pPal[i * 4 + 0] * _EXQ_SCALE_R / 255.9
self.pExq.node[i].avg.g = pPal[i * 4 + 1] * _EXQ_SCALE_G / 255.9
self.pExq.node[i].avg.b = pPal[i * 4 + 2] * _EXQ_SCALE_B / 255.9
self.pExq.node[i].avg.a = pPal[i * 4 + 3] * _EXQ_SCALE_A / 255.9
self.pExq.optimized = True
def map_image(nPixels, pIn):
c = ExqColor()
pHist = None
pOut = [0] * nPixels
if not self.pExq.optimized:
self.optimize_palette(4)
for i in range(nPixels):
pHist = self.find_histogram(pIn, i)
if (pHist != None and pHist.palIndex != -1):
pOut[i] = pHist.palIndex
else:
c.r = pIn[i * 4 + 0] / 255.0 * _EXQ_SCALE_R
c.g = pIn[i * 4 + 1] / 255.0 * _EXQ_SCALE_G
c.b = pIn[i * 4 + 2] / 255.0 * _EXQ_SCALE_B
c.a = pIn[i * 4 + 3] / 255.0 * _EXQ_SCALE_A
if(self.pExq.transparency):
c.r *= c.a
c.g *= c.a
c.b *= c.a
pOut[i] = self.find_nearest_color(c)
if(pHist != None):
pHist.palIndex = i
return pOut
def map_image_ordered(self, width, height, pIn):
return self.map_image_dither(width, height, pIn, True)
def map_image_random(self, nPixels, pIn):
return self.map_image_dither(nPixels, 1, pIn, False)
#private readonly Random random = Random()
def map_image_dither(self, width, height, pIn, ordered):
ditherMatrix = [ -0.375, 0.125, 0.375, -0.125 ]
p = ExqColor()
scale = ExqColor()
tmp = ExqColor()
pHist = None
pOut = [0] * (width * height)
if not self.pExq.optimized:
self.optimize_palette(4)
for y in range(height):
for x in range(width):
index = y * width + x
if ordered:
d = (x & 1) + (y & 1) * 2
else:
d = randrange(32767) & 3
pHist = self.find_histogram(pIn, index)
p.r = pIn[index * 4 + 0] / 255.0 * _EXQ_SCALE_R
p.g = pIn[index * 4 + 1] / 255.0 * _EXQ_SCALE_G
p.b = pIn[index * 4 + 2] / 255.0 * _EXQ_SCALE_B
p.a = pIn[index * 4 + 3] / 255.0 * _EXQ_SCALE_A
if self.pExq.transparency:
p.r *= p.a
p.g *= p.a
p.b *= p.a
if pHist == None or pHist.ditherScale.r < 0:
i = self.find_nearest_color(p)
scale.r = self.pExq.node[i].avg.r - p.r
scale.g = self.pExq.node[i].avg.g - p.g
scale.b = self.pExq.node[i].avg.b - p.b
scale.a = self.pExq.node[i].avg.a - p.a
tmp.r = p.r - scale.r / 3
tmp.g = p.g - scale.g / 3
tmp.b = p.b - scale.b / 3
tmp.a = p.a - scale.a / 3
j = self.find_nearest_color(tmp)
if i == j:
tmp.r = p.r - scale.r * 3
tmp.g = p.g - scale.g * 3
tmp.b = p.b - scale.b * 3
tmp.a = p.a - scale.a * 3
j = self.find_nearest_color(tmp)
if i != j:
scale.r = (self.pExq.node[j].avg.r - self.pExq.node[i].avg.r) * 0.8
scale.g = (self.pExq.node[j].avg.g - self.pExq.node[i].avg.g) * 0.8
scale.b = (self.pExq.node[j].avg.b - self.pExq.node[i].avg.b) * 0.8
scale.a = (self.pExq.node[j].avg.a - self.pExq.node[i].avg.a) * 0.8
if scale.r < 0:
scale.r = -scale.r
if scale.g < 0:
scale.g = -scale.g
if scale.b < 0:
scale.b = -scale.b
if scale.a < 0:
scale.a = -scale.a
else:
scale.r = scale.g = scale.b = scale.a = 0
if pHist != None:
pHist.ditherScale.r = scale.r
pHist.ditherScale.g = scale.g
pHist.ditherScale.b = scale.b
pHist.ditherScale.a = scale.a
else:
scale.r = pHist.ditherScale.r
scale.g = pHist.ditherScale.g
scale.b = pHist.ditherScale.b
scale.a = pHist.ditherScale.a
if (pHist != None and pHist.ditherIndex[d] >= 0):
pOut[index] = pHist.ditherIndex[d]
else:
tmp.r = p.r + scale.r * ditherMatrix[d]
tmp.g = p.g + scale.g * ditherMatrix[d]
tmp.b = p.b + scale.b * ditherMatrix[d]
tmp.a = p.a + scale.a * ditherMatrix[d]
pOut[index] = self.find_nearest_color(tmp)
if pHist != None:
pHist.ditherIndex[d] = pOut[index]
return pOut
def sum_node(self, pNode):
n = 0
fsum = ExqColor()
fsum2 = ExqColor()
vc = ExqColor()
tmp = ExqColor()
tmp2 = ExqColor()
sum = ExqColor()
sum2 = ExqColor()
pCur = None
fsum.r = fsum.g = fsum.b = fsum.a = 0
fsum2.r = fsum2.g = fsum2.b = fsum2.a = 0
pCur = pNode.pHistogram
while pCur != None:
n += pCur.num
fsum.r += pCur.color.r * pCur.num
fsum.g += pCur.color.g * pCur.num
fsum.b += pCur.color.b * pCur.num
fsum.a += pCur.color.a * pCur.num
fsum2.r += pCur.color.r * pCur.color.r * pCur.num
fsum2.g += pCur.color.g * pCur.color.g * pCur.num
fsum2.b += pCur.color.b * pCur.color.b * pCur.num
fsum2.a += pCur.color.a * pCur.color.a * pCur.num
pCur = pCur.pNext
pNode.num = n
if n == 0:
pNode.vdif = 0
pNode.err = 0
return
pNode.avg.r = fsum.r / n
pNode.avg.g = fsum.g / n
pNode.avg.b = fsum.b / n
pNode.avg.a = fsum.a / n
vc.r = fsum2.r - fsum.r * pNode.avg.r
vc.g = fsum2.g - fsum.g * pNode.avg.g
vc.b = fsum2.b - fsum.b * pNode.avg.b
vc.a = fsum2.a - fsum.a * pNode.avg.a
v = vc.r + vc.g + vc.b + vc.a
pNode.err = v
pNode.vdif = -v
if vc.r > vc.g and vc.r > vc.b and vc.r > vc.a:
pNode.pHistogram = self.sort(pNode.pHistogram, self.sort_by_red)
elif vc.g > vc.b and vc.g > vc.a:
pNode.pHistogram = self.sort(pNode.pHistogram, self.sort_by_green)
elif vc.b > vc.a:
pNode.pHistogram = self.sort(pNode.pHistogram, self.sort_by_blue)
else:
pNode.pHistogram = self.sort(pNode.pHistogram, self.sort_by_alpha)
pNode.dir.r = pNode.dir.g = pNode.dir.b = pNode.dir.a = 0
pCur = pNode.pHistogram
while pCur != None:
tmp.r = (pCur.color.r - pNode.avg.r) * pCur.num
tmp.g = (pCur.color.g - pNode.avg.g) * pCur.num
tmp.b = (pCur.color.b - pNode.avg.b) * pCur.num
tmp.a = (pCur.color.a - pNode.avg.a) * pCur.num
if tmp.r * pNode.dir.r + tmp.g * pNode.dir.g + tmp.b * pNode.dir.b + tmp.a * pNode.dir.a < 0:
tmp.r = -tmp.r
tmp.g = -tmp.g
tmp.b = -tmp.b
tmp.a = -tmp.a
pNode.dir.r += tmp.r
pNode.dir.g += tmp.g
pNode.dir.b += tmp.b
pNode.dir.a += tmp.a
pCur = pCur.pNext
try:
isqrt = 1 / math.sqrt(pNode.dir.r * pNode.dir.r + pNode.dir.g * pNode.dir.g + pNode.dir.b * pNode.dir.b + pNode.dir.a * pNode.dir.a)
except ZeroDivisionError:
isqrt = float('Inf')
pNode.dir.r *= isqrt
pNode.dir.g *= isqrt
pNode.dir.b *= isqrt
pNode.dir.a *= isqrt
self.sortDir = pNode.dir
pNode.pHistogram = self.sort(pNode.pHistogram, self.sort_by_dir)
sum.r = sum.g = sum.b = sum.a = 0
sum2.r = sum2.g = sum2.b = sum2.a = 0
n2 = 0
pNode.pSplit = pNode.pHistogram
pCur = pNode.pHistogram
while pCur != None:
if pNode.pSplit == None:
pNode.pSplit = pCur
n2 += pCur.num
sum.r += pCur.color.r * pCur.num
sum.g += pCur.color.g * pCur.num
sum.b += pCur.color.b * pCur.num
sum.a += pCur.color.a * pCur.num
sum2.r += pCur.color.r * pCur.color.r * pCur.num
sum2.g += pCur.color.g * pCur.color.g * pCur.num
sum2.b += pCur.color.b * pCur.color.b * pCur.num
sum2.a += pCur.color.a * pCur.color.a * pCur.num
if n == n2:
break
tmp.r = sum2.r - sum.r * sum.r / n2
tmp.g = sum2.g - sum.g * sum.g / n2
tmp.b = sum2.b - sum.b * sum.b / n2
tmp.a = sum2.a - sum.a * sum.a / n2
tmp2.r = (fsum2.r - sum2.r) - (fsum.r - sum.r) * (fsum.r - sum.r) / (n - n2)
tmp2.g = (fsum2.g - sum2.g) - (fsum.g - sum.g) * (fsum.g - sum.g) / (n - n2)
tmp2.b = (fsum2.b - sum2.b) - (fsum.b - sum.b) * (fsum.b - sum.b) / (n - n2)
tmp2.a = (fsum2.a - sum2.a) - (fsum.a - sum.a) * (fsum.a - sum.a) / (n - n2)
nv = tmp.r + tmp.g + tmp.b + tmp.a + tmp2.r + tmp2.g + tmp2.b + tmp2.a
if -nv > pNode.vdif:
pNode.vdif = -nv
pNode.pSplit = None
pCur = pCur.pNext
if pNode.pSplit == pNode.pHistogram:
pNode.pSplit = pNode.pSplit.pNext
pNode.vdif += v
def optimize_palette(self, iter):
pCur = None
self.pExq.optimized = True
for n in range(iter):
for i in range(self.pExq.numColors):
self.pExq.node[i].pHistogram = None
for i in range(_EXQ_HASH_SIZE):
pCur = self.pExq.pHash[i]
while pCur != None:
j = self.find_nearest_color(pCur.color)
pCur.pNext = self.pExq.node[j].pHistogram
self.pExq.node[j].pHistogram = pCur
pCur = pCur.pNextInHash
for i in range(self.pExq.numColors):
self.sum_node(self.pExq.node[i])
def find_nearest_color(self, pColor):
dif = ExqColor()
bestv = 16
besti = 0
for i in range(self.pExq.numColors):
dif.r = pColor.r - self.pExq.node[i].avg.r
dif.g = pColor.g - self.pExq.node[i].avg.g
dif.b = pColor.b - self.pExq.node[i].avg.b
dif.a = pColor.a - self.pExq.node[i].avg.a
if (dif.r * dif.r + dif.g * dif.g + dif.b * dif.b + dif.a * dif.a < bestv):
bestv = dif.r * dif.r + dif.g * dif.g + dif.b * dif.b + dif.a * dif.a
besti = i
return besti
def find_histogram(self, pCol, index):
pCur = None
r = pCol[index * 4 + 0]
g = pCol[index * 4 + 1]
b = pCol[index * 4 + 2]
a = pCol[index * 4 + 3]
hash = self.make_hash(self.to_rgba(r, g, b, a))
pCur = self.pExq.pHash[hash]
while pCur != None and (pCur.ored != r or pCur.ogreen != g or pCur.oblue != b or pCur.oalpha != a):
pCur = pCur.pNextInHash
return pCur
def sort(self, ppHist, sortfunc):
pLow = None
pHigh = None
pCur = None
pNext = None
n = 0
sum = 0
pCur = ppHist
while pCur != None:
n += 1
sum += sortfunc(pCur)
pCur = pCur.pNext
if n < 2:
return ppHist
sum /= n
pLow = pHigh = None
pCur = ppHist
while pCur != None:
pNext = pCur.pNext
if sortfunc(pCur) < sum:
pCur.pNext = pLow
pLow = pCur
else:
pCur.pNext = pHigh
pHigh = pCur
pCur = pNext
if pLow == None:
ppHist = pHigh
return ppHist
if pHigh == None:
ppHist = pLow
return ppHist
pLow = self.sort(pLow, sortfunc)
pHigh = self.sort(pHigh, sortfunc)
ppHist = pLow
while pLow.pNext != None:
pLow = pLow.pNext
pLow.pNext = pHigh
return ppHist
def sort_by_red(self, pHist):
return pHist.color.r
def sort_by_green(self, pHist):
return pHist.color.g
def sort_by_blue(self, pHist):
return pHist.color.b
def sort_by_alpha(self, pHist):
return pHist.color.a
def sort_by_dir(self, pHist):
return pHist.color.r * self.sortDir.r + pHist.color.g * self.sortDir.g + pHist.color.b * self.sortDir.b + pHist.color.a * self.sortDir.a
|
/**
* Method used both for new services and for modified services
* @param serviceReference
* @param webElement
*/
@SuppressWarnings("deprecation")
private T addingService(ServiceReference<S> serviceReference, T webElement) {
if (webElement == null) {
log.debug("No element model was created from reference {}", serviceReference);
return null;
}
Object legacyIdProperty = serviceReference.getProperty(PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_ID);
String legacyId = legacyIdProperty instanceof String ? ((String)legacyIdProperty) : null;
if (legacyId != null) {
log.warn("Legacy {} property used, please select context(s) using {} property.",
PaxWebConstants.SERVICE_PROPERTY_HTTP_CONTEXT_ID,
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT);
}
Object selectorProperty = serviceReference.getProperty(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT);
if (selectorProperty != null && !(selectorProperty instanceof String)) {
log.warn("{} context selection property is not of type String. Ignoring {}.",
HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT, serviceReference);
return null;
}
boolean legacyMapping = false;
String[] objectClasses = Utils.getObjectClasses(serviceReference);
for (String oc : objectClasses) {
if (oc.startsWith(LEGACY_MAPPING_PACKAGE)) {
String oc2 = oc.substring(LEGACY_MAPPING_PACKAGE.length());
if (oc2.startsWith(".") && oc2.indexOf('.', 1) == -1) {
legacyMapping = true;
break;
}
}
}
String selector = webElement.getContextSelector();
if (selector == null) {
selector = determineSelector(legacyMapping, legacyId, (String) selectorProperty, serviceReference);
}
Filter contextFilter;
try {
contextFilter = bundleContext.createFilter(selector);
} catch (InvalidSyntaxException e) {
log.error("Can't register web element from reference {}, skipping registration."
+ " Bad context selector: {}", serviceReference, selector, e);
return null;
}
webElement.setContextSelectFilter(contextFilter);
List<OsgiContextModel> contexts = whiteboardExtenderContext.resolveContexts(serviceReference.getBundle(), contextFilter);
for (OsgiContextModel contextModel : contexts) {
webElement.addContextModel(contextModel);
}
if (webElement.isValid()) {
whiteboardExtenderContext.addWebElement(serviceReference.getBundle(), webElement);
return webElement;
} else {
whiteboardExtenderContext.configureFailedDTOs(webElement);
return null;
}
}
|
/*
* Function: soc_cm_salloc
* Purpose: Allocate shareable memory for communication with the device.
*
* Parameters: dev - device handle
* size - amount of memory in bytes.
* name - name of this memory (for debugging purposes only)
*
* Returns: Pointer to the memory if successful, otherwise NULL.
*
* Note: The return value is a pointer to the memory.
* Positive values are valid, and should not be interpreted as error.
* If unsuccesful, NULL is returned.
*/
void *
soc_cm_salloc(int dev, int size, const char *name)
{
void *ptr;
#ifdef BROADCOM_DEBUG
if (soc_cm_debug_property_get(dev)) {
shared_block_t *p = NULL;
uint32 size_words = (size + 3) / 4;
uint32 modified_size = 0;
assert(name != NULL);
assert(name[0] != 0);
modified_size = sizeof (shared_block_t) + (size_words * 4);
p = CMVEC(dev).salloc(&CMDEV(dev).dev, modified_size, name);
if (p == NULL) {
return NULL;
}
p->start_sentinel = 0xaabbccdd;
p->description = (char *)name;
p->size = size;
p->modified_size = modified_size;
p->user_data[size_words] = 0xddccbbaa;
CM_DB_LOCK();
if (head != NULL) {
head->prev = p;
}
p->prev = NULL;
p->next = head;
head = p;
if ((char *)p < (char *)shared_start) {
shared_start = (char*)p;
}
if ((((char *)p) + modified_size) > shared_end) {
shared_end = (char*)((char *)p + modified_size);
}
CM_DB_UNLOCK();
ptr = (void *)&p->user_data[0];
}
else {
ptr = CMVEC(dev).salloc(&CMDEV(dev).dev, size, name);
}
#else
ptr = CMVEC(dev).salloc(&CMDEV(dev).dev, size, name);
#endif
MEMLOG_ALLOC("soc_cm_salloc", ptr, size, name);
return ptr;
}
|
Establishment Republicans and the main stream media are having a difficult time understanding why Ron Paul supporters aren’t just falling into line behind Mitt Romney. Don’t we want the GOP to win? And don’t we want our own candidate to win the nomination someday? And if so, don’t we realize that we have to be loyal to the nominee this time?
Of course, these are the same establishment Republicans who are hiring off duty policemen to arrest and detain our duly elected county chairmen, or locking the registered rolls of delegates in the trunks of their cars so that the convention cannot have a roll call vote and they can claim “Ayes have it,” when the “Ayes” don’t have anything.
And this is the mainstream media that gave Ron Paul 89 seconds of an hour long televised debate. And who in another debate, gave their anchor almost as much time as Dr. Paul, the presidential candidate. And who ignore videotaped state conventions where delegates have their bones broken for more compelling news stories elsewhere.
We see the train headed toward a canyon and the bridge is out. There is going to be a great crash. And meanwhile, we are being urged to change the engineer. “Obama is driving this train 100 mph!” we are told by hand wringing, hysterical, establishment Republicans. “We need to get Romney in there. He will slow it down to 95.”
Some are quite energized by this contest. They think that the future of the Republic is at stake. “Can’t you see that?” They ask imploringly. “Don’t you care?”
But we only laugh. Yes, Romney will spend less than Obama but he will not reduce spending by a single cent. The circulation of money will be increased to pay the deficit and the poor and middle class will suffer from devalued money.
Obama? Romney? So what? This train is still headed toward the canyon and the bridge is out. This train needs to be stopped, not slowed. And the bridge needs to be repaired.
Remember this?
Advertisements
Share this: Facebook
More
Twitter
Reddit
Google
Email
Like this: Like Loading... Related
|
import { expect } from 'chai';
import Echo from './Echo';
import ChildProcessProxy from '../../../src/child-proxy/ChildProcessProxy';
import { File } from 'stryker-api/core';
describe('ChildProcessProxy', () => {
let sut: ChildProcessProxy<Echo>;
beforeEach(() => {
sut = ChildProcessProxy.create(require.resolve('./Echo'), 'info', [], Echo, 'World');
});
afterEach(() => {
sut.dispose();
});
it('should be able to get direct result', async () => {
const actual = await sut.proxy.say('hello');
expect(actual).eq('World: hello');
});
it('should be able to get delayed result', async () => {
const actual = await sut.proxy.sayDelayed('hello', 2);
expect(actual).eq('World: hello (2 ms)');
});
it('should be able to receive files', async () => {
const actual: string = await sut.proxy.echoFile(new File('hello.txt', 'hello world from file'));
expect(actual).eq('hello world from file');
});
it('should be able to send files', async () => {
const actual: File = await sut.proxy.readFile();
expect(actual.textContent).eq('hello foobar');
expect(actual.name).eq('foobar.txt');
});
it('should be able to receive a promise rejection', () => {
return expect(sut.proxy.reject('Foobar error')).rejectedWith('Foobar error');
});
});
|
/*use for camera unread count clear */
private void callupdateUnReadCameraLogs(final boolean b) {
if (!ActivityHelper.isConnectingToInternet(this)) {
Toast.makeText(this.getApplicationContext(), R.string.disconnect, Toast.LENGTH_SHORT).show();
return;
}
if (ChatApplication.url.contains("http://"))
ChatApplication.url = ChatApplication.url.replace("http://", "");
SpikeBotApi.getInstance().callupdateUnReadCameraLogs("camera", cameraIdTemp, new DataResponseListener() {
@Override
public void onData_SuccessfulResponse(String stringResponse) {
try {
finish();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onData_FailureResponse() {
ActivityHelper.dismissProgressDialog();
Toast.makeText(CameraDeviceLogActivity.this, R.string.disconnect, Toast.LENGTH_SHORT).show();
}
@Override
public void onData_FailureResponse_with_Message(String error) {
ActivityHelper.dismissProgressDialog();
Toast.makeText(CameraDeviceLogActivity.this, R.string.disconnect, Toast.LENGTH_SHORT).show();
}
});
}
|
<reponame>yash921/Monocliche
from typing import Any
from monocliche.model import Player
class Node:
def __init__(self, data: Player, next: Any = None, prev: Any = None):
self.data = data
self.next = next
self.prev = prev
class LinkedPlayers:
"""
Personalized implementation of a circular linked list.
The purpose is to manage the player list, to keep track of the player of the current turn
and to calculate the player of the next turn.
"""
def __init__(self):
self.__last = None
self.__current_node = None
# It keeps track of where the last iteration stopped
self.__temp_iterator = None
self.size = 0
@property
def current_player(self) -> Player:
"""
Returns the player of the current turn.
"""
if self.__current_node is not None:
return self.__current_node.data
else:
return None
@property
def first_player(self) -> Player:
"""
Returns the first player on the list.
"""
if self.__last is not None and self.__last.next is not None:
if self.__current_node is None:
self.__current_node = self.__last.next
return self.__last.next.data
else:
return None
def add(self, player: Player):
"""
Add the input player to the list.
"""
node = Node(player)
if self.__last is None:
self.__last = node
node.next = self.__last
else:
head = self.__last.next
self.__last.next = node
node.prev = self.__last
node.next = head
head.prev = node
self.__last = node
self.size += 1
def remove(self, player: Player):
"""
Remove the input player from the list.
"""
if self.__last is not None:
if self.__last.next == self.__last:
self.__last = None
else:
head = self.__last.next
temp = head
while temp.next != head:
if temp.data == player:
prev = temp.prev
next = temp.next
prev.next = next
next.prev = prev
self.size -= 1
break
else:
temp = temp.next
def next_player(self) -> Player:
"""
Calculate the next player.
"""
if self.__current_node is None:
if self.__last is not None:
self.__current_node = self.__last.next
else:
self.__current_node = self.__current_node.next
return self.current_player
def iterate(self):
"""
Iterates through the linked list and returns the list of players present.
"""
if self.__last is not None:
# It starts from the last element, but on the first iteration, it will point to the first element
if self.__temp_iterator is None:
self.__temp_iterator = self.__last
head = self.__last.next
iterate = True
while iterate:
# Point to the next node
self.__temp_iterator = self.__temp_iterator.next
temp = self.__temp_iterator
# if the next element is the first again, then it blocks the iteration
if self.__temp_iterator.next == head:
# So for the next iteration, it forces the element to point to the last one, If this is not done,
# each time we start from the last element in which we remained.
self.__temp_iterator = None
iterate = False
yield temp.data
else:
# Nothing to iterate
self.__temp_iterator = None
yield
|
module Westeros
{
export class Tournament{
public events:Event[];
public prizes:Prize[];
public attendees: Attendee[]
constructor(){
}
}
export class TournamentBuilder
{
build(builder)
{
return builder.build();
}
}
export class LannisterTournamentBuilder{
public build(){
var tournament = new Tournament();
tournament.events.push(new Event("Joust"));
tournament.events.push(new Event("Melee"));
tournament.attendees.push(new Attendee("Jamie"));
tournament.prizes.push(new Prize("Gold"));
tournament.prizes.push(new Prize("More Gold"));
return tournament;
}
}
export class BaratheonTournamentBuilder{
public build(){
var tournament = new Tournament();
tournament.events.push(new Event("Joust"));
tournament.events.push(new Event("Melee"));
tournament.attendees.push(new Attendee("Stannis"));
tournament.attendees.push(new Attendee("Robert"));
return tournament;
}
}
export class Event{
constructor(public name: string){}
}
export class Prize{
constructor(public name: string){}
}
export class Attendee{
constructor(public name: string){}
}
}
|
Gender Differences in Contraceptive Self-Efficacy: A Cross-Sectional Study of South Korean College Students
Purpose: Healthy sexuality is an important issue in the transition to adulthood. To maintain healthy sexuality, contraceptive self-efficacy could be the most significant predictor of safe sexuality. The purpose of this study was to explore the relationship between gender roles and the healthy sexuality of South Korean college students. Method: A cross-sectional study through self-report questionnaires was administered to college students in South Korea. In total, 499 students completed the demographic information questionnaire, the Sexual Attitudes Scale, Sexual Autonomy Scale, and Condom Self-Efficacy Scale. Results: A multiple regression analysis indicated that the contraceptive self-efficacy of male students was predicted by their junior year and sexual autonomy, while that of the females was predicted by their senior year and sexual autonomy. Conclusion: Sexual education focusing on sexual autonomy should be provided for the safe and healthy sexual expression of college students.
Introduction
Healthy sexuality involves sexual wellness-a concept subjectively and individually defined. The World Health Organization notes that "sexual health requires a positive approach to sexuality and sexual relationships, as well as the possibility of having pleasurable and safe sexual experiences, free of coercion, discrimination, and violence" . The perception of healthy or harmful sexual experiences should be examined from the perspective of different genders and the cultural context where individuals live .
In order to maintain a healthy practice of sexuality, contraceptive self-efficacy could be the most significant predictor of contraceptive use of sexually active college students. It is also important to elucidate the underlying gender differences in the sexual attitudes, autonomy, and contraceptive self-efficacy of young adults who are transitioning to adulthood. Contraceptive self-efficacy refers to the belief that a person can control sexual and contraceptive situations to prevent unwanted pregnancy and sexually transmitted disease . Contraceptive self-efficacy was developed to measure the theory of self-efficacy in sexual health, focusing on adolescents who have difficulty in saying no . Since an individual's behavior is generally determined by one's perceived self-efficacy, existing literature has established evidence about the relationships between contraceptive self-efficacy and contraceptive behavior . In this context, healthy sexuality implies positive attitudes, high sexual autonomy, and contraceptive self-efficacy.
Attitudes are consistent sets of thoughts, emotions, and behaviors about an object that are constructed from one's own experiences, educational background, relationships, and cultural 1.
To explore the sexual attitudes, sexual autonomy, and contraceptive self-efficacy of South Korean college students; 2.
To identify the factors that influence the contraceptive self-efficacy of college students by gender.
Methods
A descriptive cross-sectional study was conducted to examine the factors influencing the contraceptive self-efficacy of South Korean college students. This study attempted to provide basic data for the development of well-grounded sexual health education programs for college students.
Setting and Sample
This study was conducted at Daejeon University, with 10,000 students in South Korea. A convenience sample of college students was recruited from the school by posting announcements during school events, and those who voluntarily visited the booth participated in the study. They were informed about the purpose of the research and were assured that their participation would be voluntary and anonymous. A power analysis was conducted a priori using G * power software version 3.1.7, that indicated that at least 118 subjects would be required to detect a medium effect size (f 2 ) of 0.15, with 80% of power, a two-sided α of 0.05, and 10 potential predictors. A total of 512 students were eligible. Of these, 13 students that had missing data were excluded. Thus, a final sample of 499 participants were included in the analyses.
Demographic Characteristics
Self-reported demographic characteristics were collected; these included their year level, family's economic status, parental status, current residence, dating experience, number of dating experiences, the average length of dating, sources of information on sexuality, and level of sexual contact.
Sexual Attitude
The sexual attitude was measured using the Sexual Attitudes Scale developed by Hendrick and Hendrick for young adults and was translated and modified by Choi . The Sexual Attitudes Scale is a multi-dimensional instrument with 43 items that have sub-concepts of permissiveness (casual sexuality), sexual practice (responsible, tolerant sexuality), communion (idealistic sexuality), and instrumentality (biological, utilitarian sexuality). Choi , 64-85 . This study had a Cronbach's alpha of 0.89.
Sexual Autonomy
The Sexual Autonomy Scale was developed for college students but was validated as an effective tool for both college students and unmarried men and women in South Korea . This tool has sub-concepts of control and coping, with 13 questions measured on a five-point Likert scale (1 = strongly disagree, 5 = strongly agree). The range of possible scores for this scale is 13-65, with higher scores indicating a higher degree of sexual autonomy. Cronbach's alpha in the original study was 0.86 , and 0.90 in this study.
Contraceptive Self-Efficacy
Contraceptive self-efficacy was measured using the Condom Self-Efficacy Scale developed and modified by Hwang and Chung to fit the situation of contraception . This scale consists of 12 items, and each item is rated on a five-point Likert scale (1 = strongly disagree, 5 = strongly agree). The range of possible scores for this scale is 12-60, and a higher score indicates higher contraceptive self-efficacy. At the time of development and modification, Cronbach's alpha was 0.70 and 0.76 , respectively. This study had a Cronbach's alpha of 0.80.
Data Collection and Ethical Consideration
The data were collected using self-report questionnaires from May 9 to 13, 2016. Questionnaires were distributed when participants visited the booth during school events. Research assistants explained the purpose of the research, the procedures, and the voluntary nature of the study to potential participants. In order to foster participation and reduce discomfort, research assistants distributed and helped participants fill out the questionnaires, which took approximately 15 min each to complete.
This study was approved by the Institutional Review Board of Daejeon University (1040647-201602-HR-002-03); all the participants signed written informed consent forms before recruitment. The participants were assured of confidentiality and anonymity prior to the beginning of the study and were reminded of their right to refuse to participate or withdraw from the investigation.
Statistical Analysis
Statistical analyses were performed using IBM SPSS 22.0. Demographic characteristics, sexual attitude, sexual autonomy, and contraceptive self-efficacy were presented based on the frequency, mean, and standard deviation. The differences in sexual attitude, sexual autonomy, and contraceptive self-efficacy based on demographic characteristics were evaluated using t-tests and analyses of variance with Scheffé post hoc test. The association between contraceptive self-efficacy, sexual attitude, and autonomy was examined using Pearson's correlation. Factors influencing contraceptive self-efficacy were analyzed using hierarchical multiple regression.
Demographics, Sexual Attitude, Sexual Autonomy, and Contraceptive Self-Efficacy
Participants comprised 253 men (50.3%) and 246 women (49.7%); according to the academic year, most of them were freshmen while seniors were the fewest. Most belonged to a middle-class family (83.8%) and still had parents (91.4%), but only about one third lived in their parents' home.
In total, 403 participants (80.8%) had experience dating, a mean dating experience of 2.91 times, an average dating length of less than 12 months (84.0%). Among the participants, 42.6% had experienced sexual intercourse, and there were no differences in gender. Their main source of sexuality information was media (36.6%). The mean score on the sexual attitude and autonomy scales was 67.80 (SD = 12.65) and 51.41 (SD = 7.63), respectively, and 45.94 (SD = 6.64) on the Contraceptive Self-efficacy scale ( Table 1).
Factors Influencing Contraceptive Self-Efficacy
Multiple regression analysis was conducted to examine the factors influencing contraceptive self-efficacy. The residual analysis confirmed that the assumptions of multicollinearity, linearity, normality, and equality of variance were met in the regression equation. To identify the factors influencing contraceptive self-efficacy, because a gender difference was shown, hierarchical regression analysis was performed by gender. In this study, independent factors were assessed for any significant impact on contraceptive self-efficacy via univariate analysis. To develop the contraceptive self-efficacy model, we entered demographic characteristics (year level, dating experience, and sources of sexuality information) in the first block and sexual attitude in the second block. Finally, we entered sexual autonomy in the third block to examine the effects of the contraceptive self-efficacy.
In males, the addition of sexual autonomy to the second block equation resulted in 45.5% of explained variance in contraceptive self-efficacy, showing that sexual autonomy was a significant factor influencing contraceptive self-efficacy (β = 0.63, p < 0.001), and the model was adequate (F = 36.03, p < 0.001). In females, the addition of sexual autonomy to the second block equation resulted in 30.8% of the explained variance in contraceptive self-efficacy, which was the same as that in males, indicating that sexual autonomy was a significant factor influencing contraceptive self-efficacy (β = 0.52, p < 0.001) and that the model was adequate (F = 19.15, p < 0.001) ( Table 3).
Discussion
In this study, significant variations in sexual attitudes, sexual autonomy, and contraceptive self-efficacy by demographic characteristics emerged. Female students tended to have higher sexual autonomy and contraceptive self-efficacy while male students have higher sexual attitudes, meaning they are more active and have an open tendency toward sexuality. These results are consistent with previous studies that sexual autonomy and contraceptive self-efficacy are higher in women than men, and sexual attitude is higher in men than women .
In this study, second-year college students showed a relatively high increased level of sexual autonomy and contraceptive self-efficacy. In South Korea, second-year students have the opportunity to experience a variety of sexual experiences since it is generally considered the legal age of adulthood. They may be exposed to more sexual experiences than freshmen, along with frequent opportunities to consider sexual autonomy and contraception, thus, resulting in a high increase in sexual autonomy and contraceptive self-efficacy in the second year. Contraceptive self-efficacy was high in males in the second year and females in the fourth year. In South Korea, most male students go to the military during their sophomore year, and situational factors such as enlistment may have affected this. Education and intervention for healthy sexuality may be provided during this period.
Students with dating experience tended to have a high level of sexual autonomy and contraceptive self-efficacy. Sexual autonomy and contraceptive self-efficacy were highest when the students got sexuality information from their teachers and parents, while sexual attitude was highest when students considered friends as their main information resources. Although there is no statistically significant difference between existing sexual education through school or parents, sexual autonomy can be seen as an effect of education from older generations such as parents and teachers. These differences may help explain behavioral and educational perspectives of healthy sexuality of the young adult population in South Korea. The continuing general sexual education program in schools had an effect on sexual knowledge but not on sexual attitude . Therefore, given that characteristics of sexual attitudes related to psychological and relational aspects are more influenced by friends and the media, it can be seen that traditional sexual education is not enough to change existing attitudes regarding healthy sexuality. Consistent with prior work by Geer and Robertson , which found that women had less positive and implicit attitudes toward sexuality than men did, we found that male students had positive and open attitudes toward sexuality. Interestingly, we found that female students were relatively more likely to have higher sexual autonomy and contraceptive self-efficacy. This implies that women may still have fewer positive attitudes than males regarding sexual activities, as they seem to be subjected more to cultivating responsible attitudes for sexuality, compared to men. A previous study presented that girls may not feel comfortable with sexual decision making within sexual relationships or safe sexual intercourse, and they feel pressured to take a passive role because of the norms of proper femininity . This may cause difficulties as women are at risk for pregnancy in unsafe or high-risk sexual behaviors. Female college students have higher sexual autonomy and contraceptive self-efficacy than males, implying that they were more responsible for their sexual behavior. Interestingly the level of sexual attitudes, sexual autonomy, and contraceptive self-efficacy greatly increased in the second year of college students. In South Korea, most adolescents are under intense competition and pressure in academic performance . Becoming a college student means they have enough power and control to do what they want to do . The sudden increase in attitude, autonomy, and contraceptive self-efficacy toward sexuality means that there is room to educate and perform active intervention when they enter college. Under the premise that sexual education has been continuously conducted since infancy, it focuses on sexual harassment and sexual violence that reflects the gender-related issues of older generations . Therefore, given the significant increase in the level of sexual autonomy and self-efficacy for contraception in the second year of college, education is required to embed this into their broader sexual health .
In this study, when sexual autonomy was added to the analysis of both men and women, the rationale behind contraceptive self-efficacy increased significantly. Therefore, sexual autonomy was identified as a major factor influencing contraceptive self-efficacy for both genders. Sexual autonomy expresses a willingness to take care of one's body, and it gives individuals sexual pride or identity. It is the willingness to sexual relationship and responsibility toward one's body and the ability to act on oneself . Contraceptive self-efficacy is closely related to sexual autonomy and seems to be related to conceptual and attribute similarity. Healthy sexuality requires the management of sexual health that considers physical, psychological, and relational aspects. In this sense, sexual autonomy is an important concept that can reflect the characteristics of healthy sexuality. Therefore, sexual education focusing on sexual autonomy should be provided for the safe and healthy sexuality of college students.
To this end, education should not only be an attribute of sexual autonomy but also support for the establishment of self-identity, a task of college students. In other words, the sexual education of college students should be perception and value-centered, and because the owners of their sexual health are themselves, they should experience sexual education that focuses on empowering them to manage their own sexual health.
This study shows that educational interventions promoting sexual autonomy must be implemented in order to increase contraceptive self-efficacy and to have safe and healthy sexuality. Based on the results of this study, college students need education on healthy sexuality enabling them to recognize their value as a sexual being and to control their sexual behavior.
This study provides basic data for the development of sexual health education programs for college students, but there are several limitations that must be taken into consideration when drawing conclusions. Even though the sample size was large enough to run a statistical analysis, the participants in this study were recruited from only one university. Generalizability may be limited to similar characteristics of the study population and may not extend to all college students. Most of the participants in this study were those who visited the booth during school events and, thus, may be more likely to be interested in sexuality than students who did not visit. Although it was not intended, there was little participation in the senior, and they seemed to be less interested in school events or due to preparation activities and classes for employment. It is possible that selection bias in sampling occurred and affected study findings. Therefore, further studies should be considered using stratified sampling by grade level and gender so that all students from freshman to senior can participate uniformly.
Conclusions
In this descriptive study, we identified the factors influencing contraceptive self-efficacy of South Korean college students. The findings of this study demonstrated that college students had differences in sexual autonomy and contraceptive self-efficacy by year level, especially second-year college students with an increased level of sexual autonomy and contraceptive self-efficacy. Furthermore, they had differences in sexual attitude, sexual autonomy, and contraceptive self-efficacy by gender, and sexual autonomy was the most important variable in contraceptive self-efficacy for both genders.
Sexual health education is necessary for first-year college students who are socially recognized as adults and are exposed to increasing opportunities for sexual experience. Therefore, it should provide not only the right values for sexuality but also sexual health-related issues, such as increasing contraceptive self-efficacy, and consider gender differences. In addition, it is suggested that active education be provided so that they may consult with experts regarding their healthy sexuality. Further studies from diverse schools or areas might be helpful if differences emerge, and the use of qualitative methodologies is recommended to investigate in-depth a college student's experiences related to sexual health.
|
<gh_stars>100-1000
/* FriBidi
* fribidi-types.h - define data types for the rest of the library
*
* $Id: fribidi-types.h,v 1.12 2006/01/31 03:23:13 behdad Exp $
* $Author: behdad $
* $Date: 2006/01/31 03:23:13 $
* $Revision: 1.12 $
* $Source: /cvs/fribidi/fribidi2/lib/fribidi-types.h,v $
*
* Author:
* <NAME>, 2001, 2002, 2004
*
* Copyright (C) 2004 <NAME>.
* Copyright (C) 2001,2002 <NAME>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library, in a file named COPYING; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA
*
* For licensing issues, contact <<EMAIL>>.
*/
#ifndef _FRIBIDI_TYPES_H
#define _FRIBIDI_TYPES_H
#include "fribidi-common.h"
#include "fribidi-begindecls.h"
#if FRIBIDI_USE_GLIB+0
# ifndef __FRIBIDI_DOC
# include <glib/gtypes.h>
# include <glib/gunicode.h>
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_INT8_LOCAL gint8
# define FRIBIDI_INT16_LOCAL gint16
# define FRIBIDI_INT32_LOCAL gint32
# define FRIBIDI_UINT8_LOCAL guint8
# define FRIBIDI_UINT16_LOCAL guint16
# define FRIBIDI_UINT32_LOCAL guint32
# define FRIBIDI_BOOLEAN_LOCAL gboolean
# define FRIBIDI_UNICHAR_LOCAL gunichar
#else /* !FRIBIDI_USE_GLIB */
# if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
# ifndef __FRIBIDI_DOC
# if HAVE_INTTYPES_H
# include <inttypes.h>
# elif HAVE_STDINT_H
# include <stdint.h>
# endif /* !HAVE_STDINT_H */
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_INT8_LOCAL int8_t
# define FRIBIDI_INT16_LOCAL int16_t
# define FRIBIDI_INT32_LOCAL int32_t
# define FRIBIDI_UINT8_LOCAL uint8_t
# define FRIBIDI_UINT16_LOCAL uint16_t
# define FRIBIDI_UINT32_LOCAL uint32_t
# else /* no int types */
# define FRIBIDI_INT8_LOCAL signed char
# define FRIBIDI_UINT8_LOCAL unsigned char
# if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4
# define FRIBIDI_INT16_LOCAL signed short
# define FRIBIDI_UINT16_LOCAL unsigned short
# define FRIBIDI_INT32_LOCAL signed int
# define FRIBIDI_UINT32_LOCAL unsigned int
# else /* SIZEOF_INT < 4 */
# define FRIBIDI_INT16_LOCAL signed int
# define FRIBIDI_UINT16_LOCAL unsigned int
# define FRIBIDI_INT32_LOCAL signed long
# define FRIBIDI_UINT32_LOCAL unsigned long
# endif /* SIZEOF_INT < 4 */
# endif /* no int types */
# define FRIBIDI_BOOLEAN_LOCAL int
# if SIZEOF_WCHAR_T >= 4
# ifndef __FRIBIDI_DOC
# if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
# else /* !STDC_HEADERS */
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif /* !HAVE_STDLIB_H */
# endif /* !STDC_HEADERS */
# endif /* !__FRIBIDI_DOC */
# define FRIBIDI_UNICHAR_LOCAL wchar_t
# else /* SIZEOF_WCHAR_T < 4 */
# define FRIBIDI_UNICHAR_LOCAL fribidi_uint32
# endif /* SIZEOF_WCHAR_T < 4 */
#endif /* !FRIBIDI_USE_GLIB */
#if FRIBIDI_INT_TYPES+0
#else
# define FRIBIDI_INT8 FRIBIDI_INT8_LOCAL
# define FRIBIDI_INT16 FRIBIDI_INT16_LOCAL
# define FRIBIDI_INT32 FRIBIDI_INT32_LOCAL
# define FRIBIDI_UINT8 FRIBIDI_UINT8_LOCAL
# define FRIBIDI_UINT16 FRIBIDI_UINT16_LOCAL
# define FRIBIDI_UINT32 FRIBIDI_UINT32_LOCAL
#endif /* !FRIBIDI_INT_TYPES */
#ifndef FRIBIDI_BOOLEAN
# define FRIBIDI_BOOLEAN FRIBIDI_BOOLEAN_LOCAL
#endif /* !FRIBIDI_BOOLEAN */
#ifndef FRIBIDI_UNICHAR
# define FRIBIDI_UNICHAR FRIBIDI_UNICHAR_LOCAL
#endif /* !FRIBIDI_UNICHAR */
#ifndef FRIBIDI_STR_INDEX
# define FRIBIDI_STR_INDEX int
#endif /* FRIBIDI_STR_INDEX */
typedef FRIBIDI_UINT8 fribidi_int8;
typedef FRIBIDI_INT16 fribidi_int16;
typedef FRIBIDI_INT32 fribidi_int32;
typedef FRIBIDI_UINT8 fribidi_uint8;
typedef FRIBIDI_UINT16 fribidi_uint16;
typedef FRIBIDI_UINT32 fribidi_uint32;
typedef FRIBIDI_BOOLEAN fribidi_boolean;
typedef FRIBIDI_UNICHAR FriBidiChar;
typedef FRIBIDI_STR_INDEX FriBidiStrIndex;
#ifndef FRIBIDI_MAX_STRING_LENGTH
# define FRIBIDI_MAX_STRING_LENGTH (sizeof (FriBidiStrIndex) == 2 ? \
0x7FFF : (sizeof (FriBidiStrIndex) == 1 ? \
0x7F : 0x7FFFFFFFL))
#endif
/* A few macros for working with bits */
#define FRIBIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0)
#define FRIBIDI_INCLUDE_BITS(x, mask) ((x) | (mask))
#define FRIBIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask))
#define FRIBIDI_SET_BITS(x, mask) ((x) |= (mask))
#define FRIBIDI_UNSET_BITS(x, mask) ((x) &= ~(mask))
#define FRIBIDI_ADJUST_BITS(x, mask, cond) \
((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0))
#define FRIBIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \
FRIBIDI_TEST_BITS(FRIBIDI_ADJUST_BITS((x), (mask), (cond)), (mask))
#include "fribidi-enddecls.h"
#endif /* !_FRIBIDI_TYPES_H */
/* Editor directions:
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
*/
|
def gen_scrolling_frame(parent, **canvas_options):
def onFrameConfigure(canvas):
canvas.configure(scrollregion=canvas.bbox('all'))
canvas = tk.Canvas(parent, **canvas_options)
frame = tk.Frame(canvas)
vsb = tk.Scrollbar(parent, orient='vertical', command=canvas.yview)
canvas.configure(yscrollcommand=vsb.set)
vsb.pack(side='right', fill='y')
canvas.pack(side='left', fill='both', expand=1)
canvas.create_window((0,0), window=frame, anchor='nw')
frame.bind('<Configure>',
lambda event, canvas=canvas: onFrameConfigure(canvas))
return frame
|
def findPackagePath(modulePath):
p = modulePath
l = [p.basename().split(".")[0]]
while p.parent() != p:
for extension in ['py', 'pyc', 'pyo', 'pyd', 'dll']:
sib = p.sibling("__init__."+extension)
if sib.exists():
p = p.parent()
l.insert(0, p.basename())
break
else:
return p.parent(), '.'.join(l)
|
//Destroy, pause, resume and button stuff
public void onDestroy() {
super.onDestroy();
buttonSelector.stopListening();
endActivity();
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
vector<string> arr[10];
bool is_sqr(int n) {return ceil(double(sqrt(n))) == int(sqrt(n));}
bool search_sqr(string s)
{
int num = 0;
for(char c:s)
{
num *= 10;
num += c - '0';
}
for(int a = 0; a < s.size(); a++)
{
string temp = "";
temp += s[a];
arr[0].push_back(temp);
for(int b = a + 1; b < s.size(); b++)
{
arr[1].push_back(arr[0].back() + s[b]);
for(int c = b + 1; c < s.size(); c++)
{
arr[2].push_back(arr[1].back() + s[c]);
for(int d = c + 1; d < s.size(); d++)
{
arr[3].push_back(arr[2].back() + s[d]);
for(int e = d + 1; e < s.size(); e++)
{
arr[4].push_back(arr[3].back() + s[e]);
for(int f = e + 1; f < s.size(); f++)
{
arr[5].push_back(arr[4].back() + s[f]);
for(int g = f + 1; g < s.size(); g++)
{
arr[6].push_back(arr[5].back() + s[g]);
for(int k = g + 1; k < s.size(); k++)
{
arr[7].push_back(arr[6].back() + s[k]);
}
}
}
}
}
}
}
}
return is_sqr(num);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> s;
if(search_sqr(s))
{
cout << 0 << endl;
return 0;
}
else
{
for(int i = s.size() - 1; i >= 0; i--)
{
for(int j = 0; j < arr[i].size(); j++)
{
int num = 0;
for(int k = 0; k < arr[i][j].size(); k++)
{
num*=10;
num += int(arr[i][j][k] - '0');
}
if(is_sqr(num) && arr[i][j][0] != '0')
{
cout << s.size() - i - 1 << endl;
return 0;
}
}
}
}
cout << -1 << endl;
return 0;
}
|
// init() reinitializes an existing Machine for re-use on a new input.
void init(int ncap) {
this.ncap = ncap;
if (ncap > matchcap.length) {
initNewCap(ncap);
} else {
resetCap(ncap);
}
}
|
package com.leetcode.algorithm.medium.compareversionnumbers;
class Solution {
public int compareVersion(String version1, String version2) {
String[] vers1 = version1.split("\\.");
String[] vers2 = version2.split("\\.");
int i = 0;
while (i < vers1.length || i < vers2.length) {
int num1 = i < vers1.length ? Integer.valueOf(vers1[i]) : 0;
int num2 = i < vers2.length ? Integer.valueOf(vers2[i]) : 0;
if (num1 != num2) {
return Integer.compare(num1, num2);
}
i++;
}
return 0;
}
}
|
<reponame>emp-toolkit/emp-pvc<filename>emp-pvc/gc_commit_gen.h<gh_stars>10-100
#pragma once
#include "emp-pvc/hash_array.h"
#include "emp-pvc/gc_hash_io.h"
#include <emp-tool/utils/com.h>
#include <emp-tool/gc/halfgate_gen.h>
#include <emp-tool/io/hash_io_channel.h>
#include <emp-tool/execution/protocol_execution.h>
#include <cstring>
namespace emp {
class GCCommitGen : public ProtocolExecution {
public:
using io_t = GCHashIO;
using garbler_t = HalfGateGen<io_t>;
PRG prg;
PRG prv_prg;
GCCommitGen(io_t *io, garbler_t *gc, block *seed = nullptr)
: ProtocolExecution(ALICE),
io_(io),
gc_(gc)
{
reseed(seed);
}
~GCCommitGen() {}
// same order as InternalGen
void reseed(block *base_seed) {
PRG rndness(base_seed);
block sd;
rndness.random_block(&sd, 1);
prg.reseed(&sd);
rndness.random_block(&sd, 1);
gc_->set_delta(sd);
rndness.random_block(&sd, 1);
prv_prg.reseed(&sd);
/* no ot */
}
void feed(block * label, int party, const bool* b, int len) override {
prv_prg.random_block(label, len);
}
void reveal(bool*, int , const block *, int ) override {
}
void commit(Decom decom, Com com) {
uint8_t buf[Hash::DIGEST_SIZE];
io_->get_digest((char *)&buf[0]);
block seed;
prg.random_block(&seed, 1);
Commitment commiter;
commiter.prg.reseed(&seed);
commiter.commit(decom, com, buf, sizeof(buf));
if (hsh_gc_)
std::memcpy(hsh_gc_->data(), buf, Hash::DIGEST_SIZE);
}
void use(hash_t *h) { hsh_gc_ = h; }
private:
hash_t *hsh_gc_ = nullptr;
io_t *io_ = nullptr;
garbler_t *gc_ = nullptr;
};
} // namespace emp
|
/**
* An abstraction of the statements making up the body of a method. A statement
* has a defined Statement Type and its unique qualitfied name is a combination
* of that type and a separate long integer representing the count of that
* statement type within the system.
*
* @author Isaac Griffith
* @version 1.1.0
*/
public class StatementNode extends CodeNode {
/**
* The next valid IDNum
*/
private static long nextIDNum = 0;
/**
* The type of this statement
*/
@Expose
private StatementType type;
/**
* Constructs a new StatementNode with the given type.
*
* @param type
* The StatementNode's tyupe
*/
protected StatementNode(StatementType type)
{
super(type + ":" + nextIDNum++, type.toString());
this.type = type;
}
/**
* @return StatementType of this StatementNode
*/
public StatementType getStatementType()
{
return type;
}
/**
* {@inheritDoc}
*/
@Override
public String getType()
{
return INodeType.STATEMENT;
}
/**
* {@inheritDoc}
*/
@Override
public void update(INode c)
{
if (c == null)
return;
if (c instanceof StatementNode && c.getQIdentifier().equals(this.getQIdentifier()))
{
StatementNode s = (StatementNode) c;
setRange(s.getStart(), s.getEnd());
}
}
/**
* {@inheritDoc}
*/
@Override
public StatementNode cloneNoChildren()
{
StatementNode fnode = new StatementNode(this.type);
fnode.setRange(this.getStart(), this.getEnd());
copyMetrics(fnode);
return fnode;
}
/**
* {@inheritDoc}
*/
@Override
protected StatementNode clone() throws CloneNotSupportedException
{
return cloneNoChildren();
}
/**
* {@inheritDoc}
*/
@Override
protected void finalize() throws Throwable
{
// TODO Auto-generated method stub
super.finalize();
}
/**
* Updates the nextIDNum static field to the one provided if the provided
* value is greater than or equal to the current value. This method should
* only be used during deserialization.
*
* @param num
* New nextIDNum
*/
public static void setNextIDNum(long num)
{
if (num < nextIDNum)
return;
nextIDNum = num;
}
/**
* Constructs a new Builder for a StatementNode with the given
* StatementType
*
* @param type
* Type of the Node to be built.
* @return The StatementNode.Builder instance
*/
public static Builder builder(StatementType type)
{
return new Builder(type);
}
/**
* Builder for Statements implemented using the fluent interface and method
* chaining patterns.
*
* @author Isaac Griffith
* @version 1.1.0
*/
public static class Builder {
/**
* StatementNode to be constructed.
*/
private StatementNode node;
/**
* Constructs a new Builder for a StatementNode with the given
* StatementType
*
* @param type
* Type of the Node to be built.
*/
private Builder(StatementType type)
{
node = new StatementNode(type);
}
/**
* @return The newly built StatementNode
*/
public StatementNode create()
{
return node;
}
/**
* Sets the line range of the new statement to be between the given
* start and end values.
*
* @param start
* Starting line value
* @param end
* Ending line value
* @return this
*/
public Builder range(int start, int end)
{
node.setRange(start, end);
return this;
}
/**
* Sets the line range of this new statement, assmuming that the
* statement only spans a single line
*
* @param line
* Line on which the statement resides in its containing
* file.
* @return this
*/
public Builder range(int line)
{
return range(line, line);
}
/**
* Sets the qualified identifier of the parent for this statement
*
* @param pID
* Parent's qualified identifier
* @return this
*/
public Builder parent(String pID)
{
node.setParentID(pID);
return this;
}
}
}
|
A recent hard drive raid has gifted us a glimpse into the world of Noa Deane, Gold Coaster, fabulous straight air junkie. Inspired by skate parts so full of bangers that re-watching is an absolute must, Pulp is the new Rusty short by Noa and filmmaker Shane Fletcher, a greyscale assault of deep (and often thick) tubes, wonderfully unpolished rail surfing, and the boned straight airs that Noa has made his signature.
Mr Deane is a polarising character in surfing, but he makes it hard to be a non-fan, not only with the fact that he’ll talk shit with absolutely anyone (and do it well), but also with his raw and relentless attack on a wave. Pulp is a culmination of this attack over the past few months, an unapologetic work that’ll achieve the aim of making you wanna surf.
|
/**
* Initialize the Compressor object.
* This method is the common initialization code for all the constructors for the Compressor
* object. It takes the relay channel and pressure switch channel and spawns a task that polls the
* compressor and sensor.
*
* You MUST start the compressor by calling the Start() method.
*/
void Compressor::InitCompressor(uint8_t pressureSwitchModuleNumber,
uint32_t pressureSwitchChannel,
uint8_t compresssorRelayModuleNumber,
uint32_t compressorRelayChannel)
{
m_table = NULL;
m_enabled = false;
m_pressureSwitch = new DigitalInput(pressureSwitchModuleNumber, pressureSwitchChannel);
m_relay = new Relay(compresssorRelayModuleNumber, compressorRelayChannel, Relay::kForwardOnly);
nUsageReporting::report(nUsageReporting::kResourceType_Compressor, 0);
if (!m_task.Start((int32_t)this))
{
wpi_setWPIError(CompressorTaskError);
}
}
|
CLOSE Sports writers Randy Peterson and Tommy Birch break down Iowa State's matchup against No. 3 Oklahoma.
Buy Photo Iowa sophomore defensive end Anthony Nelson puts a hit on Iowa State quarterback Jacob Park on Saturday, Sept. 9, 2017, at Jack Trice Stadium in Ames, Iowa. (Photo: Bryon Houlgrave/The Register)Buy Photo
NORMAN, Okla. — Iowa State starting quarterback Jacob Park has taken a personal leave from the team and his return is unknown, the Register has learned.
Park is still on the team, Iowa State officials confirmed to the Register, but will not play Saturday — and potentially beyond — as he deals with unspecified medical issues.
“Jacob is a great young man dealing with some personal medical concerns,” Iowa State coach Matt Campbell said in a statement first obtained by the Register on Friday. “We are committed to helping him cope, supporting him on all levels and helping him prepare to get back on the playing field with his teammates as soon as possible.”
It's unknown at the moment who will take over for Park as the starting QB.
Campbell was not certain of a timeline for Park’s return. In the release, he noted that he cannot discuss medical issues pertaining to his players.
“We are focused on helping Jacob in any way we can,” Campbell said. “I know how important the football team is to Jacob and how important Jacob is to the football team. But supporting one another in difficult times is where we need to be.”
Park, a redshirt junior, has thrown for 1,181 yards, nine touchdowns and five interceptions this season. He’s coming off his worst performance of the season when he completed just 24 of 48 passes for 246 yards and three interceptions in a loss to Texas.
READ CYCLONE NEWS FOR FREE: Download the Cyclone Insider app for Download the Cyclone Insider app for iPhone Android and follow us on Facebook.
Park did not travel with the team for Iowa State's Big 12 Conference contest with No. 3 Oklahoma on Saturday. Campbell has previously refuted rumors that Park is suspended.
A former blue-chip recruit, Park began his college career at Georgia. He transferred to Trident Technical College in South Carolina — a school that doesn’t even have a football program, keeping in shape by playing in a church football league with friends. Park later attended Northeast Oklahoma A&M, where he attended school and joined the football team, but never played.
Buy Photo Iowa State junior quarterback Jacob Park poses for a portrait during the Iowa State football team media day at Bergstrom Indoor Practice Facility on the Iowa State campus in Ames on Thursday, Aug. 3, 2017. (Photo: Bryon Houlgrave/The Register)
The 2016 season began with Park on the bench as starter Joel Lanning’s backup. The two eventually shared snaps before Park took over the starting spot at the end of the season.
Park entered this season as the clear-cut starter and the centerpiece of Campbell's rebuild at Iowa State. The Cyclones had so much faith in him that they moved Lanning to linebacker, leaving unknowns Zeb Noland and Kyle Kempt as his top back-ups.
Park, who became a father in the offseason, talked about how important it was for him to succeed and achieve his dream of playing in the NFL.
“Me having a kid, I have to make it to that step or my life won’t be the way I want it to be,” Park said in an interview with the Register in March. “It’s coming down to almost a do-or-die situation, and I can’t fail.”
After a strong start to the season, Park struggled against the Longhorns last week and was emotional on the sidelines. Campbell stood by Park during his weekly press conference in Ames on Monday.
“I don’t worry too much about Jacob Park,” Campbell said at the time. “He’s got a nice little swagger about him. I think he’ll be ready to rock and roll.”
By Friday, though, Park was away from the team.
Noland has played just one game and failed to complete the lone pass he’s thrown. Kempt played in just one game this season at Akron.
Kempt has the most experience of the two. He began his career at Oregon State and transferred to Hutchinson Community College. Kempt played in two games last season, completing both of his 2 passes, for 15 yards.
Then there's Lanning, who is listed as a starter at middle linebacker but also got playing time on offense this season.
|
// Handling errors that can occur while Sign Up request
private void errorHandlerRegister(VolleyError error) {
if (error instanceof AuthFailureError) {
Toast.makeText(this, "User already exists", Toast.LENGTH_SHORT).show();
return;
}
VolleySingleton.getInstance(Register.this).checkCauseOfError(error);
}
|
<gh_stars>1-10
import path from 'path';
import prompts, { PromptType } from 'prompts';
export async function readRepoName(): Promise<string | undefined> {
const { create, repoName } = await prompts(
[
{
type: 'confirm',
name: 'create',
message: 'Use git?',
initial: true,
},
{
type: (prev: boolean) => (prev ? 'text' : null) as PromptType,
name: 'repoName',
message: 'Repo name?',
initial: path.basename(process.cwd()).toLowerCase().replace(/\W+/g, '-'),
validate: (value) =>
/[^\w-]/.test(value) ? 'Can only contain letters, numbers, underscores and hyphens' : true,
},
],
{
onCancel: () => {
throw Error('Aborted.');
},
},
);
return create ? repoName : undefined;
}
|
Secret witness claims Ukrainian Su-25 downed Malaysian Boeing MH17
A secret witness claims that it was a Ukrainian Su-25 aircraft that downed the Malaysian Boeing, flight MH-17, near Donetsk, in the summer of 2014. The Komsomolskaya Pravda newspaper, whose journalists interviewed the unnamed witness, said that on July 17, two Ukrainian military aircraft were shot down in the war zone, and the pilot of the third fighter jet fired an air-to-air missile into the Malaysian Boeing.
The man claims that on that day of the tragedy, he was staying on the air base in the village of Aviatorskoe, near Dnepropetrovsk. He could see what weapons the departing and returning warplanes were flying with. He could also hear comments from pilots.
According to him, there were two aircraft that were outfitted with air-to-air missiles. Earlier, the ammunition had been decommissioned, although later, in connection with an "urgent order," the resource was extended. "No, he could not mix it up. The missiles differ in size, fin assembly and coloration. It is very easy to identify them. After a while, only one plane returned, two others were shot down somewhere in the east of Ukraine, as I was told. Only one plane returned, on which those missiles had been mounted. The aircraft returned without the missiles. The pilot was very scared," the unnamed witness told the Komsomolskaya Pravda newspaper.
The witness believes that the man, who shot down the passenger plane, was captain Vladislav Voloshin, from the city of Nikolaev. "I know the pilot a little. It is quite possible that when two fighters were shot down in front of his eyes, he could fire the missiles out of freight or revenge. Maybe he took it for some other combat aircraft," the witness said.
"The phrase that he said when he was taken off the plane was: "The wrong plane." Later in the evening, another pilot asked Voloshin what happened to the plane. He replied: "The plane was in the wrong place at the wrong time."
The man, who allegedly was staying at the air base near Dnepropetrovsk on July 17, said that representatives of the Kiev authorities lied when they said that there were no sorties made the day, when the Malaysian Boeing was shot down above Ukraine. According to him, warplanes would fly operationally every day, including during the truce. He also said that the Ukrainian aviation used volume-detonating and cluster bombs.
The man decided to come to Russia and talk to journalists, because the Security Service of Ukraine and the National Guard intimidated everyone in Ukraine. "People can be beaten for any careless word they say. They can be jailed for any insignificant suspicion of being sympathetic to Russia or the militia," the man said.
Representatives of the Defense Ministry of the People's Republic of Donetsk said that all reasoned and unbiased people believed from the beginning that it was a Ukrainian fight jet that downed the Boeing, RIA Novosti reports.
"The witness, whom the journalists found, only confirmed some details of the event. We hope that the witness will be able to speak at court against those guilty of the tragedy," Donetsk officials added. "Now we know the executor of the crime, and it is very important to bring the perpetrators to justice," they added.
Noteworthy, the valuable witness could receive a reward of 30 million dollars, if he addressed to a private German detective agency that investigates the crash of the Malaysian Boeing. The reward for the information that could shed light on the circumstances of the crash of the Malaysian Boeing, flight MH-17, was announced in September.
The crash of Boeing 777 of Malaysia Airlines, en route from Amsterdam to Kuala Lumpur, took place on July 17 about in the Donbass region of Ukraine at 16:20 local time. Supposedly, the plane was shot down at an altitude of over 9,000 meters. All passengers and crew of the Malaysian Boeing - 298 people - were killed in the crash. The first investigation report prepared by the Security Council of the Netherlands was published in early September. The document did not provide any specific conclusions onto why the passenger jetliner collapsed in the air.
Pravda.Ru
|
THE MAJORITY OF begging in Dublin city centre is of an organised nature, the head of an organisation representing thousands of businesses in the capital has said.
Richard Guiney, the head of DublinTown, said that current begging legislation “isn’t worth the paper it’s written on” and called on the government to do more to tackle the problem.
“Certainly we would see that the majority of the begging in the city would be of an organised nature,” he told reporters on O’Connell Street this morning.
Guiney went on to say that it is the biggest issue in the city today, saying it is “definitely impacting on people’s enjoyment of the city”.
He added: “We would see pitches in the city that are basically one person goes, another person comes and there’s a bit of interaction – it’s almost a changing of the shifts.
“We would also have observed people collecting money from people who are begging on the street. It’s like a cash collection in a shop and certainly prima facie [evidence] from where we’re at.”
He was speaking at the launch of DublinTown, the new name for the Dublin City Business Improvement District (BID) which is made up of 2,500 businesses in the capital’s city centre.
Dublin City BID was established six years ago with the aim of winning back customers in the wake of the financial collapse and providing a strong city destination for tourists.
Guiney said the name change made sense given that most people living in the capital refer to the city centre as “town”. “It has an awful lot of resonance with the general public,” he said.
He also said he supported the Lord Mayor Christy Burke’s call for a task force to tackle the drugs problem in the city but Guiney claimed that despite its reputation O’Connell Street is “probably one of the safest streets” in the capital.
“It’s an extremely safe street,” he said while acknowledging there is a “reputational” and “perception” issue.
Guiney claimed that there were just 18 assaults on the busy city centre street last year out of a footfall of around 27.5 million people. He said that most of the people involved in the assaults knew each other.
What do you think? Let us know in the comments
|
/*
* VNODE backend
*
* This is used mainly for network filesystem (read: probably only tested
* with NFS) swapfiles.
*
*/
static void
swapdev_strategy(struct buf *bp, struct swdevt *sp)
{
struct vnode *vp2;
bp->b_blkno = ctodb(bp->b_blkno - sp->sw_first);
vp2 = sp->sw_id;
vhold(vp2);
if (bp->b_iocmd == BIO_WRITE) {
if (bp->b_bufobj)
bufobj_wdrop(bp->b_bufobj);
bufobj_wref(&vp2->v_bufobj);
}
if (bp->b_bufobj != &vp2->v_bufobj)
bp->b_bufobj = &vp2->v_bufobj;
bp->b_vp = vp2;
bp->b_iooffset = dbtob(bp->b_blkno);
bstrategy(bp);
return;
}
|
//*****************************************************************************
//
// Handles paint requests for the introduction canvas widget.
//
//*****************************************************************************
void
OnIntroPaint(tWidget *pWidget, tContext *pContext)
{
GrContextFontSet(pContext, g_pFontCmss18);
GrContextForegroundSet(pContext, ClrSilver);
GrStringDraw(pContext,
"This application demonstrates the Stellaris Graphics",
-1, 0, 32, 0);
GrStringDraw(pContext, "Library.", -1, 0, 50, 0);
GrStringDraw(pContext,
"Each panel shows a different feature of the",
-1, 0, 76, 0);
GrStringDraw(pContext,
"graphics library. Widgets on the panels are fully",
-1, 0, 94, 0);
GrStringDraw(pContext,
"operational; pressing them will result in visible",
-1, 0, 112, 0);
GrStringDraw(pContext,
"feedback of some kind. Press the + and -",
-1, 0, 130, 0);
GrStringDraw(pContext,
"buttons to move between the panels",
-1, 0, 148, 0);
}
|
/**
* Used to write the state of the GrantId instance to disk, when we are
* persisting the state of the NodeManager
* @param jsonGenerator The JsonGenerator instance being used to write JSON
* to disk
* @throws IOException
*/
public void write(JsonGenerator jsonGenerator) throws IOException {
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField("sessionId", sessionId);
jsonGenerator.writeObjectField("requestId", requestId);
jsonGenerator.writeEndObject();
}
|
import * as React from 'react'
import userEvent from '@testing-library/user-event'
import { Route } from 'react-router-dom'
import { renderWithRouter, screen } from 'support/test-utils'
import { buildBridges } from 'support/factories/gql/fetchBridges'
import { BridgesView, Props as BridgesViewProps } from './BridgesView'
const { getAllByRole, getByText, findByText, queryByText } = screen
function renderComponent(viewProps: BridgesViewProps) {
renderWithRouter(
<>
<Route exact path="/bridges">
<BridgesView {...viewProps} />
</Route>
<Route exact path="/bridges/new">
New Bridge Page
</Route>
</>,
{ initialEntries: ['/bridges'] },
)
}
describe('BridgesView', () => {
it('renders the bridges table', () => {
const bridges = buildBridges()
renderComponent({
bridges,
total: bridges.length,
page: 1,
pageSize: 10,
})
expect(getAllByRole('row')).toHaveLength(3)
expect(queryByText('Name')).toBeInTheDocument()
expect(queryByText('URL')).toBeInTheDocument()
expect(queryByText('Default Confirmations')).toBeInTheDocument()
expect(queryByText('Minimum Contract Payment')).toBeInTheDocument()
expect(queryByText('bridge-api1')).toBeInTheDocument()
expect(queryByText('http://bridge1.com')).toBeInTheDocument()
expect(queryByText('1')).toBeInTheDocument()
expect(queryByText('100')).toBeInTheDocument()
expect(queryByText('bridge-api2')).toBeInTheDocument()
expect(queryByText('http://bridge2.com')).toBeInTheDocument()
expect(queryByText('2')).toBeInTheDocument()
expect(queryByText('200')).toBeInTheDocument()
expect(queryByText('1-2 of 2'))
})
it('navigates to the new bridge page', async () => {
const bridges = buildBridges()
renderComponent({
bridges,
total: bridges.length,
page: 1,
pageSize: 10,
})
userEvent.click(getByText(/new bridge/i))
expect(await findByText('New Bridge Page')).toBeInTheDocument()
})
})
|
<gh_stars>1-10
import { Remote } from "electron";
export default function useRemote(): Remote {
if (/electron\/(\d+\.\d+\.\d+)/i.test(navigator.userAgent)) {
let electron = window.require("electron");
if (!electron.remote) {
throw new Error("Be sure that enableRemoteMenu is to true");
}
return electron.remote;
} else {
throw new Error(
"Not inside a electron process, please use useElectron to ensure that!"
);
}
}
|
This post is a transcript of Around The ‘Verse – Episode 2.04, material that is the intellectual property of Cloud Imperium Games (CIG) and it’s subsidiaries. INN is a Star Citizen fansite and is not officially affiliated with CIG, but we reprint their materials with permission as a service to the community. INN edits our transcripts for the purpose of making the various show participants easier to understand in writing. Enjoy!
Around The ‘Verse – Episode 2.04 – Incomplete Transcripts
Empire Report
– Anti-Xi’An Angst
– Bananas. Have we eaten our last one?
– Original Systems kicks off A-com, an Arena Commander competition.
01:25 – Intro
SG: hey everybody welcome back to Around the Verse I’m Sandi Gardiner.
BL: I’m Ben Lesnick
SG: This week on the ATV Interview Tom sits down with vehicle artist Paul Dalessi to talk about working at Foundry 42.
BL: And we take a Behind the Scenes look at the process behind Star Citizen Alpha 2.0 demo you all saw at CitizenCon. But first Sandi’s home!
SG: Sandi is home and I had a great time in the UK; CitizenCon was awesome; first time I’ve ever received a standing ovation for anything.
BL: I’ll [something something] one right now [something something]
SG: It was kind of overwhelming. I got lots of flowers and compliments and …
BL: You’re not resigning right?
SG: No, there’s no resigning. Can you imagine you start an event and say “Hey everybody, welcome to the event, let’s have a good time. I’m resigning.”
BL: The important question we have here is “What was the food like?”
SG: What was the food? I’ didn’t actually get to eat any food, I was so busy that I didn’t even see what the food was. I think I maybe had one shrimp, crumb shrimp but I didn’t really get a chance.
SG: Big developments on the road to Star Citizen Alpha 2.0, patch 1.3 is currently available on the PTU.
BL: 1.3: it’s their steam merge version so it’s a big deal under the hood. We’ve also added a couple of new weapons and so on to the release that you can play around with. Starting this last weekend on the PTU we are making specific ships, weapons and so on available for free so people can test them and give their feedback without having to spend REC or UEC to unlock them. So this last week we unlocked the Cutlass and the Hornet, as well as the new weapons, so if you are on the PTU go out and test those!
SG: Also our concept sale for the Aegis Sabre is now over and everybody seems to have really liked it. It sold like hot potatoes!
BL: Yes! Yes it did. The Sabre is our new medium fighter. It’s midway between the Gladius and the Hornet, not quite as heavily armoured as the horned but it has more maneuverability and better speed. And we’re excited to put it into the game. Fast track for that so you’ll be seeing more of the Sabre in the not too distant future.
SG: And now let’s check in with News from Around the Verse.
03:44 – News From Around the Verse
Santa Monica – Darian Vorlick and Eric Kieron Davis
– sent out 1.3.0 PTU on their end. Give them feedback on how balance is.
– Gurmukh is working on the P-72 Archimedes concept, the ‘racer’ variant of the Merlin.
– It’s a luxury, racer version of the Merlin. More speed, less attack options.
– Mark Abent is working on optimizing the Radar system, make it more accurately give feedback.
– They found a bug where the pilots head would block the rest of the ship from being detected by the radar, so they’re optimizing things like that. Make it more streamlined and tactile.
6:00 – Austin – Jason Hutchins
– Jake Ross is on a short vacation, so we get Jason Hutchins.
– No more Denver updates because Illfonic has finished their part of the work. They’ve got some new projects though. Check out their link for Friday the 13th the game.
– in Austin, teams are working on SC 1.3, which went to PTU and is updating more constantly.
– Concept artists are working more on clothing lines and props. Some of those’ll be visible in jump point.
– Also working on hairstyles, Million Mile High club, animations for SC 2.0, the female locomotion set (which should wrap up and start testing in a few weeks)
– Jason’s now going to go playtest FPS more.
7:40 – F42 UK – Mike Snowdon and Adam Stephens
– Mike has been working on ship damage effects, specifically iterating on the effects, trying to theme explosions and damage based on ship manufacturers.
– Tali and Connie have different styles of explosions. Getting that working nicely.
– Adam’s been tasked with doing environmental and ambient interior effects for interiors we’ll explore on the AC 2.0 release. Anything that would make the environments look different; thematic to the state of the environment.
– Can give mood – dust, clean environments, stuff like that.
9:15 – Frankfurt – Brian Chambers and Jason Cole
– Lots of the team is working on optimizations, working on keeping code clean and responsive.
– More work on procedural planet tech. Not sure when we’ll see it first, but they’re making good progress on atmospherics as far as when you’re coming into the planet.
– AI’s done some stuff, supporting AI code in zone systems, working on extending AI ship nav so they can dynamically navigate around asteroids and such.
– Jason will talk about the Bishop speech from Cit Con
– Cinematic team did a great job on that. The level still isn’t final, it was a testing ground for the AI systems and animations, so it’ll keep growing.
– Lots of the work they did created the foundation that allowed characters simultaneously with body, face, audio, etc…
– Now it’s going and growing. Lots of stuff they couldn’t even show at Cit Con, but there are layering animations on top of AI and such. Lots of extra stuff.
Fan Video – The Twilight Zone
13:02 – Interview with Paul Dalessi
MH: Thanks guys! I’m here today with Paul Dalessi from foundry 42 UK. Paul is a vehicle artist here, how are you going man?
PD: I’m doing good, it’s good to be here
MH: Yeah It’s good to see you again actually, we have a bit of a similar tie to CIG is that we both got started on the next great starship, I worked as a camera operator on that show. You
PD:I was a contestant
MH: A contestant, more than a contests, you were on the 4 horsemen, the winning team!
PH: Yes I was!
MH: What was like that?
PD: A lot of fun, very intense, a lot of hard work, quite a rewarding experience
MH: Thirty thousand dollars rewarding huh? Did you buy anything cool with prize money?
PD: Actually I bought an Oculus Rift dev kit.
MH: Very nice, cool! and so now here you are, basically you started out doing it for that thing which was a contest doing it for fun so to speak, here you are making a living, working, helping us make spaceships, what’s that transition been like
PD: For me specifically it wasn’t that much of a transition because I’ve been working in this industry for almost a decade at this point. Previous to doing the next great starship I wrapped up working on Ryse. After that what happened what me and a friend wanted to do a bit of a collaborating personal project, we decided we wanted to make a spaceship sort of thing. At the same time the next great starship popped up so we figured we might as well do that and that’s it, the rest is history.
MH: Wow, that’s super cool man! So now you’ve been here how long?
PD: At this point I’ve been here about 6 months
MH Okay, and what are you working on now?
PD: Right now I’m working on taking the Vanguard to hangar ready,
MH: Oh cool! So you know we just had seen some concept work for the Vanguard, Gurmukh was seeing in Santa Monica get done and it’s just amazing looking artwork, so can you tell me what’s it like taking a ship from a concept phase, getting it to you and starting to make it flyable/hangar ready.
PD: In the case of the Vanguard specifically, i was given the 3D concept mesh that Gurmukh made. But usually the concept mesh is really built for the sake of making the pretty picture and it’s not built to be able to work in a game environment. so what I’m doing is I’m rebuilding the ship from the ground up for the game specifically so it can run efficiently in the game
MH: Do you work closely then with the design team at this point as well in making sure that how we’re building it for the engine how we’re building it for the game, fits with kind of the design of the gameplay elements?
PD: Exactly, there’s also of course game gameplay considerations that may or may not have been taken into account in the concept mesh. Some elements might be swapped around to make more sense in the game, simple placement like the engineering console, where the chair into the turret is going to be, how it’s all going to function you know the concept is great it really is but somethings just need to undergo redesigning to be functional in the game environment.
MH: Right so even the concept is what it is, it’s the starting point, it’s not finished until it’s in the game and everything kind of has different, right.
PD: Yes, exactly
MH: Alright so before I let you go, one last question I want to ask you. What’s going on with the Redeemer?
PD: The Redeemer is actually in the pipeline to be upgraded properly because the original Redeemer was made to look good in a video. It’s not the greatest ingame mesh in that sense so it will get you know a makeover at some point and I’m probably going to be the person that’ll have to do it.
MH: Well you know it best right?
PD: Yes
MH: Right on, well thanks for sitting down and talking a little bit with me today it was really nice to see you again after all this time, this once again Paul Dalessi, vehicle artist at Foundry 42 UK.
PD: Glad to be here
MH: Back to you guys.
19:16 – Behind the Scenes: Alpha 2.0
RJ: Hi, my name’s Ricky Jutley and I work as a project manager here at Foundry 42. My role on Star Citizen Alpha 2.0 was Lead Producer and I’m here to talk to you about how we delivered Star Citizen Alpha 2.0 at CitizenCon.
RJ: When we started thinking about all the things we wanted to do for CitizenCon, one of the things we’re thinking is “we’re building up all these features, why don’t we actually get something together for CitizenCon that’s going to be a demo that’s going to showcase all the cool stuff that we eventually want to deliver to the backers in their hands in game. Part of that was just getting together a lot of Chris’ vision and having that interpret all the way down to the designers; the artists, global lead artists that is; coders and necessary leaders of the disciplines that will actually put that stuff together. Marrying with our content complete dates that we are trying to aim for as well we were tying in the necessary high level beats that reach into the demo and my main role is to get those beats together and make sure all the disciplines on a global basis were working towards their unified breakdown goals so that we could deliver that demo to the backers on the event.
LP: Straight away we were running into the limitations of the editor. The editor is not built to do the huge coordinates we are working with now. And those were just arbitrarily capped values that Crytek had put in because they only expected developers to be making small, well relatively small, maps. So we had to knock all those caps off straight away in order to reach the billion metre play-space we have at the moment.
DS: Because we always try and push as much in as we can, there’s always a risk that you end up breaking things.
JG: And we were pushing, pushing, pushing so much that what’s going on in your mind is “what if I’ve missed something out, what if one little element in there I forgot to check in or I forgot to double check?” What if one of the guys runs through and there’s a bit of collision missing on the floor and suddenly he’s falling through into space. That sort of thing can really affect the demo, a live demo like that. Going through my mind is “hoping, hoping, hoping everything’s tight and everything works well”.
IL: Now, there’s a fair amount of content in there. The playable area is big. Now one of the main challenges from that is just how do you create that much artwork in a short space of time?
LB: I guess one of our biggest challenges from doing a demo like this, is the fact that we deal with an awful lot of change happening right up until the demo comes out. When it gets up against it, our deliverable, I find myself wearing lots of different hats so I’m not just being and audio director, I’m also helping out everyone with technical issues with whatever they are doing .
SR: With all this large world technology that we’ve been developing, the way we develop levels is interesting because we have to create a level and then we export that level to a prefabricated part of the level which is something like a space station or even just the module of a space station.
GC: As a deadline like that looms you have some many big requests coming where people want staff for Task A, Task B, Demo Run 1, 2, 3, 4; show the designers this part of the game. It’s just being able to sit there with the guys and say “right this is really important, we need to manage our time efficiently; we need to do this, we need to do that, we need to talk to production and just essentially trim out of doing”. In a way just really efficient time and staff management.
ZC: You would see me running round the studio, following up issues, trying to make sure people are working on the highest priority issues so we could fix the big bugs, unblock dev so they can carry on working; communicating with the studios to make sure we get the hand offs because we’ve really had contributions from all studios to get that to the place we wanted it to be.
IL: It was a fairly big technical challenge and that was pretty much our highest goal to achieve.
LP:: So art would do their bit and then I’d have to go in and make sure you could actually EVA through it without getting stuck in pipes or everything they did looked to the player interactable if it needed to be.
NE: We’ve got dozens and dozens of features that were all in different states, some in a very early state, but so important to get them into the hands of the community to start getting feedback at an early stage. It was concentrating on making sure that the resources were aiming in this direction and we were getting the maximum focus we could in order to get the systems as far along as we could.
IL: Everything you see in the large world map is everything from asteroids, to space stations, to moons : there’s a whole load of content in there. And my guys were responsible for creating all of that.
SR: Everyone wanted to make feel like a cool place to visit. They’ve just come from this brightly lit, welcoming environment of the station where you start in, where you spawn. And I wanted them to go to this other station and feel a little bit threatened and it’s a really cool place that you’d want to get in and explore as a player.
IL: Probably the biggest space station we’ve ever done so far so this is going to be Port Olisar that you see on the map, and it has many different landing pads and many different interiors. The real key is getting that so you can fly on your ship, land on the pad, walk in the airlock and you’ve got all the interior right there.
SR: It was .. to get those elements into it for Saturday for that release. We had a lot of things cooking in the oven.
GC: Honestly just before it started I was so nervous. I’ve never done anything like this before, I’ve never been on stage before, especially in front of so many people.
CG: As it was running I was quite terrified that the ship was never going to come out of quantum travel or travel through a planet.
NE: While it was happening, it was panic because I was editing slides with Chris, probably about 5 minutes before we were going on in typical chris style. But you know once we got going it was absolutely elation and pride, everything seemed to go really well, everyone’s reaction was positive
DS: It turned out in the end that the game was remarkably stable considering it was a demo for an event, it was very very solid.
LB: I come from mostly triple-A development where you’re locked away for years on end and the nall of a sudden the game comes out and it gets nice feedback and stuff, but to be able to actually show what we’re doing in kind of an incremental way like that and get that feedback, it’s a huge boost to what we do, it just gives you a certain amount of crazy energy to do what we’re doing
JG: When I sat there and watched it with everyone else live, it was almost like you get to a appreciate the whole thing and the all the work everyone puts into it as well.
LP: To see the fans reaction was amazing, I was like, pride was what I felt.
CG: I stood beside one of the backers and he seemed really pleased with the presentation.
SR:It’s exciting to know we did a better job than before.
DS: We all just wanted it to go smoothly, which thankfully yeah, in the end it did.
ZC: You feel like that everybody’s hard work has really been recognized and it just makes you really really motivated now get it out there, you know, you want to get it into these backers hands, you want to get people playing it and get everyone as excited as we’ve been just going through it and playing it in the first place.
GC: The cheers that went up for half the stuff we did, when adam got out of the ship into EVA and started flying towards the relay. That was unreal, absolutely unreal, just the roar that went up from the crowd, I absolutely loved it.
IL: Tears were coming down their eyes because they’re having so much fun, so many interesting things happened
NE: When talking to people later on it was such a positive reaction, it was such a buzz for everyone that had been killing themselves practically for a couple weeks running up to it, to get that out there and actually see the results.
RJ: It was a very uplifting feeling, been to a lot of events in general so you know not just game events and stuff but that event was very special and I’ll always remember that.
*Cuts back to Studio*
SG: Thanks to everyone at Foundry 42 for making that demo possible
BL: Yeah and it’s important to point out, you guys see a lot of the Santa monica team here because that’s where our community and marketing happens to be. We have 200+ Folks around the world working on Star Citizen at any time
SG: So encourage our other staff to get on camera! Because they are a little camera shy, the UK folks and the german folks, so if any of our staff are watching, please become camera friendly,
SG: And now it’s time for this week’s MVP!
28:32 – MVP
– KingNerd – realistic SC appear maps for captains and pilots.
29:22 – Art Sneak Peek
– BAM WOW BAZOOM Ben’s acting. It’s neat.
– There’s… something on screen. NO idea what it is.
– Also there’s some stuff on Xi’An tech it looks like. Nice image of the Xi’An Scout.
– Lots of cool, nifty images. Looks like the whole Xi’An Scout Style Board.
Tune in to RtV tomorrow to find out what that Sneak Peek was!
|
# -*- coding: utf-8 -*-
import logging
from discord.ext import commands
from bot import Cog
log = logging.getLogger(__name__)
IGNORED = (
commands.CommandNotFound,
commands.CheckFailure,
)
class Errors(Cog):
@Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, IGNORED):
return
if isinstance(error, commands.UserInputError):
msg = f'{ctx.author.mention} Bad argument! {error}'
elif isinstance(error, commands.MissingRequiredArgument):
msg = f'{ctx.author.mention} Missing argument! {error}.'
else:
msg = f'{ctx.author.mention} Something unexpect went wrong! Please try again later.'
if isinstance(error, commands.CommandInvokeError):
error = error.original
log.exception(
f'Unexpected error in {ctx.command.name} command by {ctx.author} {ctx.author.id}!', exc_info=error
)
await ctx.send(msg)
def setup(bot):
bot.add_cog(Errors(bot))
|
An EGF-like Protein Forms a Complex with PfRh5 and Is Required for Invasion of Human Erythrocytes by Plasmodium falciparum
Invasion of erythrocytes by Plasmodium falciparum involves a complex cascade of protein-protein interactions between parasite ligands and host receptors. The reticulocyte binding-like homologue (PfRh) protein family is involved in binding to and initiating entry of the invasive merozoite into erythrocytes. An important member of this family is PfRh5. Using ion-exchange chromatography, immunoprecipitation and mass spectroscopy, we have identified a novel cysteine-rich protein we have called P. falciparum Rh5 interacting protein (PfRipr) (PFC1045c), which forms a complex with PfRh5 in merozoites. Mature PfRipr has a molecular weight of 123 kDa with 10 epidermal growth factor-like domains and 87 cysteine residues distributed along the protein. In mature schizont stages this protein is processed into two polypeptides that associate and form a complex with PfRh5. The PfRipr protein localises to the apical end of the merozoites in micronemes whilst PfRh5 is contained within rhoptries and both are released during invasion when they form a complex that is shed into the culture supernatant. Antibodies to PfRipr1 potently inhibit merozoite attachment and invasion into human red blood cells consistent with this complex playing an essential role in this process.
Introduction
Malaria is caused by parasites from the genus Plasmodium, of which Plasmodium falciparum is associated with the most severe form of the disease in humans. Sporozoite forms of these parasites are injected into humans during mosquito feeding and they migrate to the liver where they invade hepatocytes and develop into merozoites, which are released to invade erythrocytes in the blood stream. The blood stage cycle of P. falciparum is responsible for all of the clinical symptoms associated with malaria . Once a merozoite has invaded an erythrocyte it develops, within this protected intracellular niche, to form around 16 new merozoites that are released and then bind and invade other red blood cells. Invasion of merozoites into the host erythrocyte is a rapid process involving multiple steps in a cascade of protein-protein interactions (see for review ).
Polymorphisms in the PfRh5 protein have been linked to differential virulence in infection of Aotus monkeys suggesting that amino acid changes in its binding domain can switch receptor recognition . PfRh5 has been shown to bind red blood cells but its putative receptor has not been identified . In contrast to other members of the PfRh protein family, PfRh5 is considerably smaller and lacks a transmembrane region, which combined with its role as an invasion ligand, suggests it may be part of a functional complex. It has not been possible to genetically disrupt the gene encoding PfRh5 and antibodies to it can partially inhibit merozoite invasion, pointing to an essential role of this protein in the invasion process .
The EBL family of proteins includes EBA-175 (MAL7P1.176) , EBA-181 (also known as JESEBL) (PFA0125c) , EBA-140 (also known as BAEBL) (MAL13P1.60) and EBL-1 . Whilst these parasite ligands function in merozoite invasion by binding to specific receptors on the erythrocyte, they appear to have a central role in activation of the invasion process. For example, it has been shown that binding of EBA-175 to its receptor, glycophorin A restores the basal cytosolic calcium levels after interaction of the merozoite with the erythrocyte and triggers release of rhoptry proteins and it is likely that the PfRh protein family plays a similar role .
The PfRh and EBL protein families are responsible for a mechanism of phenotypic variation that allows different strains of P. falciparum to invade erythrocytes using different patterns of host receptors . This is important for evasion of host immune responses and also provides a means to circumvent the polymorphic nature of the erythrocyte surface in the human population . Indeed, analysis of immune responses from individuals in malaria endemic areas has suggested that the PfRh proteins are targets of human invasion inhibitory antibodies and therefore a critical component of acquired protective immunity .
In order to understand the function of PfRh5 in merozoite invasion, we purified it from parasite culture supernatant and show this protein exists as a complex with a cysteine-rich protein containing 10 epidermal growth factor-like domains (PFC1045c). This novel protein functions with PfRh5 to play an essential role in invasion of merozoites into human erythrocytes.
Purification and identification of a PfRh5 complex
PfRh5 binds to erythrocytes and is functionally important in merozoite invasion of erythrocytes . Whilst other members of the PfRh family also bind erythrocytes, they have a transmembrane region, a feature that PfRh5 lacks suggesting that it may exist as a complex. In order to determine if PfRh5 was shed as a complex into culture supernatant during merozoite invasion we set out to purify it using ion-exchange chromatography. PfRh5, that had been partially purified from culture supernatant by ionexchange chromatography, migrated on SDS-PAGE gels as an approximately 45 kDa fragment as detected using 2F1, a anti-PfRh5 specific monoclonal antibody (data not shown), consistent with our previous results showing that the 63 kDa mature PfRh5 was processed in late schizonts and shed into culture supernatant during merozoite invasion . However, analysis of PfRh5 by gel-filtration chromatography revealed that the 45 kDa polypeptide was eluted in the peak (# 19-24) (Fig. 1A) which is immediately before the peak of 158 kDa bovine U-globulin (#21-25) (Fig. S1), suggesting PfRh5 is indeed in a complex with a molecular weight of approximately 150-200 kDa.
To confirm PfRh5 exists as a higher molecular weight species, blue native gel electrophoresis was performed and showed the PfRh5 migrated at an approximate molecular weight of 150-200 kDa ( Fig. 1 B). This was in contrast with the processed PfRh1 fragment that migrated at the expected size of 110 kDa (Fig. 1B) . This suggested that PfRh5 either forms a homo-oligomer or was in complex with other molecule/s. To distinguish between these possibilities, gel-filtration chromatography was used to identify the size increment of PfRh5-containing species after it was incubated with a monoclonal anti-PfRh5 antibody . It was found that pre-incubation with anti-PfRh5 antibody caused the PfRh5 protein peak to appear two fractions earlier, which correspond to an increase in size of the PfRh5-containing species by 150 kDa, indicating that one antibody molecule was associated with the complex (Fig. 1C and D). The free PfRh5 co-eluted with the excess antibody in the protein peak comprising fraction 22 to 25 (Fig. 1D), further indicating PfRh5 is in a complex of approximate 150 kDa. Therefore we proposed that the processed 45 kDa PfRh5 species formed a complex with another molecule/s rather than existing as a homo-oligomer.
To identify the proteins present within the PfRh5 complex, we performed a large-scale purification using culture supernatant from the parasite line 3D7-Rh5HA in which the PfRh5 gene had been tagged with haemagglutinin epitopes . The PfRh5 protein was enriched and partially purified using ion-exchange chromatography followed by further purification on an anti-HA affinity matrix. The bound proteins were eluted and subjected to trypsin digestion followed by analysis of the resulting peptides by mass spectrometry (LC-MS/MS) . Since powerful anion ionexchange chromatography was employed to enrich the complex and remove the majority of contaminants before it was subjected to anti-HA antibody affinity pull-down), the mass spectrometry analysis yielded a very clean result (Table S1). Database analysis identified parasite protein peptides that were predominantly derived from two proteins, which included PfRh5 and a conserved hypothetical protein (PFC1045c), designated here as P. falciparum PfRh5 interacting protein (PfRipr) ( Table 1 and Table S1). The most N-terminal peptide found for PfRh5 was amino acid 187-197, consistent with it being shed into culture supernatant as an approximately 45 kDa fragment produced by cleavage between amino acid 125 and 135 of the mature protein. In the case of PfRipr, we identified peptides from both N-terminal and C-terminal regions of the protein suggesting that the full-length protein was present within the complex and this was confirmed by co-immunoprecipitation experiments with specific antibodies (see below section). The mature form of PfRipr was 123 kDa and this together with the 45 kDa PfRh5 fragment would produce a complex with an overall molecular weight of approximately 170 kDa in agreement with the size observed by gel-filtration chromatography and blue native gel electrophoresis ( Fig. 1A and B). The PfRh5/PfRipr complex was stably purified by ion-exchange chromatography and 350 mM NaCl in the elution buffer did not disrupt their association, suggesting the tight interaction of two proteins. Such specific high affinity protein-protein interaction implies the biological significance of the complex.
PfRh5 and PfRipr form a complex in P. falciparum
In order to confirm that PfRh5 and PfRipr form a complex, we inserted a plasmid by single cross-over homologous recombination at the 39 end of the Pfripr gene to fuse three HA epitopes and derived the parasite line 3D7RiprHA ( Fig. 2A) . Successful tagging was confirmed by immunoblot experiments using anti-HA antibodies on both saponin lysed schizont pellet preparations and proteins from culture supernatants (Fig. 2B). In parasite schizont
Author Summary
The malaria parasite invades red blood cells by binding to proteins on the surface of this host cell. A family of proteins called P. falciparum reticulocyte binding-like homologue (PfRh) proteins are important for recognition of the red blood cell and activation of the invasion process. An important member of the PfRh family is PfRh5. We have identified a novel cysteine-rich protein we have called P. falciparum Rh5 interacting protein (PfRipr), which forms a complex with PfRh5 in merozoites. PfRipr has 10 epidermal growth factor-like domains and is expressed in mature schizont stages where it is processed into two polypeptides that associate and form a complex with PfRh5. The PfRipr protein localises to the apical end of the merozoites in micronemes whilst PfRh5 is contained within rhoptries and both are released during invasion when they form a complex that is released into the culture supernatant. Antibodies to PfRipr1 can potently inhibit merozoite attachment and invasion into human red blood cells consistent with this complex playing an essential role in this process. pellets a minor band of approximately 125 kDa and a major band of approximately 65 kDa were detected whereas in culture supernatants only the smaller protein band was predominantly observed. The 125 kDa protein presumably represents the fulllength mature protein in schizonts that was processed and shed into the culture supernatant. Since only one processed fragment of 65 kDa was detected in culture supernatants using anti-HA antibody, we propose that PfRipr was processed into at least two fragments of approximately the same size. Mobility of the 65 kDa fragment remains similar under the reducing and non-reducing condition (Fig. 2C) demonstrating that the processed fragments are not linked by a disulphide bond. Both 65 and 125 kDa fragments migrated slightly faster on SDS-PAGE gels under non-reducing conditions consistent with the presence of multiple intramolecular disulfide linkages creating tightly folded domains (Fig. 2C).
To further confirm that PfRh5 and PfRipr form a complex, we performed co-immunoprecipitation experiments with anti-PfRh5 and anti-HA antibodies using proteins from the parasite line 3D7RiprHA ( Fig. 2D to G). Immunoprecipitation with anti-HA antibodies, to pull-down tagged PfRipr from schizont-infected erythrocytes, also brought down PfRh5 as shown by immunoblots with a specific monoclonal anti-PfRh5 antibody (Fig. 2D). The full-length mature protein (approximately 63 kDa) as well as two processed fragments of similar molecular weight (approximately 45 kDa) was observed (Fig. 2D). The reciprocal experiment in which we immunoprecipitated PfRh5, using the monoclonal anti-PfRh5 antibody, also pulled down PfRipr (Fig. 2E, left panel) but not PfRh2a or PfRh2b, two other members of PfRh protein family (Fig. 2E, right panel). Using culture supernatants, a similar immunoprecipitation experiment with the anti-HA antibodies to pull down PfRiprHA also co-precipitated the 45 kDa doublet of PfRh5 but not PfRh2a or PfRh2b (Fig. 2F). The reciprocal experiment using culture supernatants in which anti-PfRh5 antibody was used for immunoprecipitation detected HA-tagged PfRipr but not PfRh2a or PfRh2b in the pull-down sample (Fig. 2G). As an additional control, immunoprecipitaion of the culture supernatant with rabbit anti-PfRh2a/b antibody recognizing the 85 kDa fragment of both PfRh2a and PfRh2b was performed . The anti-PfRh2a/b antibodies immunoprecipitated the 85 kDa PfRh2a/b but did not pull-down PfRh5 or PfRipr, further confirming that the PfRh5/PfRipr complex was specific. It was not possible to determine with these experiments whether the PfRipr/PfRh5 proteins associate in schizont stage parasites or at a later stage. However, since PfRh5 and PfRipr appear to be located in different compartments within the schizont (see below section), it is likely that they form a complex during detergent extraction as has been shown for the AMA1 and RON complex .
PfRipr is a cysteine-rich protein that contains epidermal growth factor-like domains PfRipr is highly conserved in Plasmodium spp. and the gene is syntenic with other genes, all of which are annotated as hypothetical (http://plasmodb.org). The full-length PfRipr protein consists of 1,086 amino acids with a molecular weight of 126 kDa. It has a putative hydrophobic signal sequence at the N-terminus consistent with it being secreted and the rest of the protein contains 87 cysteine-residues, many of which are clustered in epidermal growth factor (EGF)-like domains ( Fig. 3A and B). There are ten EGF-like domains in the protein with two in the N-terminal region and eight clustered towards the C-terminus (Fig. 3A). An EGF domain has 6 cysteine residues and the position of each is relatively conserved in the ten EGF-like domains of PfRipr (Fig. 3B) . Processing of PfRipr occurs in the area between the second and third EGF-like domain (Fig. 3A); however, the processed N-and C-terminal regions remain associated as peptides from both regions were obtained in the mass spectrometry analysis of the immunoprecipitated PfRh5/PfRipr complex (Table 1) and the two regions were co-immunoprecipitated (see below).
The N-and C-terminal domains of PfRipr form a complex
To provide additional tools to probe the function of PfRh5/ PfRipr complex, we expressed amino acids 238-368 of PfRipr that encompass the two EGF-like domains in the N-terminus as well as monoclonal anti-PfRh5 antibody before loading onto the same Superdex 200 column. The peak of the eluted PfRh5 protein lies at two preceding fractions as compared to panel C, corresponding to an increase in molecular weight of ,150 kDa indicating that one antibody molecule was bound to the PfRh5-containing species. The monoclonal antibody-bound PfRh5 is indicated by an arrow. PfRh5 and the immunoglobulin heavy and light chain of antibody seen in fraction #22-25 are the free PfRh5 complex and the excess antibody. The asterisks refer to cross-hybridising bands corresponding to the immunoglobulin heavy and light chain. doi:10.1371/journal.ppat.1002199.g001 Table 1. Peptides identified by Mass spectrometry from purified PfRh5. amino acids 791-900 of PfRir that encompass two EGF-like domains in the C-terminus (Fig. 3A), in E. coli as a recombinant protein tagged at the N-terminus with six histidines. The recombinant proteins of approximately 17 kDa were purified ( Fig. 4A) and used to immunise rabbits. The anti-PfRipr/1 and -PfRipr/2 IgG antibodies, raised in two rabbits, were tested by western blot against solubilised pellets from schizont stages and a protein band of approximately 65 kDa was observed (Fig. 4B). Specificity of the antibodies was confirmed with HA-tagged PfRipr immunoprecipitated from culture supernatant with anti-HA antibodies and in both cases a 65 kDa protein was detected (Fig. 4B). This was the molecular weight expected for the processed C-terminal schizont-infected erythrocytes. Immunoprecipitation of HA-tagged PfRipr by anti-HA antibody co-immunoprecipitated PfRh5. (E) Immunoprecitation with anti-PfRh5 antibody using the same schizont materials co-immunoprecipited PfRiprHA but not PfRh2a/b. (F) Co-immnuoprecipitation of PfRh5 with PfRiprHA from culture supernatants using anti-HA-Sepharose bead. Detection of PfRh5 but not PfRh2a or PfRh2b in the anti-HA bead bound material confirmed that PfRh5 was specifically co-immunoprecipitated with PfRiprHA. (G) Co-immunoprecipitation of PfRiprHA with PfRh5 from culture supernatants using monoclonal anti-PfRh5 antibody coupled to Mini-beads. Probing of the bound material with anti-HA antibody detected PfRiprHA only from the 3D7-PfRiprHA parasites and no PfRh2a/b was detected in the bound materials, indicating that PfRiprHA was specifically coimmunoprecipitated with PfRh5. (H) Immnunoprecipitation of culture supernatant from PfRiprHA parasites with rabbit anti-PfRh2a/b antibodies that recognize 85 kDa processed PfRh2a/b fragment did not pull-down PfRh5 or PfRipr. In all cases, the asterisk indicates a cross-hybridizing band corresponding to the heavy chain of IgG eluted from the antibody affinity beads. The arrows in Figure 2E, F and G indicate where 85 kDa PfRh2a/b band should appear. doi:10.1371/journal.ppat.1002199.g002 region of PfRipr; however, the mature full-length protein of 123 kDa was not easily observed as it was mostly processed at late schizont stage and in the supernatant. The anti-PfRipr/3 antibody has low reactivity to the denature protein but recognizes native PfRipr well.
The anti-PfRipr/3 was therefore used in co-immunoprecipitation experiments to confirm that the cleaved N-terminus and Cterminus of PfRipr remain associated. Immunoprecipitation of the HA-tagged C-terminus of PfRipr from 3D7RiprHA parasites using anti-HA antibodies co-precipitated a fragment of approximately 60 of PfRipr that encompassed the N-terminal first two EGF-like domains and C-terminal two EGF-like domains respectively were expressed as recombinant proteins in E. coli and purified for immunizing rabbits. The proteins were stained with Coomassie blue. (B) Rabbit polyclonal antibodies (anti-PfRipr/1 and anti-PfRipr/2) raised against the recombinant protein recognize native PfRipr. (C) Rat anti-HA antibody affinity beads were used to specifically immuno-precipitate proteins solubilized from schizont stages parasites of 3D7 and 3D7RiprHA lines and the bound materials immunoblotted and probed with rabbit anti-PfRipr/3 antibodies. (D) Rabbit anti-PfRipr/3 antibodies, in conjunction with protein G Sepharose, was used to specifically immuno-precipitate the proteins solubilized from schizont stages of 3D7 (panel 1) or culture supernatants (panel 2) and then the bound material was immunoblotted and probed with mouse anti-HA antibodies. The IgG from the pre-bleed serum of the same rabbit was used as a control. (E) Rabbit anti-PfRipr/3 antibodies, in conjunction with protein G Sepharose, was used to specifically immuno-precipitate the proteins from culture supernatant of 3D7 and 3D7RiprHA parasites and the bound material immunoblotted and probed with mouse anti-HA antibodies. The protein marked with a * in the panel D and E is protein G eluted from the beads that cross-reacts with the anti-HA antibodies. doi:10.1371/journal.ppat.1002199.g004 kDa recognized by the anti-PfRipr/3 (Fig. 4C). The size of the fragment is expected for the N-terminal domain of the processed PfRipr. The full-length mature protein of approximately 125 kDa was also observed as expected since it should react with both the anti-PfRipr/3 and anti-HA antibodies. The reciprocal experiment to immunoprecipitate the N-terminal domain with schizont material using anti-PfRipr/3 co-precipitated the 65 kDa C-terminal fragment and the 125 kDa full length protein (Fig. 4D, left panel). An identical experiment using culture supernatant co-precipitated the 65 kDa C-terminal domain (Fig. 4D, right panel); the full-length protein was not detected in this case, presumably because it was processed. Immunoprecipitation using anti-PfRipr/3 and immunoblots with anti-HA antibodies detected the expected bands of the 65 kDa C-terminal domain and the 125 kDa full-length protein in 3D7RiprHA but not from the parental parasite line 3D7 (Fig. 4E), further confirming the specificity of the antibodies. Together these experiments show that PfRipr is processed into two fragments of approximately 65 kDa each and they remain associated with each other to form a complex with PfRh5, consistent with mass spectrometry results (Table 1). Their association does not involve intermolecular disulfide linkages (Fig. 2C).
The anti-PfRipr/1 was used in western blot to probe the PfRipr separated on a blue native gel (Fig. 5A). Indeed anti-PfRipr/1 recognizes the same protein complex detected by anti-PfRh5, with the size of the complex (approximately 200 kDa) consistent with that seen in Fig. 1B.
Expression of PfRipr in the asexual blood stage life cycle was determined using synchronised ring stages parasites from 3D7RiprHA. Saponin pellets were prepared from the samples taken during the parasite life cycle as indicated (Fig. 5B). Anti-HA antibody detected both the 125 kDa full-length and 65 kDa fragment of PfRipr and expression was evident in late trophozoites to schizonts, the expected pattern for proteins that play a role in merozoite invasion . The 65 kDa processed form appeared late in parasite blood stage development indicating that this processing event occurs in the schizont stage before merozoite egress. The same samples were probed for PfRh5, with which PfRipr forms a complex, and it showed a similar timing of expression but processing of this protein appears to occur late in schizogony, as observed earlier . The similar pattern of PfRipr and PfRh5 expression late in the asexual blood stage life cycle of P. falciparum was consistent with formation of a complex between them either in the schizont stage or during merozoite egress before interaction of the parasite with the host cell.
The PfRipr/PfRh5 complex is tightly associated with the membrane of P. falciparum Whilst both PfRipr and PfRh5 have a signal sequence at the Nterminus for entry into the ER, neither has a hydrophobic domain that would provide the means for anchoring in the membrane. As PfRh5 binds to the host erythrocyte it would be expected that the PfRh5/PfRipr complex would be bound to the membrane of the merozoite to provide a junction and perhaps transmit an appropriate signal . To determine if this complex was associated with a membrane, we used differential solubilisation of the parasite to determine the properties of the PfRipr/ PfRh5 complex (Fig. 6). P. falciparum parasites were hypotonically lysed in water and centrifuged to obtain a pellet and supernatant fraction. Treatment of the pellet with 10 mM Tris showed that both PfRipr and PfRh5 remained predominantly in the pellet fraction suggesting they were associated with a membrane (Fig. 6A). However, treatment of the pellet fraction with Na 2 CO 3 showed that both proteins moved to the soluble fraction suggesting they were extrinsically associated as peripheral membrane proteins of the parasite. PfRipr was mainly insoluble in Triton X-100 but the smaller processed form of the protein was more soluble in CHAPs detergent. In contrast, PfRh5 was more soluble in Triton X-100 and CHAPS implying either PfRipr/PfRh5 complex involves hydrophobic interactions that can be disrupted by nonionic detergents , or PfRipr and PfRh5 have different membrane association properties. Similar solubility characteristics were obtained from saponin treated parasites isolated with saponin (Fig. 6B). In summary, these results showed that the PfRh5/PfRipr complex was peripherally associated with the parasite membrane and it is possible that another protein(s) may be involved in the membrane attachment of the PfRh5/PfRipr complex.
PfRipr is located in the apical organelles of the merozoite
With anti-PfRipr antibodies, we performed immuno-fluorescence assays to determine the subcellular localization of PfRipr with respect to known markers of compartments such as micronemes and rhoptries, organelles that are important for erythrocyte invasion. We firstly confirmed that the HA-tagged PfRipr protein showed the same localisation when detected using both anti-HA and anti-PfRipr/1 antibodies, with both showing a punctate pattern in schizonts (Fig. 7, panel a). Co-labelling of schizonts and merozoites with PfRipr and the rhoptry neck marker RON4 (Fig. 7, panel b and c) or the rhoptry body marker, RAP1 (Fig. 7, panel d and e), both showed close alignment but no significant overlap of signal. These results suggest that PfRipr localises to the apical tip of the merozoite in an area distinct from the very apical tip and the bulb of the rhoptries. Comparison of the subcellular localisation of PfRh5 and PfRipr in schizont stages showed that whilst there appeared to be some overlap, there were substantial areas of the punctate pattern that were clearly in a separate part of the cell (Fig. 7, panel f). In contrast, PfRh5 and PfRipr showed substantial co-localisation in merozoites suggesting that the two proteins may form a complex in late schitzonts or merozoits (Fig. 7, panel g). Furthermore, the substantial overlap of PfRipr and the micronemal protein EBA-175 in the schizont stage suggest that PfRipr may be predominately present within this organelle at this stage (Fig. 7, panel h). However, in merozoites they clearly did not co-localise although there was some overlap (Fig. 7, panel i). Taken together, these data are consistent with PfRipr localising to micronemes and being released in merozoites.
To more finely determine the subcellular localisation of PfRipr, immuno-electron microscopy was performed on 3D7RiprHA merozoites (Fig 8A to D and Fig. S2). HA-tagged PfRiprHA was observed towards the apical end of merozoites in more electron dense structures, suggesting localisation in micronemes (Fig. 8A). In merozoites fixed during erythrocyte invasion we observed a concentration of PfRipr reactivity at the leading edge of the tight junction, consistent with the protein being shed and released into the culture supernatant during invasion (Fig. 8B). This suggests that PfRipr was shed from the merozoite surface as the tight junction moves across its surface so that it concentrates at the posterior end before sealing of the parasitophorous vacuole membrane. Whilst there were clearly concentrations of PfRipr in structures at the apical end (Fig. 8C) we also observed considerable surface localisation on free merozoites suggesting it is released prior to invasion (Fig. 8D). In comparison PfRh5 seems to localise to rhoptries (Fig. 8E, F) as we have observed previously ; however, there was also some labelling at the apical surface, suggesting this protein was also being released prior to invasion (Fig. 8 E, F). These results are consistent with that observed by immuno-fluorescent microscopy (Fig. 7). From these localization data, we suggest that PfRipr and PfRh5 localise to separate subcellular compartments and thus do not form a complex in schizont stage parasites. Presumably following fusion, or secretion, of these distinct compartments, they then come together in merozoite or late schizont stages. Once complexed and at the apical end of the merozoite, they interact with a receptor on the erythrocyte surface. Such an interaction between proteins originating in separate organelles is not unprecedented, with one prominent example being the interaction between AMA1 and RON4 to form the invasion tight junction across apicomplexan species .
Antibodies to PfRipr inhibit attachment and invasion of P. falciparum merozoites
To determine if PfRipr was required for development of P. falciparum, we tested the ability of anti-PfRipr/1 and/2 antibodies (Fig. 3) to block parasite growth (growth inhibition assays, GIA ) using the P. falciparum strains FCR3, W2mef, T994, CSL2, E8B, MCAMP, 7G8, D10, HB3, and 3D7 (Fig. 9A). The antibodies inhibited parasite growth of all strains tested and significantly, FCR3 was inhibited to 80% whilst in comparison 3D7 was inhibited to 35% with aPfRipr/1 at 2 mg/ml (Fig. 9A). The inhibition observed for 3D7 was comparable to that observed for other antibodies raised to regions of the PfRh or EBL protein families . Similar results were observed for 3D7 using the aPfRipr/2 (data not shown). As for the anti-PfRipr/1 and/2 antibodies, rabbit polyclonal to the N-terminal EGF-like domains (anti-PfRipr/3) also inhibited parasite growth for all strains tested (Fig. S3). The aPfRipr/1 antibody was titrated in GIAs in comparison with IgG from normal serum for both FCR3 and 3D7 parasite strains ( Fig. 9B and C). Growth of FCR3, a parasite that invades preferentially by sialic acid-dependent pathways, was almost completely abolished at 3 mg/ml and significant inhibition still remained at 1 mg/ml (40%) (Fig. 9B). In comparison, the 3D7 parasite strain, which can efficiently use sialic acid-independent invasion pathways primarily by using the ligand PfRh4 and complement receptor 1 , was inhibited at significantly lower levels of 50% at 3 mg/ml and this decreased to 20% at 1 mg/ml of antibody (Fig. 9C). This suggests that the PfRipr/PfRh5 complex may be more functionally important in P. falciparum strains that efficiently use sialic acid-dependent invasion pathways, which is supported by our finding (Fig. S4) that anti-PfRipr/1 inhibits W2mef, a sialic acid-dependent strain, more effectively than W2mefD175, a sialic acid-independent strain . Among other P. falciparum strains tested, the aPfRipr/1 antibody also exhibited significantly higher inhibitory activity for those that invade erythrocytes preferentially using sialic acid-dependent receptors (ie. glycophorins), which includes T994, CSL2 and E8B (Fig. 9A) .
To investigate the mechanism of inhibition by anti-PfRipr antibodies, we performed merozoite attachment assays (Fig. 9D). Viable merozoites from 3D7 and FCR3 parasites were purified and mixed with erythrocytes in the presence of aPfRipr/1 or aPfRipr/2 antibodies. Both antibodies inhibited merozoite attachment for 3D7 to a significant level (45% and 60% respectively) (Fig. 9D, first panel). In contrast, the same antibodies inhibited attachment of FCR3 merozoites to a considerably greater extent (80% for both antibodies) (Fig. 9D, second panel). The level of inhibitory activity observed with the aPfRipr/1 and aPfRipr/2 antibodies for 3D7 and FCR3 parasites was similar to that observed in the growth inhibition assays (Fig. 9A, B and C) demonstrating that inhibition was occurring at merozoite invasion rather than during growth of the parasite. This inhibition was likely due to interference of these antibodies with the function of the PfRipr/PfRh5 complex since we could not detect PfRipr binding to erythrocytes while consistently observing PfRh5 binding (data not shown) . It was possible that the PfRipr/ PfRh5 complex disassociated on binding of PfRh5 to red blood cells. To test this possibility we purified the PfRh5/PfRipr complex using ion-exchange chromatography (Fig. S5A) and tested its binding to red blood cells (Fig. S5B). This showed that PfRh5 bound to red blood cells but PfRipr was not detected suggesting that the complex was disrupted on binding.
The region of PfRipr to which the aPfRipr/1, 2 antibodies were raised was from the 3D7 strain of P. falciparum; however, this domain does not show any polymorphisms compared to other strains so far sequenced (http://plasmodb.org/and http://www. broadinstitute.org/) (Fig. S6). Also we did not observe any crossreactivity of the antibodies with other proteins that contain EGFlike domains such as MSP1 (data not shown). This was not surprising as the only conserved amino acids are the six cysteine residues that define each EGF-like domain (Fig. 3). Therefore the differences in inhibition observed in GIA with the various strains was unlikely to be due to cross reactivity with other proteins containing EGF-like domains or polymorphisms within this region of PfRipr. It more likely reflects the reliance of these strains on the PfRh5/PfRipr complex to mediate a specific invasion pathway in comparison to the function of other members of the PfRh and EBA protein families . To test this we used a combination of antibodies raised to PfRipr, EBA-175 , PfRh4 , PfRh2a and PfRh2b to determine if they increased the level of inhibition in GIAs for 3D7 parasites (Fig. 9E). Both aPfRipr/1 and aPfRipr/2 antibodies at 1 mg/ml inhibited 3D7 parasite growth to 24 and 21% respectively (Fig. 9E), similar to our previous experiments (Fig. 9C). Anti-EBA-175 antibodies on its own also inhibited 3D7 parasite growth to 25%. Anti-PfRh2a/b and PfRh4 antibodies inhibited the 3D7 parasite growth at 39% and 8% respectively. The combination of aPfRipr/1 with aEBA-175 antibodies showed an additive inhibition of 45%. This was a similar result to that observed for the combination of aPfRipr/1 with aPfRh2a/b or aPfRh4 antibodies (50% and 40% respectively). Significantly, a combination of aPfRipr/1, aPfRh2a/b and aPfRh4 as well as aPfRipr/1, aEBA-175, aPfRh2a/b and aPfRh4 showed a much higher level of inhibition (67% and 74% respectively). This additive effect was consistent with parasites using multiple invasion pathways to gain entry to the erythrocyte. A similar additive inhibitory effect was obtained with FCR3 parasites (Fig. S7).
Our inability to disrupt the PfRipr gene ( Fig. S8 and S9) suggests the function of PfRipr and thus the PfRipr/PfRh5 complex is essential for parasite invasion and survival. Therefore PfRipr represents a novel protein that plays a critical role in merozoite invasion and thus it is a new candidate for a combination vaccine with other PfRh and EBL proteins to produce antibody responses to block a broad array of invasion pathways.
Discussion
Invasion of P. falciparum into host erythrocytes requires specific ligand-receptor interactions that identify the appropriate host cell followed by activation of the parasite actomyosin motor for entry (see for review ). The PfRh family of proteins are important ligands that bind directly to specific receptors on the red blood cell during invasion . Differential expression and activation of these ligands provide a mechanism of phenotypic variation to evade host immune responses and to circumvent the polymorphic nature of the red blood cell surface in the human population . PfRh5 is an important member of the PfRh family that appears to be essential in P. falciparum . This ligand binds to an unknown receptor and plays a key role during merozoite invasion; however, in contrast to all other PfRh family members, it lacks an identifiable transmembrane region, suggesting that it may function in a complex with another protein(s) . We have shown here that PfRh5 exists in a membrane-associated complex with a novel cysteine-rich protein that we have called PfRipr.
The ability of PfRipr antibodies to inhibit merozoite attachment and invasion and our inability to genetically disrupt the corresponding gene implies that this protein plays an important role in these processes. Before invasion, the merozoite undergoes a step of irreversible attachment to the host red blood cell and current evidence suggests that the PfRh and EBL protein families play a key role in this process . Attachment triggers downstream events presumably through signalling from the cytoplasmic domain of each molecule . Merozoite attachment can be inhibited with anti-PfRipr antibodies consistent with the PfRh5/ PfRipr complex playing a role in the irreversible binding to erythrocytes and commitment to invasion. The ability to inhibit merozoite invasion was not due to cross reactivity of the antibodies with other proteins such as MSP-1, that also have EGF-like domains. Whilst neither PfRh5 nor PfRipr has a transmembrane region they are tightly associated with the membrane, suggesting they most likely complex with another protein(s) that would hold the complex on the parasite surface after their release from the apical organelles. This would link the parasite to the erythrocyte by binding of PfRh5 to its specific receptor during merozoite invasion.
The subcellular localisation of PfRh5 and PfRipr appears to be different in schizont stages of the parasite suggesting that they may not form a complex until egress of the merozoite and activation of erythrocyte invasion. PfRh5 was present within the rhoptries whilst PfRipr appears to be in micronemes at the apical end and these proteins would be released during apical interaction where they could associate and form a complex. This is similar to the formation of the AMA-1 and RON complex in both T. gondii and P. falciparum where the former protein is located in micronemes and the latter in the neck of the rhoptries . Components of the RON complex translocate onto and under the erythrocyte membrane forming a bridge across the host cell to the invading merozoite through AMA-1 and this is associated with the tight junction. It is possible that PfRh5/PfRipr interacts with a membrane associated protein and our immuno-electron microscopy analysis has suggested that the complex is at the leading edge of the tight junction (i.e. basal to the merozoite) and shed into the culture supernatant, or onto the exterior of the red blood cell, before membrane fusion to form the enclosing parasitophorous vacuole membrane at the posterior end of the invading merozoite.
The PfRh and EBL proteins may have overlapping functions as loss of EBA-175 can be compensated by increased function of PfRh4 . Furthermore, different parasite lines can differentially express these proteins and in some cases polymorphisms affect their function or potentially alter receptor selectivity . For example, both PfRh2a and PfRh2b are not . PfRipr localizes to the apical end of merozoites. a) Rabbit polyclonal anti-PfRip antibody (anti-PfRipr/1) recognizes HA-tagged PfRiprHA. b) PfRipr does not co-localize with the rhoptry neck protein RON4 in schizonts. c) PfRipr does not co-localize with the rhoptry neck protein RON4 in merozoites. d) PfRipr does not co-localize with the rhoptry bulb protein, RAP1 in schizonts. e) PfRipr does not co-localize with the rhoptry bulb protein, RAP1 in merozoites. f) PfRipr partially co-localizes with PfRh5 in the schizonts. g) PfRipr mainly co-localizes with PfRh5 in purified merozoites. h) PfRipr co-localizes with the micronemal marker, EBA175, in schizonts. i) PfRipr does not co-localize with the micronemal marker, EBA175, in merozoites. doi:10.1371/journal.ppat.1002199.g007 expressed in FCR3 line and additionally, both EBA140 and EBA-181 encode polymorphisms that greatly reduce their binding to the red blood cell surface and render them non-functional when tested in growth inhibition assays with specific antibodies . Similarly, in the W2mef parasite line PfRh4 is not expressed and polymorphisms of EBA-140 and EBA-181 also weaken their binding abilities and function in invasion . Since both FCR3 and W2mef have a reduced complement of functional PfRh and EBL proteins, one would predict that these parasites would have greater reliance on the PfRh5/PfRipr complex for their invasion. That is what we have observed in GIAs with the anti-PfRipr antibodies that efficiently inhibit merozoite invasion of these strains. In addition, the additive effect observed with anti-PfRipr antibody in combination with antibodies raised against other PfRh and/or EBA in GIAs would be consistent with the PfRh5/PfRip complex having a similar function to other members of the PfRh and EBL protein families . However, in contrast to the other PfRh and EBL proteins, both PfRh5 and PfRipr could not be genetically disrupted, pointing to the possibility that the complex may also play a broader role that is essential to the parasites.
The PfRh1, PfRh2a and PfRh2b proteins undergo a complex series of proteolytic cleavage events in the schizont when trafficked to the neck of the rhoptries as well as during merozoite invasion and these events are important in their function . In the case of PfRh2a and PfRh2b, the proteins are processed to produce the N-terminal binding domain that remains associated with the C-terminal domain . It makes sense for N-terminal binding domain and C-terminal domain with a transmembrane region to associate together after processing for the parasites to attach to the erythrocytes. PfRh5 is also located in the neck of the merozoite rhoptries and is processed to a 45 kDa binding region . Here we showed that the 45 kDa binding region forms a complex with PfRipr. Since neither of them contain a transmembrane region, it is likely that the complex binds another protein(s) to link it to the merozoite surface for PfRh5 to bind erythrocyte during invasion. Our results that the PfRipr/PfRh5 complex is peripherally attached to the parasite membrane are consistent with this possibility.
Epidermal growth factor-like domains are found widely throughout eukaryotes and are defined by six cysteine residues that link to form a tightly folded structure . In Plasmodium spp. this domain is contained in a large number of proteins in different stages of the parasite lifecycle. The merozoite surface antigen 1 (MSP-1) has two EGF-like domains and it is localised to the merozoite surface where antibodies can access it and inhibit invasion, which has suggested it is involved in interacting with the erythrocyte surface . Other proteins with EGF-like domains include the P28 family that protect the parasite from the harsh proteolytic environment in the mosquito gut . PfRipr would not play such a protective role as it is released only during invasion. Instead, it may act as a scaffold on which PfRh5 can be mounted so that it is displayed for binding to its erythrocyte receptor. As the N-terminal and C-terminal of PfRipr remains associated after processing, it is likely that the EGF-like domains are responsible for their association as well as interaction with PfRh5. PfRipr has previously been predicted to act as a parasite adhesin by a bioinformatic method based on protein physiochemical properties . However, we could not detect direct binding of PfRipr to erythrocytes and our results suggest that the PfRipr/ PfRh5 complex dissociates upon PfRh5 binding to red blood cells. This may be similar to the processed N-terminus of PfRh2a and PfRh2b that form a complex with the C-terminus of the same proteins. However, only the free processed N-terminus can be detected in erythrocyte binding assays suggesting that this complex also disassociates .
The PfRh and EBL protein families function in binding the erythrocyte and activating the invasion process . It has been proposed that a combination of these ligands may be a useful blood stage vaccine against P. falciparum malaria. Indeed it has been shown in immunisation studies that vaccination with combined portions of EBA-175, PfRh2a/b and PfRh4 proteins can raise antibodies that efficiently block merozoite invasion . The functional importance of PfRh5 has also led to suggestion that it has potential to be included in such a combination vaccine. However, this has not been tested due to the difficulty of producing functional protein.
Identification of the PfRh5/PfRipr complex and the ability of anti-PfRipr antibodies to block merozoite invasion open the possibility for its inclusion in a combination vaccine. Indeed, the efficient inhibition of invasion was observed when a combination of antibodies to PfRipr, PfRh2a/b and PfRh4 was used. This further supports PfRipr as a new vaccine target, especially in a combination approach to efficiently block merozoite invasion.
Ethics statement
Antibodies were raised in mice and rabbits under the guidelines of the National Health and Medical Research Committee and the PHS Policy on Humane Care and Use of Laboratory Animals. The specific details of our protocol were approved by the Royal Melbourne Hospital Animal Welfare Committee.
Parasite culture P. falciparum asexual parasites were maintained in human erythrocytes (blood group O+) at a hematocrit of 4% with 10%(w/v) AlbumaxTM (Invitrogen) . 3D7 is a cloned line derived from NF54 from David Walliker at Edinburgh University. FCR3 is a cloned line. Cultures were synchronised as previously described . Culture supernatants enriched in parasite proteins were prepared by growing synchronized parasite cultures to high parasitemia, typically to 5% and allowing schizonts to rupture. Harvested culture supernatant was spun at 1200 rpm to remove residual erythrocytes and then 10,000 rpm to remove insoluble materials before use for experiments. Total proteins from schizont stage parasites were obtained by saponin lysis of infected erythrocytes.
To prepare culture supernatants for affinity purification of the PfRh5 complex, the PfRh5HA parasite line was synchronized, grown to late schizont stage in normal culture conditions and then culture medium was replaced by RPMI without Albumax to allow the schizonts to rupture . This culture supernatant has a strain. (C) Titration of anti-PfRipr/1 antibodies in growth inhibition assays of the 3D7 strain. (D) Pre-incubation of purified merozoites from 3D7 strain (left panel) and FCR3 strain (right panel) with protein-A purified antibodies raised against recombinant PfRipr inhibited merozoite attachment to red blood cells. Protein-A purified antibodies from normal serum were used as a negative control. The final antibody concentration is 2 mg/ml. (E) Various combinations of anti-PfRipr/1, EBA-175, PfRh2a/b and PfRh4 antibodies increase inhibitory activity for the 3D7 strain of P. falciparum. The final concentration of each antibody is 1 mg/ml. In all the cases, each graph represents three independent experiments done in triplicate with each normalised to the negative control (Protein A purified IgG from normal rabbit serum). The error bars represent standard error of the mean of the three independent experiments. doi:10.1371/journal.ppat.1002199.g009 minimal amount of BSA to facilitate purification of the PfRh5 complex.
Purification and identification of PfRh5 complex
Culture supernatant (900 ml), prepared as described above, was dialysed against 12.5 mM Tris.Cl pH 7.2 overnight at 4uC and loaded onto a 15 ml Q-Sepharose column (GE Heathcare) equilibrated with 12.5 mM Tris.Cl, pH 7.2. The bound proteins were eluted with NaCl in 12.5 mM Tris.Cl pH 7.2. PfRh5HA was eluted with 350 mM NaCl. The eluted PfRh5HA-containing fractions were further purified using anti-HA affinity matrix (Roche Apply Science) and the bound proteins eluted with 0.1 M glycine, pH 2.6. The eluted proteins were then subjected to trypsin digestion and analyzed by mass spectrometry (LC-MS/MS) and proteins identified by database searches .
Gel filtration chromatography and blue native gel electrophoresis
Gel-filtration chromatography was performed on an analytical Superdex 200 column (24 ml, GE Healthcare) and proteins were eluted with PBS or Tris buffer. Blue Native Gel Electrophoresis was conducted using the company's protocols (Invitrogen). NativePAGE TM Novex 4-16% or 3-12% Bis-Tris gels were used to resolve the proteins and the NativeMark TM Unstained Protein Standard used as molecular weight markers.
Generation of P. falciparum expressing HA-tagged PfRipr
To attach a triple HA tag (3xHA) to the 39 end of the Pfripr gene, an 844 bp fragment of Pfripr was amplified from 3D7 genomic DNA using the primers 59-ATCCCGCGGTGAATG-TATATTAAATGATTATTG-39 and 59-TTATCTCGAGATT-CTGATTACTATAATAAAATACATTTTC-39 (Sac II and Xho I restriction sites underlined). The DNA fragment was digested with Sac II and Xho I, and cloned into pHAST, a derivative of pGEM-3Z containing a 3xHA tag and single Strep II tag in tandem. Parasites were transfected as described previously . Successful integration of the 3xHA tag was determined by Southern and Western blot analysis using a mouse monoclonal anti-HA antibody.
Immunoprecipitation and immunoblotting
Immunoprecipitation of PfRh5 from culture supernatant was performed using anti-PfRh5 monoclonal antibody (clone 2F1) coupled to Minileak resin (KEM-En-Tec). Briefly, 1.5 ml culture supernatants from both 3D7 and 3D7-PfRiprHA parasite lines were incubated with 20 ml anti-PfRh5-Minileak resins at 4uC for 4 hr. Also 1.5 ml culture supernatant of 3D7-PfRiprHA parasites was incubated with just 20 ml Mini-bead as an additional control. After incubation, the samples were spun to remove the supernatant and the resin washed three times with PBS containing 0.1% Tween-20. Bound proteins were eluted with SDS sample buffer and separated by SDS-PAGE, transferred to nitrocellulose membrane and probed with a monoclonal anti-HA antibody (12CA5). The membrane was then stripped and re-probed with rabbit anti-Rh2a/b polyclonal antibodies recognizing 85 kDa domain. Immunoprecipitation of HA-tagged PfRipr from culture supernatant of 3D7-PfRiprHA was performed using rat anti-HA affinity matrix (Roche Applied Science). The culture supernatants from 3D7 parasites were used as a control. The bound material was analysed by western blot to probe for PfRh5 using monoclonal anti-PfRh5 antibody (2F1) or to probe for PfRipr using polyclonal antibodies raised against N-terminal fragment (a-PfRip/3). The material was also probed with anti-Rh2a/b polyclonal antibodies as a control. Immunoprecipitation of PfRipr from culture supernatant of 3D7-PfRipHA with a-PfRip/3 was performed using protein G. The IgG from a pre-bleed of the same rabbit was used as a control. Immunoprecipitation of PfRipr from solubilised saponin pellets of the 3D7RiprHA parasite line was performed similarly. The proteins were extracted from the saponin pellet using 2% n-Dodecyl-N, N-Dimethylamine-N-Oxide in PBS. Immunoprecipitation of culture supernatant from 3D7-PfRipHA with rabbit anti-Rh2a/b polyclonal antibodies was also performed with protein G. The bound material was probed for PfRh2a, PfRh2b, PfRh5 and PfRipr using corresponding antibodies raised in mice. The proteins were detected by enhanced chemiluminescence (ECL, Amersham Biosciences).
Analyses of protein expression
Synchronized 3D7RiprHA early ring stage parasites were harvested and the red blood cells lysed using saponin. A second aliquot was harvested 16 hr later, the third aliquot another 8 hr later and subsequent samples every 6 hr later until the end of schizogony. Proteins were extracted from the saponin pellets using SDS-PAGE sample buffer, separated by 4-12% SDS-PAGE gels (Novagen) and transferred to a nitrocellulose membrane. The membrane was firstly probed with monoclonal anti-HA antibody for PfRiprHA and then stripped to probe for PfRh5 and PfHsp70 .
Generation of recombinant PfRipr and antibody production
To produce recombinant C-terminal fragment of PfRipr comprise of amino acid 791-900, a 345 bp DNA fragment was amplified from genomic DNA prepared from 3D7 parasites using oligonucleotides (59 CGCTAGCCATATGAATGAAGAAACA-GATATTGTAAAATG 39 and 59 CGAGGATCCCTAATCT-TCTAAAACACATTTTCC 39). The resulting PCR fragment was cloned into pET14b vector (Novagen) with Nde I and Bam HI, transformed into BL21 RIL E. coli strain to express the recombinant PfRipr-791-900 as a hexa-His-tagged protein (Fig. 3 A). The His-tagged protein was purified from soluble lysate of bacteria cells by affinity purification on Ni-NTA agarose resin (Qiagen) followed by gel-filtration chromatography on Superdex TM 75 column. To produce recombinant N-terminal fragment of PfRipr consisting of amino acid 238-368, a codon-optimised gene was synthesized and cloned into pET28a vector (Novagen) with Nhe I and BamHI sites, transformed into BL21 RIL E. coli strain for expressing recombinant PfRip-238-368 as a hexa-His-tagged protein. The His-tagged protein was expressed in E. coli as inclusion body. Protein isolated from inclusion bodies was refolded in vitro and purified on Ni-NTA agarose resin (Qiagen) under native conditions. Both purified PfRip-791-900 and PfRip-238-368 proteins were used to immunise a rabbit. Rabbit immunoglobulins were purified on Protein A or G-Sepharose and buffer exchanged to PBS for subsequent experiments. The antibody production was done by the WEHI antibody production facility.
Differential solubilization of membrane proteins
PfRiprHA parasite (late schitzont stage)-infected red blood cells were hypotonically lysed with water, centrifuged and the pellet fraction washed with PBS. The pellet was then divided into four eppendorf tubes and incubated on ice for 2 hr with 10 mM Tris/ pH 8.0; 100 mM sodium carbonate/pH 11.5; 2% Triton X100 and 2% CHAPS in 50 mM Tris/pH8.0 containing 1 mM EDTA and 100 mM sodium chloride respectively. The samples were then centrifuged to separate soluble and insoluble fractions. The insoluble fraction was washed twice with PBS and analyzed by Western blot together with the soluble fraction. Saponin pellet, prepared from the late schizont stage PfRiprHA parasites, were subjected to the same analyses as described above.
Growth inhibition assay (GIA) GIA were performed as described . Briefly, late trophozoite stage parasites were added to erythrocytes to give a parasitemia of 0.2% and haematocrit of 2% in 45 ml of 0.5% Albumax II (Gibco, Auckland, New Zealand) in 96 well round bottom microtiter plates (Becton Dickinson, Fanklin Lakes, NJ, U.S.A.). 5 ml of purified rabbit IgG was added to a final concentration of 2 mg/ml. For the titration experiments, the antibodies were added to a final concentration of 0.125, 0.25, 0.5, 1, 2.0 and 3.0 mg/ml. Cultures were incubated for 72 hr (2 cycles) of growth and parasitaemia of each well was counted by flow cytometry, a FACSCalibur with a plate reader (Becton Dickinson, Fanklin Lakes, NJ, U.S.A.) after ethidium bromide (10 mg/ml, Biorad, Hercules, CA, U.S.A) staining trophozoite stage parasites. For each well, more than 50,000 cells were counted, and all samples were tested in triplicate. Growth was expressed as a percentage of the parasitaemia obtained from the pre-immunization IgG control. Three independent assays were performed.
Merozoite attachment assay
Merozoite attachment was performed using viable cells purified as described . Briefly, late shizonts of 3D7 and FCR3 (40-46 hr post invasion) were purified from culture by magnet separation (Macs Miltenyi Biotec) to .95% purity. The purified schizonts were incubated with 10 mM E64 (Sigma) for 7-8 hr, then pelleted at 1900g for 5 min. Resulting parasitophorous vacuole membrane enclosed merozoites (PEMS) were resuspended in a small volume of incomplete culture medium (containing no protein) and filtered through a 1.2 mm, 32 mm syringe filter (Sartorius Stedim biotech, France). Antibodies were added to filtered merozoites at a final concentration of 2 mg/ml and incubated for 2 min after which uninfected erythrocytes were added and incubated for 10 min. Following fixation at room temperature for 30 min using 0.0075% glutaraldehyde/4% paraformaldehyde (ProSciTech, Australia) in PBS the merozoitebound erythrocytes were washed and stained with 0.1 ng/mL 49,6diamidino-2-phenylindole (DAPI) (Invitrogen). Imaging was performed using a either Plan-Apochromat 100x/1.40NA or 40x/ 1.3NA oil immersion Phase contrast lens (Zeiss) on an AxioVert 200 M microscope (Zeiss) equipped with an AxioCam Mrm camera (Zeiss). The MosaiX application from the Axiovision release 4.8 software (Zeiss) was used for counting. For each condition, at least 2000 red blood cells with bound merozoites were scored.
Immuno-Electron microscopy
Merozoites from 3D7RiprHA parsites were purified according to a previously described method and mixed with uninfected human erythrocytes. After a 2 min incubation, invading merozoites were fixed in 1% glutaraldehyde (Pro SciTech, Australia) in RPMI Hepes for 30 min on ice and prepared for Transmission electron microscopy as described . Briefly, samples were dehydrated with increasing ethanol concentrations and embedded in LR Gold resin (Pro SciTech, Australia). The resin was polymerised using benzoyl peroxide (0.5%) (SPI-Chem, USA) and the preparation was sectioned on a Leica Ultracut R ultramicrotome (Wetzlar). The sections were blocked with 5% BSA and 0.1% Tween-20 in PBS for 30 min. Immunolabeling was performed with mouse anti-Rh5 clone 6H2 (dilution 1:100) and mouse anti-HA clone 12AC5 (dilution 1:100). Samples were incubated with 18 nm colloidal gold-conjugated goat anti-mouse secondary antibody (Jackson ImmunoResearch, Baltimore, USA). Post-staining was done with 2% aqueous uranyl acetate and 5% triple lead and observed at 120 kV on a Philips CM120 BioTWIN Transmission Electron Microscope. Figure S9 PCR analysis of the attempted disruption of the PFC1045c gene in P. falciparum using the plasmid vector pCC1. The hdhfr cassette would be inserted by homologous double crossover recombination between the 59 and 39 PFC1045c flanks (black shaded boxes) in the vector and the endogenous locus. PCR analysis of genomic DNA from 3D7 transfected with pCC1-PFC1045c that confers resistance to WR99210 and sensitivity to 5-Fluro-cytosine. For 3D7 the endogenous gene was detected with p405/p338 oligonucleotide primers (1454 bp), whilst for 3D7DPFC1045c the PCR product if present would be detected with p403/p560 (1373 bp), and this would represent integration of the hdhfr gene and disruption of PFC1045c. In the case of 3D7 transfected with pCC1-PFC1045c a PCR product was observed for wild type, but not for the event corresponding to integration by homologous recombination. PCR oligonucleotide pairs p403/p338 and p335/p388 were used as specificity controls. Both PCR oligonucleotide pairs produced PCR products of the expected size. (TIF)
|
/**
* Example demonstrating how to compute the Discrete Fourier Transform, visualize the transform, and apply
* a filter frequency domain.
*
* @author Peter Abeles
*/
public class ExampleFourierTransform {
/**
* Demonstration of how to apply a box filter in the frequency domain and compares the results
* to a box filter which has been applied in the spatial domain
*/
public static void applyBoxFilter( GrayF32 input ) {
// declare storage
GrayF32 boxImage = new GrayF32(input.width, input.height);
InterleavedF32 boxTransform = new InterleavedF32(input.width,input.height,2);
InterleavedF32 transform = new InterleavedF32(input.width,input.height,2);
GrayF32 blurredImage = new GrayF32(input.width, input.height);
GrayF32 spatialBlur = new GrayF32(input.width, input.height);
DiscreteFourierTransform<GrayF32,InterleavedF32> dft =
DiscreteFourierTransformOps.createTransformF32();
// Make the image scaled from 0 to 1 to reduce overflow issues
PixelMath.divide(input,255.0f,input);
// compute the Fourier Transform
dft.forward(input,transform);
// create the box filter which is centered around the pixel. Note that the filter gets wrapped around
// the image edges
for( int y = 0; y < 15; y++ ) {
int yy = y-7 < 0 ? boxImage.height+(y-7) : y - 7;
for( int x = 0; x < 15; x++ ) {
int xx = x-7 < 0 ? boxImage.width+(x-7) : x - 7;
// Set the value such that it doesn't change the image intensity
boxImage.set(xx,yy,1.0f/(15*15));
}
}
// compute the DFT for the box filter
dft.forward(boxImage,boxTransform);
// Visualize the Fourier Transform for the input image and the box filter
displayTransform(transform,"Input Image");
displayTransform(boxTransform,"Box Filter");
// apply the filter. convolution in spacial domain is the same as multiplication in the frequency domain
DiscreteFourierTransformOps.multiplyComplex(transform,boxTransform,transform);
// convert the image back and display the results
dft.inverse(transform,blurredImage);
// undo change of scale
PixelMath.multiply(blurredImage,255.0f,blurredImage);
PixelMath.multiply(input,255.0f,input);
// For sake of comparison, let's compute the box blur filter in the spatial domain
// NOTE: The image border will be different since the frequency domain wraps around and this implementation
// of the spacial domain adapts the kernel size
BlurImageOps.mean(input,spatialBlur,7,null,null);
// Convert to BufferedImage for output
BufferedImage originOut = ConvertBufferedImage.convertTo(input, null);
BufferedImage spacialOut = ConvertBufferedImage.convertTo(spatialBlur, null);
BufferedImage blurredOut = ConvertBufferedImage.convertTo(blurredImage, null);
ListDisplayPanel listPanel = new ListDisplayPanel();
listPanel.addImage(originOut,"Original Image");
listPanel.addImage(spacialOut,"Spacial Domain Box");
listPanel.addImage(blurredOut,"Frequency Domain Box");
ShowImages.showWindow(listPanel,"Box Blur in Spacial and Frequency Domain of Input Image");
}
/**
* Display the fourier transform's magnitude and phase.
*/
public static void displayTransform( InterleavedF32 transform , String name ) {
// declare storage
GrayF32 magnitude = new GrayF32(transform.width,transform.height);
GrayF32 phase = new GrayF32(transform.width,transform.height);
// Make a copy so that you don't modify the input
transform = transform.clone();
// shift the zero-frequency into the image center, as is standard in image processing
DiscreteFourierTransformOps.shiftZeroFrequency(transform,true);
// Compute the transform's magnitude and phase
DiscreteFourierTransformOps.magnitude(transform,magnitude);
DiscreteFourierTransformOps.phase(transform, phase);
// Convert it to a log scale for visibility
PixelMath.log(magnitude,1.0f,magnitude);
// Display the results
BufferedImage visualMag = VisualizeImageData.grayMagnitude(magnitude, null, -1);
BufferedImage visualPhase = VisualizeImageData.colorizeSign(phase, null, Math.PI);
ImageGridPanel dual = new ImageGridPanel(1,2,visualMag,visualPhase);
ShowImages.showWindow(dual,"Magnitude and Phase of "+name);
}
public static void main( String args[] ) {
GrayF32 input = UtilImageIO.loadImage(UtilIO.pathExample("standard/kodim17.jpg"), GrayF32.class);
applyBoxFilter(input.clone());
}
}
|
After finishing up the Vienna Session IPA yesterday I decided to make some bread from the spent grains.
Recipe
400 grams white flour
100 grams spent grains – I didn’t dry them up before adding to the bowl
380 milliliters water (It’s best if the water is lukewarm, 30-35°C)
1/2 teaspoon salt (I just eyeballed it)
1/2 – 1 teaspoon bakers yeast (Also eyeballed)
Notes
Throw everything into a bowl, mix everything together with a spoon. Cover bowl with something and set aside for 9-18 hours in a warm place (20-30°C). The dough should be very sticky and rough at this point.
After the 9-18 hour rising time I set the oven to 225°C, put in the baking stone and let it warm up for a few minutes. Put some flour on the counter, remove the still sticky dough from the bowl and fold it 2-3 times, so it’s shaped however you like. At this point you might want to wait 30 minutes or so for the dough to rise some more, but I just cut a slit in the top and put it in the oven on the baking stone. Put some container into the oven with water so the dough doesn’t dry out in the oven.
I had my bred in the oven for about an hour, occasionally poking it with a wooden spear to see if it was still dough-y on the inside.
Cool it for a while, preferably on a wire rack before cutting and consuming.
Pictures and tasting notes
I found the bread to be really tasty and have just the right amount of grist in it. Crust is hard and nice to bite on. I will definitely be doing this again on my next brew day. It might be interesting to try this recipe with the grist from a dark beer, like a stout or a porter.
Bun in the oven
Finished product
Original recipe
This is the original recipe I worked my bread out of – No knead bread
450 gr flour
360 ml water
1/2 tsp salt
1/2 tsp yeast
|
# About the Book
Tilly is eagerly awaiting the return of her big sister Anna, who has been chasing her acting dreams Los Angeles. But when Tilly's plans hit a snag, can their handsome neighbor Matt come to the rescue? A lovely story of family, friendship and coming home.
An exclusive sneak preview of _The Country Wedding_ is included in the back of the book.
#
# CONTENTS
Chapter 1
About the Author
Preview: The Country Wedding
# Coming Home
On the day her big sister came home, Tilly jumped out of bed, rushed straight to the window, pushed the curtains aside, and saw, to her intense relief, that it wasn't raining. This was such good news. In the misty mountains where she lived, it rained a great deal. Often the rain was little more than a misty drizzle, soft and soundless, so she couldn't be sure if it was actually falling until she looked out. Mizzle, her parents called it.
Today, miraculously, although a pretty white mist still clung to their farm's steep, green hillsides, the sky above the dairy sheds was clear, unclouded blue. It was a perfect day to welcome Anna home.
Yay! Tilly shot a quick glance to the kittens – three fluffy balls of fur curled close to their tortoiseshell mother in a basket at the foot of her bed – then she hurried down the hall to the kitchen where she found her mum already at the stove stirring their breakfast porridge.
'Hi, there.' Her mum smiled. 'You got your wish. It's a beautiful day.'
But Tilly had already dismissed her concerns about the weather in favour of a more pressing matter. She was now rather worried by the fact that her mother was already dressed in good clothes for going out – smart black slacks and a white linen blouse, with her pearl earrings and a gold chain.
'We're still making the ginger biscuits for Anna, aren't we, Mum?'
This was met by a frown and Tilly knew a moment of panic. 'You promised,' she said and she was a little ashamed of the wobbly note that crept into her voice.
Her mum looked contrite. 'Sorry, darling, I have to be at Cairns airport by half past nine.' She looked up to the rooster shaped clock on the wall above the stove. It showed a quarter to seven. 'I don't think there's time for baking.'
Swamped with disappointment, Tilly stared at her. Yesterday, she'd been so thrilled when she'd been struck by the brilliant idea of making special biscuits for Anna. She knew they were Anna's favourites.
She could still remember four years ago, when Anna had left for drama school in the south to become famous and their Nan had made ginger biscuits for the farewell party. Tilly had only been five at the time, but she could distinctly remember Nan sitting quietly in the corner of the living room and smiling and nodding at the host of Anna's school friends, who had all seemed like grown-ups to Tilly.
The food at the party had been awesome – pizzas and barbecued sausages and big bowls of potato salad, as well as chips and little dishes with tomato sauce for dipping. But Anna, who was watching her figure, had eaten very little until Gran's biscuits appeared on the table along with the other desserts.
'Oh, I can't resist these. I'll probably have to live on rabbit food in Sydney – lettuce and carrot sticks – so this is my last chance.'
Tilly could remember the way her sister had closed her eyes as she bit into the circle of gingery deliciousness, smiling as she chewed.
'There's nothing quite like your gingernuts, Nan,' she'd said. 'And I adore the lemon icing. I'm going to try to remember the taste of these while I'm away.'
Of course, Nan had baked another special batch for Anna to take with her and she'd made them again, whenever Anna came home for a quick break.
Their nan had died last year while Anna had been right in the middle of auditions in Los Angeles and Anna hadn't been able to fly home. She'd been dreadfully upset, but Nan had left behind her recipe book, which Tilly's mother now kept on a shelf in the pantry. Yesterday, Tilly had found the recipe and the sudden idea of welcoming Anna with her old favourites had seemed utterly grown-up and perfect.
Unfortunately, her mum had been ultra busy at the time: cleaning Anna's room, polishing the windows, making up the bed with a brand new set of floral sheets from a bed and bathroom shop in Atherton, and then ironing the curtains that she'd freshly washed. Then she'd had to get on with cooking dinner.
'We'll have to make the biscuits tomorrow morning,' she'd told Tilly.
But now it was morning and –
'Why didn't you wake me?' Tilly cried.
'You looked so peaceful.' Her mum was a bit shamefaced. 'But you're right, I promised you, didn't I?' She sighed and gave a shake of her salt and pepper curls. 'Your father's busy in the dairy, of course, but I suppose he can get his own breakfast for once.'
Then she sent Tilly a smiling wink. 'All right, come on then, but we'll have to be jolly quick, and you'll have to clean up the kitchen afterwards on your own.'
'I will, I promise.' Tilly was already at the pantry, fetching the flour canister.
Leaving the porridge to simmer at the back of the stove, her mum donned an apron, turned on the oven and found butter and eggs.
'Here's the ginger,' Tilly called, collecting the little bottle from the spice rack.
'Thanks, love.'
They were in a hurry, so her mum did the measuring, but she let Tilly mix the dough and grease the biscuit trays. Then her mum gave the dough a few extra businesslike stirs and then, together, she and Tilly lined up little blobs of dough in rows on the trays. Tilly had never worked so fast and her rows were a little crooked, but her mum said it wouldn't matter.
Her father came into the kitchen just as the trays went into the oven.
'I've set the timer,' her mum said as she untied her apron. 'John, you'll have to help Tilly to get these biscuits out. Make sure she uses oven gloves.'
Then she raced off to the airport. It was an hour and a half down the mountain to Cairns.
'You'll be fine to ice them, Tilly,' her mum said as she dashed out the door. 'You can't go wrong with a good lemon icing. You know how to make it. It's just a matter of mixing everything. I've left the butter and vanilla and the icing sugar on the bench. You just need two tablespoons of lemon juice.'
Blowing a kiss, her mum left, and everything might have been fine if they'd had lemons.
The biscuits came out of the oven, smelling and looking exactly as they should. Super carefully, Tilly used an egg slice to lift them and set them on a wire rack to cool. Then she covered them with a clean tea towel just as Nan always had. But when she searched for a lemon, she couldn't find a single one in the fruit bowl, or in the fridge, or on the straggly tree shading the chook pen.
Surely her mother must have known there were no lemons? Devastated, Tilly sat for a bit on the front steps, chewing the ends of her long dark hair and wondering if it was worth bothering her father, who had gone back to the shed and was busy again, still tinkering with his tractor.
Worried, Tilly looked out at the familiar view from their mountaintop farm. From here, she could see all the way down the steep grassy slopes dotted with black and white cattle and clear across the velvety spread of the Tablelands. She could even see curling glimpses of the blue ribbon of bitumen that her mother's car would return along once she'd climbed the range from Cairns airport.
Tilly could picture Anna sitting beside their mum, no doubt talking madly about all her adventures, and looking wonderfully sophisticated and grown-up after her four years away, perhaps hardly noticing the lovely countryside she'd been in such a great hurry to leave. Four years. For almost half of Tilly's lifetime her big sister had been away, like a glittering distant star.
And now Anna was coming home. Coming home properly. Not just for a few days or a week as she had most times since she'd left.
_Staying home indefinitely_ , was the way Tilly's mother had described it to her friend, Jackie Drummond, over cups of tea at the kitchen table, and she'd spoken in a low, confiding tone that held an unmistakable note of worry.
Jackie Drummond was full of sympathy. Her daughter, Flora, was a violinist who'd moved away to Melbourne to play in an orchestra. The mothers had met through the CWA, and when they'd discovered that they both had artistic daughters living way down south, they'd become firm friends.
They'd both sounded quite concerned about Anna, though, and this hadn't made any sense to Tilly. Anna must be happy to come home, surely? She'd achieved what she set out to do. She'd graduated with amazing results from NIDA, and she'd acted in plays in Sydney and Melbourne.
Tilly had heard her reading a story on the radio and she'd thought it was wonderful the way Anna could change her voice to sound like all the different people. Tilly and her parents had even travelled to Sydney two years ago to see Anna in a play at the Opera House. She'd been a maid called Rosita and she'd looked so captivating on stage, wearing a short cotton dress with a little frilly cap and an apron.
A little while after that, Anna had travelled all the way to America, to Los Angeles, because some terribly famous and incredibly handsome film star called Jeremy Wilder had been wonderfully impressed by her in Sydney. Mr Wilder had made her all kinds of exciting offers and Anna was all set to become a Hollywood sensation.
Tilly wasn't quite sure what went wrong. The grown ups had talked about it in hushed tones and told her not to worry. All she knew was that Anna was _devastated_ and she hadn't got a part in a Hollywood movie after all.
Just the same, it made perfect sense to Tilly that, with so much success under her belt, her sister was ready to come home to the Tablelands to open her own drama school for the local kids. Tilly was beyond excited. At least she _had_ been excited. Now, it was hard to feel pleased at the thought of offering Anna _un_ -iced ginger biscuits.
She saw her father coming out of the shed, dressed in overalls, with a huge spanner in one hand and an oily rag in the other. Obviously, he was still working on the tractor, but Tilly ran over to him and explained her dilemma.
Her father looked sympathetic, but he shook his head. 'Sorry, love. I don't fancy driving all the way to the shop for a lemon. Couldn't you make do with chocolate icing?'
Tilly thought about this. Chocolate would make quite a nice topping and it went well with ginger. But Anna especially loved lemon.
She wondered if she should go over to Matt's place.
Matt would understand her dilemma.
Straight away, Tilly set off, anxious to consult their neighbour over the road. Matt was a dairy farmer just like her dad, and he had to run the whole farm now that his parents had retired to Mission Beach where his father Dave could fish to his heart's content.
Actually, Matt had made big changes after his parents left. Tilly had heard this from her parents who'd seemed very impressed. Following several sessions with the bank manager, Matt had installed the latest computer technology and a new milking rotator, and he'd started making his own delicious gourmet cheeses and selling them to cafés and restaurants all over Queensland. He had a whiz-bang operation now, according to her dad.
Even so, Matt was never too busy to listen to Tilly's news about Anna. He was a year or two older than Anna, but once upon a time the two of them had been good mates. The best of friends.
One of Tilly's earliest memories was her afternoon ritual of sitting on the front steps, usually with a kitten or a puppy asleep in her lap, as she'd watched Anna and Matt dawdle up the hill together from the school bus. They would have their heads together – Anna's auburn hair so bright beside Matt's dark brown – and they'd be so deep in conversation they were unaware of anyone or anything else until Tilly called to them.
Eventually, they would look up, and laugh and wave. They'd always seemed so happy.
Everything had changed when Anna went away. Matt had made an appearance at the farewell party, but he'd left early, without a proper goodbye as far as Tilly could tell. And whenever Anna came home on holidays, she and Matt avoided each other, or so it had always seemed to Tilly. In fact, with uncanny timing, Matt had usually been super busy for those short times Anna was home. One time, he'd even had a live-in girlfriend staying, so Tilly couldn't blame Anna for staying clear of him. The girlfriend hadn't lasted long though.
'A lemon for Anna?' Matt's twinkling brown eyes looked puzzled when he heard Tilly's request. 'That's an original welcome home gift.'
'I want to make lemon icing. For ginger biscuits.'
'Oh.' He laughed. 'That's different.'
'They've always been Anna's favourites, but they're not the same without lemon icing.'
Matt nodded gravely. 'Come on, then, let's see.'
Tilly followed him as he crossed the living room to his kitchen. His house had been renovated recently and now boasted a huge wall of glass that showed off a splendid view all the way down the long valley. When she was halfway across the room, she noticed a magazine lying open on the coffee table.
It showed a picture of Anna in jeans and huge dark glasses and there seemed to be some kind of story about her. The word _heartbreak_ jumped out from the headline. Tilly wanted to stop to take a closer look at this, but Matt was already in the kitchen and her top priority was procuring the lemon.
In the newly renovated kitchen, flash with gleaming white cupboards and pale stone bench tops, Matt made a show of squinting hard as he peered into a fruit bowl. 'I do believe I might be able to help.' Triumphantly, he held up a beautiful, smooth lemon, glowing with colour.
Tilly squealed and clapped her hands.
'Is one enough?' Matt asked.
'Yes, heaps, thanks.'
'Anything else you need?'
'Well . . . I don't suppose you'd have one of those gadgets that can make pretty patterns with the icing?' After all, Matt had turned his hand to making gourmet cheese, so he probably had all kinds of gadgets.
'A piping bag?' Matt smiled benevolently. 'Feeling artistic, are you?'
'Yes.' Tilly was excited again now, already imagining how beautiful the biscuits would look with icing stars and flowers and little birds. Anna would be so impressed.
'Can't help you, I'm afraid. Although, you can always snip the corner of a plastic bag.'
'You think?'
'Yep, I reckon it'd work, if the hole was small enough.'
Tilly was doubtful, but Matt came back to her house to help her and while she stirred the icing ingredients together – careful to beat out any lumps, and then tasting it and finding it just the right balance of lemony sweetness – Matt found two strong plastic bags then helped her to pour icing into each of them before he carefully snipped one of the corners.
'Would you like me to go first to see if it works?' he asked.
Tilly nodded. 'Yes, please.'
Carefully squeezing the icing through the small hole, Matt topped a biscuit with a smiley face.
'Yay!' Tilly squealed. 'It works.'
'Yep. Here, you have a go.' He handed her the bag and she was a bit nervous at first and made a rather wobbly star.
'Stars are hard,' Matt said. 'Try a little tree or the sun.'
Tilly did so and they looked rather pretty. Soon she had the hang of it and continued with little birds and clouds and bows. It was only when she emptied the bag that she realised Matt had iced one of the other biscuits using the second bag. He'd made a very pretty looping pattern.
'Wow, that's really professional,' she said generously. 'What is it?'
He gave an offhand shrug. 'It's just an old Celtic symbol.'
'What kind of symbol?'
'It means –' Matt hesitated. 'Friendship.'
'Oh, that's nice.' Tilly was pleased and she was sure that Anna would like it too.
'Well,' he said. 'Your biscuits are looking great and Anna will love them, so I'll leave you to it.'
Tilly glanced at the clock. 'Why don't you come back for morning tea, so you can see Anna too?'
Matt shook his head and looked away with a tight little smile. 'Sorry, I really need to get on with my work.'
Of course. As a dairy farmer's daughter, Tilly understood the pressure of daily routines.
When he left, she tidied the kitchen and Tilly set the table with cups and saucers and small plates, then went back to her bedroom to check on the kittens. Their eyes hadn't opened yet, but they were tiny and perfect with beautiful markings – a grey tabby, a ginger tom, and a tortoiseshell like the mother.
Tilly adored them and she gave each one a loving cuddle, before returning it to the basket, then she washed up and put on her best jeans and favourite T shirt covered with butterflies and went out to the front step to sit and watch for her mum's rather battered Outback.
'Dad! Dad! They're here!' At last.
Tilly leapt to her feet. From the passenger seat, Anna smiled and waved at her, but she and their mum both looked a bit subdued as they got out of the car. Anna looked beautiful and sophisticated though, in slim grey slacks and a silky shirt of darker grey. Tilly gave an excited squeal and raced to hug her.
Anna laughed. 'Oh, Tilly, you're getting so tall. Look, you're almost up to my shoulder. It's so good to see you.' She hugged Tilly extra hard and Tilly hoped that everything might be OK, after all.
She helped to carry one of Anna's bags inside and Anna exclaimed politely over how lovely her bedroom looked. Tilly, watching her sister carefully, thought she looked thinner and paler. And sadder.
Anna was still incredibly pretty with her auburn hair and lovely pale skin, but the thing that had always made her beautiful was her sparkly blue eyes. Today, the sparkle was gone.
Tilly supposed it must be the 'heartbreak'. She would have to get her mum to explain about that properly. In the meantime, she hoped Nan's biscuits would help.
Their mum was very pleased when she discovered that the table was set and ready for morning tea. Dad came into the kitchen, having scrubbed up and changed out of his overalls. He and Anna hugged and Anna clung to him for quite a long time with her eyes closed. Her dad smiled sadly and kissed her forehead.
'Nothing like a brew-up after a long journey,' he said, his face brightening into one of his familiar, cheering grins, and Anna smiled too and sat down, while their mum made the tea and Tilly proudly took a selection of the best biscuits from the tin and set them on the gold-rimmed pink plate reserved for special occasions.
'Nan's biscuits?' Anna exclaimed. 'How perfect.'
'Tilly made them,' said their mum and dad together.
'Tilly, you sweetheart. You clever sweetheart.' Smiling, Anna rose from her chair to give Tilly another hug. Tears shone in her eyes, but Tilly knew they were tears for Nan, so that was all right.
'Look at how beautifully you've iced them,' said her mum. You've done a wonderful job, Tilly. How did you manage it? I thought I threw the old piping bags away.'
'Matt helped me,' she said and she explained about the lemon and the snipped plastic bags. Anna was quiet now and she was staring at the biscuit Matt had iced, the one with the beautiful loops and swirls.
'Matt did that one,' Tilly felt compelled to admit, because it really was more professional looking than any of her own stars and flowers.
'Yes,' Anna said.
'It's a Celtic symbol,' Tilly explained. 'It stands for –' She had to stop for a minute to think.
'Friendship.'
'Yes, I know,' said Anna again softly. 'How – how is Matt?' Anna's cheeks were pink as she asked this.
'Fine,' said Dad.
'He's done very well for himself,' said Mum.
'Fantastic,' said Tilly, thinking of the whole wall of glass in the living room and the flash new kitchen.
To Tilly's surprise, Anna didn't eat Matt's Celtic symbol. She chose a biscuit with a small bird and, as they drank their tea, she asked Tilly about her friends and the teachers at school and she quizzed their dad about the dairy and the herd, as if dairying was the most important thing in the world, far more important than acting in plays or movies, or any of the exciting and glamorous things that she'd been doing.
Anna had presents for everyone, too, which she now extracted from one of her bags – special American face creams and perfume for their mum, a book for their dad personally signed by a world-famous author, and, for Tilly, the most gorgeous rose pink dress, so lovely and grown-up looking it stole Tilly's breath.
'I can never wear rosy colours, but this will look absolutely stunning on you,' Anna told her.
So the homecoming was every bit as exciting as Tilly had hoped it would be. Soon, with morning tea over, their Dad went off to phone the hardware store about a machinery part while their mum began to gather up the mugs and plates.
'I'm sure you'd like to go and unpack, Anna,' said Mum.
'Yes.' But Anna didn't move to leave. Instead she stood looking at the biscuit with the Celtic friendship symbol, which was still sitting on the plate. 'If it's OK, I might slip over to thank Matt first. It was very kind of him to help Tilly.'
'Of course it's OK.'
'Ooh, yes,' said Tilly. 'Can I –' She was about to ask if she could come too when she felt her mother's firm grip on her arm and she stopped. Turning, she saw her mum's warning frown and the quick shake of her head.
Tilly might have protested that it wasn't fair, that Matt was her friend, too, but Anna had already left the room, taking the biscuit with her. The fly-screen door closed behind her with a soft hushing sigh.
'Well, well,' Tilly's mother said and she was smiling.
Tilly smiled too. It seemed that perhaps her sister and their neighbour might be friends again. So the biscuits really had been a good idea.
© Barbara Hannay 2017
# About the Author
A former English teacher, Barbara Hannay is a city-bred girl with a yen for country life. Many of her forty-plus books are set in rural and outback Australia and have been enjoyed by readers around the world. She has won the RITA, awarded by Romance Writers of America, and has twice won the Romantic Book of the Year award in Australia. In her own version of life imitating art, Barbara and her husband currently live on a misty hillside in beautiful Far North Queensland where they keep heritage pigs and chickens and an untidy but productive garden.
barbarahannay.com
# ALSO AVAILABLE FROM PENGUIN BOOKS
_Zoe's Muster_
_Home Before Sundown_
_Moonlight Plains_
_The Secret Years_
_The Grazier's Wife_
_The Country Wedding_
# ALSO AVAILABLE FROM BARBARA HANNAY
Read on for a preview
# CHAPTER ONE
## Burralea, 1958
The day was a stinker. The sun overhead was blazing and sweat trickled beneath the bridegroom's collar. Unfortunately, the weather wasn't the only cause of his discomfort as he waited outside the quaint white church perched on a rise above Burralea.
'You look like you could do with a smoke, Joe.' His best man, Cliff, shook out a packet of Camels.
Joe hesitated, remembering the aunts he would have to kiss once this ceremony was over. Then he thought about his bride, who was carrying his child, and who was about to head down the aisle in a fancy white wedding dress specially transported over a thousand miles from a Brisbane department store.
_Stuff it_. He needed a smoke. 'Thanks,' he said, taking a slim cigarette and then ducking his head to meet the flame held between Cliff's cupped hands.
'They reckon every bridegroom gets nervous,' Cliff suggested.
'Yeah. Course.'
'I s'pose the trick is to keep your thoughts fixed on the honeymoon.'
Joe dragged a little harder on his cigarette. Grey clouds hunkered on the horizon, but they offered no relief from the burning sun.
'You'll have a bonzer time on Hayman Island,' Cliff suggested. He'd been Joe's mainstay during the past few weeks, ever since the drunken debacle at Joe's twenty-first birthday party, the night that had started this wedding train rolling. The poor fellow was still doing his best. 'I hear it's really flash.'
Joe nodded, but he wasn't about to confess that the bride's father had coughed up the money for the luxury Barrier Reef resort. Ted Walker wanted the very best for his daughter, of course, and as owner of Burralea's one and only pub, a grand two-storey affair with a splendid fireplace and a magnificent silky oak staircase, Ted could easily afford it. He was footing the bill for the wedding reception, too. It was going to be held in the pub's enormous dining room.
Joe didn't have that kind of money. He ran a cattle property with his dad not far out of town. Kooringal was a modest place compared with the huge stations out west, but Joe and his dad turned out good quality beef, and they kept their heads above water.
He knew the Walkers weren't happy about their daughter marrying 'down', but when Gloria had told them she was pregnant, they'd had little choice. They'd demanded a wedding, and put on brave faces.
Joe knew how that felt. He needed a brave face now as the church's wheezy organ started up and Reverend Gibson popped his head around the vestry door. The minister beckoned to Joe and Cliff.
'Time, gentlemen.'
This was it.
A cold jolt of panic spiked through Joe. His legs felt hollow as he ground the cigarette into the dirt with his heel.
He didn't want to do this. He had no choice.
Cliff patted his coat pockets. 'Still got the ring,' he said with an encouraging grin.
Joe couldn't manage an answering smile. 'Good man,' he said.
Shoulders squared, Joe followed Reverend Gibson into the little church, packed with family and friends all dressed in their wedding finery. He saw his parents in the front pew, his mum looking dewy-eyed and his dad stern but proud. They were both disappointed that Joe's older sister, Margaret, hadn't come up from Melbourne for the big day, but Joe understood why she'd stayed away. Besides, he had bigger things to worry about today.
Now, his collar was choking him, but a whispering excitement buzzed through the congregation, and there was a stirring at the back of the church. No time to ease the knot at his throat. Already, too soon, the organist was striking the chilling chords that announced the arrival of the bride. Joe stiffened like a prisoner facing a firing squad.
He told himself that once the ceremony was over he'd be okay. He'd just get on with the rest of his life as best he could. He wouldn't be the first man to wed out of necessity, and he and Gloria would manage. Romance was supposed to be overrated anyway, although Joe, drowning in the very deepest of regrets, knew this wasn't true.
Uneasily, he turned and saw Ted Walker and a figure in frothy white making their way down the aisle towards him. A rustle of satin whispered at his side, announcing Gloria, looking pretty and surprisingly innocent, behind a misty veil. The music stopped.
Reverend Gibson's voice boomed. 'Dearly beloved, we are gathered here today in the sight of God . . .'
Joe took a deep breath and the time-honoured ceremony flowed seamlessly towards its inevitable end.
Afterwards, they posed on the front steps of the church for photographs. There were photos of the bridal party, photos with parents, with the aunts and uncles, with friends.
More clouds had gathered by this point, now darkening the sky and casting a gloom over the afternoon. Joe was blinking from all the camera flashes when he saw the lone figure in the distance.
From the church's position at the top of the rise he had a clear view down the street. About halfway, a woman was standing beneath a leopard tree, watching them.
His heart stilled.
She was wonderfully slender and wearing a green dress, a dress he remembered too well, with a scalloped neckline that sat neatly against her perfect pale skin, and a narrow belt that circled her slim waist. Despite the gathering clouds, her hair glowed like honey.
Hattie.
For bleak, gut-churning moments Joe stared at her. Helpless. Distraught. She was more than a hundred yards away, and he couldn't read the expression on her face, but he felt her desolation land like a blow, an axe to his heart.
He had tried to apologise to her for this heartbreaking mess, but no apology could undo his stupid, careless, unforgivable mistake.
'Hey, Joe, you're not smiling,' his Aunt Gertrude called rather bossily.
Joe swallowed, tried desperately to dredge up a smile as another flash went off and another cloud, dark as a bruise, rolled over the church's roof. A gust of wind came with it and all the wedding guests looked up, their faces a picture of dismay as they realised they were about to be drenched.
The rain arrived in a sudden, nasty scud that sent everyone scattering. Gloria's father stepped forward with a huge black umbrella held protectively over his daughter.
Down the street, the girl in green climbed into a small white VW and drove away.
***
Hattie tried to let herself into the cottage quietly, but she hadn't managed yet to oil the front door hinges and so they squeaked.
'Is that you, dear?' her mother called weakly from the bedroom.
Hattie stopped just outside the bedroom doorway, needing to compose herself before she went in. Closing her eyes, she took a deep breath and then let it out slowly, willing her rioting emotions to calm.
The unthinkable had happened. Joe was married and somehow she would have to find a way to keep going.
When she stepped through the doorway, her mother looked gaunt and sallow against the white pillow. In recent weeks, even her hair had faded, and now it was the colour of withered cornstalks. She was lying just as Hattie had left her, and the level of water in the glass on the bedside table was exactly the same.
'Have you been asleep?' Hattie asked her.
'I'm not sure. I think I might have dropped off.'
The rain was blowing in through a window. The white painted sill glistened with water and streaks of dampness showed on the floral curtains. Hattie crossed the room and closed the window. She would have to fetch a towel to dry the sill.
'Were you caught in the rain?' her mother asked, eyeing similar dark streaks on Hattie's dress.
'Only a few spots, really,' she said. 'I jumped in the car as soon as it started.'
'You went to watch the wedding.' It wasn't a question, but a matter-of-fact statement.
Hattie flinched. 'How did you know?'
'About Joe Matthews's wedding? Jenny Greeves told me yesterday.'
'Oh.'
Their neighbour had obligingly agreed to sit with Hattie's mother on Friday afternoons, while Hattie drove to Atherton to attend to the weekly business of banking, grocery shopping and getting her mother's prescriptions filled.
'You should have stayed well away from that church today,' her mother said now. 'You should have more pride, Hattie.'
'I kept my distance. No one saw me.' This was a lie, of course. She knew Joe had seen her.
Despite the distance between them, she had known the very instant that his careful smile left his face. She'd sensed his distress in the sudden way he'd become ramrod-still as he'd stared down the street at her.
It was no compensation for the unbearable pain he'd caused her.
'Darling, I know you're hurting, but I'm sure Joe can't have been right for you. What's happened is for the best. It has to be.'
Hattie wanted to challenge her mother, to demand how she could possibly know this. How could losing the one you loved ever be for the best? But she couldn't ask such a thing. Her mother was dying.
With a very thin, too-pale hand, Rose Bellamy patted the space beside her on the edge of the bed. 'Hattie, come here, please, darling. Sit here. There's something I need to tell you.'
Suddenly nervous, Hattie stayed where she was. 'What is it? Do you feel worse? Should I call the doctor?'
'No, no, I don't want the doctor.'
'I'll heat some more of that chicken soup.'
'Not now.' Her mother looked even more distressed than usual. 'There's something I need to explain. It's very important, and I don't want to leave it too late.'
A horrible chill crept through Hattie. 'What's this about?' she asked fearfully, as she edged towards the bed and took her mother's frail hand in hers.
'It's about you.' Rose squeezed her hand ever so gently. 'Firstly, I want you to promise that you'll go to England now. When this —' She gave a small nod to indicate her failing body, the bed, the sick room. 'When this is over, you must go.'
Rose had written to Hattie's grandmother in England when she'd first learned how ill she was. The reply had been sympathetic and, in her grandmother's polite, remote, English way, she'd invited Hattie to come and stay with her. Indefinitely.
'I know you've been resisting, because you were so set on Joe,' her mother said, 'but there's no point in staying here now, is there?'
'I can still get a job.'
'Hattie!' The thin voice was surprisingly sharp. 'I'm not asking you, I'm _telling_ you to go to England. I need to know that you'll do this. I'm sure there must still be enough money in the account.'
The last thing Hattie wanted was to distress her mother by arguing, but she didn't want to leave Burralea. This quiet country town was their home. She could scarcely remember anything else. And yet, she knew she would be miserable trying to stay here without her mother or Joe. Besides, how could she refuse her mother at this point?
'Yes, all right,' she said. 'I promise.'
'Thank you.' Rose looked more exhausted than ever and closed her eyes.
'I'll leave you to rest for a bit,' Hattie said.
The faded blue eyes flashed open again. 'Don't go yet. There's something else I need to tell you.'
'But you're tired. Leave it till later.'
This brought a bitter, dismissive little laugh. 'I'm always tired and this is important. It's something I should have told you long before this – about what happened when you were born. I need to explain about – about your father.'
Her father?
Hattie's mind had been preoccupied with Joe and her mother's illness, and she was totally thrown by this sudden mention of a father she'd never known. Her mind flashed to the photograph album they'd brought with them when they'd fled to Australia from China.
Hattie had been almost five when they left, so she had only shadowy memories of Shanghai, but the photos had helped to keep these memories alive. There were pictures of her grandparents' spacious, pleasant house in the French Concession, set back from a tree-lined boulevard behind tall wrought-iron gates.
Another snap showed Hattie aged four with her amah, Ah Lan. Hattie was wearing a party dress with a satin sash and a full skirt, with frilly socks and black patent leather shoes. Ah Lan was dressed simply in plain dark cotton and her hair was pulled back tightly from her round, smooth face to reveal her gentle smile. From beneath her skirt, her tiny, misshapen, bound feet peeked.
There were also photos of Rose, her mother, looking young and pretty, and of Hattie's glamorous Aunt Lily with her bright honey-gold hair cut into a bob and lacquered into waves like corrugated iron. Her Uncle Rudi with his dark, dark eyes and flashing smile. Her very proper and rather distant grandparents.
Then Hattie's mild-eyed father with his pleasantly handsome face and smart seaman's kit.
'My father's dead.' Her mother was well aware of this sad fact, of course, but Hattie felt impelled to repeat it now. 'He died when I was a baby.'
Rose had told her this story many times over the years, speaking of Hattie's father with a fond smile, as if her memories of him were comforting. Her story had never changed and Hattie found it terribly important to repeat it now. 'My father was Stephen Bellamy. He was English, a merchant seaman based in Shanghai, and his ship was bombed by the Japanese. He was terribly heroic, saving the lives of lots of passengers, but he was injured too, and he died.'
Over the years, Hattie had come to cherish a mental image of her father as a handsome and heroic seaman, a veritable knight in shining armour who had nobly sacrificed his life for others.
'I'm sorry, Hattie,' her mother said softly. 'I really am so terribly sorry.' Her pale lips trembled. 'I'm afraid the correct story is rather more complicated than that, and it's time you knew the truth.
#
> _Three strong women, one shattering secret, and a family with the courage to change._
For three generations of Australians, becoming a grazier's wife has meant very different things. For Stella in 1946, it was a compromise in the aftermath of a terrible war. For Jackie in the 1970s, it was a Cinderella fairytale with an outback prince. While for Alice in 2015, it is the promise of a bright new future.
Decades earlier, Stella was desperate to right a huge injustice, but now a long-held family secret threatens to tear the Drummond family of Ruthven Downs apart. On the eve of a special birthday reunion, the past and present collide, passions are unleashed and the shocking truth comes spilling out.
From glamorous pre-war Singapore to a vast cattle property in Queensland's far north, this sweeping, emotional saga tests the beliefs and hopes of these women as they learn how to hold on to loved ones and when to let go.
#
> _Some family secrets are best set free._
When Lucy Hunter stumbles upon her grandfather Harry's World War II memorabilia, she finds a faded photograph of a stunning young woman known simply as 'George' and a series of heartfelt letters. They are clues about the secret years, a period of Lucy's family history that has been kept a mystery . . . until now.
How did a cattleman from north Queensland find forbidden love with the Honourable Georgina Lenton of London and persuade her to move to his isolated outback property? And why are the effects of this encounter still reverberating in the lives of Lucy and her mother, Rose, now?
From the wild beauty of the Australian bush to England's rugged south coast, this is a deeply moving story of heartbreak, heroism and homecoming by a beloved, multi-award-winning author.
**'Bound to become a new favourite.'**
_The Age_
**'It's a pleasure to follow an author who gets better with every book. Barbara Hannay delights with this cross-generational love story, which is terrifically romantic and full of surprises.'**
_Apple iBooks, 'Best Books of the Month'_
**'** The Secret Years **has everything a romantic reader could want . . . A brilliant piece of work.'**
_Newcastle Herald_
#
> _A breathtaking novel about finding love against all the odds that will keep you captivated from beginning to end._
In 1942, as the Japanese sweep towards northern Australia and allied troops swarm into Townsville, Kitty Martin is sent inland to the safety of Moonlight Plains. But when two American airmen crash on the isolated property, she is forced to grow up fast, coming face to face with tragedy, with love . . . and with heartbreak.
Years on, and Sally Piper, a young journalist, is sent to Moonlight Plains to cover the story of a cattleman turned builder who is restoring his grandmother's forgotten homestead. Sparks fly between them, but Sally is struggling to let go of the past, and Luke has his eyes fixed firmly on the future.
What they uncover together is a shocking secret that has been kept safe for more than seventy years. Now the entire family's happiness is at stake – or does the truth about the past hold a valuable lesson for the future?
**'Hannay's touch is deft, her pacing perfect and it all adds up to a gem of a story.'**
****_Smart Bitches, Trashy Books_
**'A fantastic story with beautiful characters and a lovely backdrop of rural Australia'** __
_1 Girl . . . 2 Many Books_
#
> _Coming home can break your heart._
For Bella Fairburn, a girl from the bush, her new life in Europe is a dream come true. But news of her beloved father's heart attack brings Bella rushing back to Australia along with her aunt Liz, an acclaimed musician who's been living in London for the past thirty years.
Coming home is fraught with emotional danger for both Bella and Liz. While Bella is confident she can deal with drought, bushfires and bogged cattle, she dreads facing her neighbour. Gabe Mitchell is the man she once hoped to marry, but he's also the man who broke her heart.
And for Liz, Mullinjim holds a painful secret that must never be revealed . . .
In the rugged beauty of the outback, new futures beckon, but Bella and Liz must first confront the heartaches of the past.
**'An engaging story of joy, tragedy, romance and heartache set within the dusty landscape of the Australian outback.'**
_Book'd Out_
**'In beautiful, fluid prose, Hannay once again puts together all the ingredients for a real page turner.'**
_Toowoomba Chronicle_
#
When Zoe, black sheep of the Porter family, discovers that her biological father is a Far North Queensland cattleman, her deep desire to meet him takes her from her inner-city life to a job at remote Mullinjim Station. But Zoe is sworn to secrecy. Her mother, Claire, is afraid to confront the ghosts of her past.
Virginia Fairburn is happily married to Peter but she's always lived with the shadow of the other woman her husband loved and lost.
On the muster at Mullinjim, Zoe meets brooding cattleman Mac McKinnon. Every instinct tells Mac that Zoe is hiding something, and as the pressure to reveal her mother's secret builds, Zoe fears she must confide in him or burst. The truth has the potential to destroy two families. Or can it clear the way for new beginnings?
Set in the rugged outback of beautiful Far North Queensland, _Zoe's Muster_ is a passionate love story from award-winning romance writer Barbara Hannay.
**'Hard to put down . . . get your hands on a copy of this book and you will not be disappointed.'**
_Weekly Times_
**'An engaging story with appealing characters set in a wonderful landscape . . . Another fine example of the growing rural fiction genre.'**
_Book'd Out_
# MICHAEL JOSEPH
UK | USA | Canada | Ireland | Australia
India | New Zealand | South Africa | China
Penguin Books is part of the Penguin Random House group of companies
whose addresses can be found at global.penguinrandomhouse.com.
First published by Penguin Random House Australia Pty Ltd, 2017
Text copyright © Barbara Hannay 2017
The moral right of the author has been asserted.
All rights reserved. Without limiting the rights under copyright reserved above, no part of this publication may be reproduced, stored in or introduced into a retrieval system, or transmitted, in any form or by any means (electronic, mechanical, photocopying, recording or otherwise), without the prior written permission of both the copyright owner and the above publisher of this book.
Cover design by Louisa Maggio © Penguin Random House Australia Pty Ltd
Cover photographs: Shutterstock
penguin.com.au
ISBN: 9780143788423
## THE BEGINNING
Let the conversation begin...
Follow the Penguin Twitter
Keep up-to-date with all our stories YouTube
Pin 'Penguin Books' to your Pinterest
Like 'Penguin Books' on Facebook
Find out more about the author and
discover more stories like this at penguin.com.au
# Table of Contents
1. Coming Home
2. About the Book
3. Preview: The Country Wedding
4. Imprint
# Landmarks
1. Cover
|
// Start the active receiver for this Nan0 connection. This enables the 'receiver' channel,
// constantly reads from the open connection and places the received message on receiver channel
func (n Nan0) startServiceReceiver(rmap RouteMap, identMap map[int]proto.Message, decryptKey *[32]byte, hmacKey *[32]byte) {
defer recoverPanic(func(e error) {
slog.Warn("Connection to %v receiver service terminated: %v", n.GetServiceName(), e)
})()
if n.conn != nil && !n.IsClosed() {
for {
select {
case <-n.readerShutdown:
panic(errors.New("reader shutdown"))
default:
conn := bufio.NewReader(n.conn)
err := n.conn.SetReadDeadline(time.Now().Add(TCPTimeout))
checkError(err)
var newMsg proto.Message
newMsg, err = getMessageFromConnection(conn, identMap, decryptKey, hmacKey)
if err != nil && newMsg == nil {
panic(err)
}
if newMsg != nil {
if exec, ok := rmap[getProtobufMessageName(newMsg)]; ok {
exec.Execute(newMsg, n.sender)
} else if exec, ok := rmap[DefaultRoute]; len(rmap) > 0 && ok {
exec.Execute(newMsg, n.sender)
} else {
n.receiver <- newMsg
}
n.lastTxRx = time.Now()
}
}
time.Sleep(1 * time.Millisecond)
}
}
}
|
/*
* Copyright 2014 toxbee.se
*
* 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 se.toxbee.sleepfighter.preference.migration;
import se.toxbee.sleepfighter.utils.migration.IMigrationException;
import se.toxbee.sleepfighter.utils.prefs.PreferenceNode;
public class Version8 extends Migrater.Adapter {
@Override
public void applyMigration( PreferenceNode p ) throws IMigrationException {
p.remove( "pref_temp_weather" );
// control
b( p, "pref_alarm_turn_screen_on", "alarmControl.turnScreenOn", true );
b( p, "pref_alarm_bypass_lock_screen", "alarmControl.bypassLockScreen", true );
// location filter
b( p, "pref_location_filter_enabled", "locfilter.isEnabled", true );
i( p, "pref_location_filter_ttff", "locfilter.firstRequestDT", 15 );
i( p, "pref_location_filter_refresh_interval", "locfilter.requestRefreshInterval", 1 );
i( p, "pref_location_filter_min_distance", "locfilter.minDistance", 100 );
i( p, "pref_location_filter_max_age", "locfilter.maxAllowedAge", 20 );
// challenge points
b( p, "challenges_activated", "challenges.isActivated", true );
i( p, "challenge_points", "challenges.points", 0 );
l( p, "lastChallengePointsGained", "challenges.lastTimeEarned", 0 );
// display
b( p, "pref_global_when_or_in_how_much", "display.earliestAsPeriod", false );
}
private void b( PreferenceNode p, String f, String t, boolean d ) {
boolean v = p.getBoolean( f, d );
p.remove( f );
p.setBoolean( t, v );
}
private void i( PreferenceNode p, String f, String t, int d ) {
int v = p.getInt( f, d );
p.remove( f );
p.setInt( t, v );
}
private void l( PreferenceNode p, String f, String t, long d ) {
long v = p.getLong( f, d );
p.remove( f );
p.setLong( t, v );
}
};
|
// get a float64 out of the command string
float64
htmInterface::getFloat() {
if(t_ == NULL)
throw SpatialFailure("htmInterface:getFloat: No command to parse");
const StdStr &token = t_->next();
if(!isFloat(token))
throw SpatialInterfaceError("htmInterface:getFloat: Expected float at first position of Command. ",cmd_.data());
return atof(token.data());
}
|
def reduce(key, stringified_values):
user_id = key[:key.find('@')]
job_queued_msec = float(key[key.find('@') + 1:])
values = [ast.literal_eval(sv) for sv in stringified_values]
sorted_values = sorted(
values, key=lambda x: x['last_updated_ms'], reverse=True)
user_models.UserRecentChangesBatchModel(
id=user_id, output=sorted_values[: feconf.DEFAULT_QUERY_LIMIT],
job_queued_msec=job_queued_msec
).put()
|
Following President Donald Trump’s campaign rally in Phoenix Tuesday night, CNN anchor Don Lemon delivered a concise and stunningly sharp rebuke to Trump’s speech. In his remarks, the president attacked the media — in particular for how his response to recent deadly violence in Charlottesville was covered — and criticized the GOP for failing to deliver on his agenda.
“This is who we elected president of the United States, a man who is so petty that he has to go after people who he deems to be his enemy, like an imaginary friend of a 6-year-old,” Lemon said in an under-two-minute monologue.
“His speech was without thought. It was without reason. It was devoid of facts. It was devoid of wisdom. There was no gravitas. There was no sanity there. He was like a child blaming a sibling on something else. ‘He did it. I didn’t do it.’”
Here’s are Lemon’s full remarks:
I’m just going to speak from the heart here. What we have witnessed is a total eclipse of the facts: Someone who came out onstage and lied directly to the American people and left things out that he said in an attempt to rewrite history, especially when it comes to Charlottesville. He’s unhinged. It’s embarrassing. And I don’t mean for us, the media, because he went after us — but for the country. This is who we elected president of the United States, a man who is so petty that he has to go after people who he deems to be his enemy, like an imaginary friend of a 6-year-old. His speech was without thought. It was without reason. It was devoid of facts. It was devoid of wisdom. There was no gravitas. There was no sanity there. He was like a child blaming a sibling on something else. ‘He did it. I didn’t do it.’ He certainly opened up the race wounds from Charlottesville. A man clearly wounded by the rational people who are abandoning him in droves, meaning those business people and the people in Washington now who are questioning his fitness for office and whether he is stable. A man backed into a corner, it seems, by circumstances beyond his control and beyond his understanding. That’s the truth. If you watched that speech as an American, you had to be thinking, ‘What in the world is going on?’ This is the person we elected as the president of the United States? This petty? This small? The person who is supposed to pull the country together? It certainly didn’t happen there.
Later on in CNN’s post-rally coverage, former director of national intelligence James Clapper called Trump’s speech “downright scary and disturbing.”
Lemon went on to suggest that Trump’s rhetoric could inspire more violence. “He has given oxygen to racists,” Lemon said, referencing Trump’s frequent reticence to condemn the alt-right and white supremacist groups. “He is clearly trying to ignite a civil war in this country.”
|
// add a new server instance into the hashring
// accepts an instance of StatsDBackend as parameter
// returns the sorted hashring with the newly appended server and error
func (ring *HashRing) Add(backend StatsDBackend) (HashRing, error) {
if !backend.Alive() {
err_msg := fmt.Sprintf("Backend %s:%d doesn't seem to be alive.", backend.Host,
backend.Port)
return *ring, errors.New(err_msg)
}
new_ring := append(*ring, backend)
sort.Sort(ByHashRingID(new_ring))
return new_ring, nil
}
|
// RecoveryInstanceDataReplicationState_Values returns all elements of the RecoveryInstanceDataReplicationState enum
func RecoveryInstanceDataReplicationState_Values() []string {
return []string{
RecoveryInstanceDataReplicationStateStopped,
RecoveryInstanceDataReplicationStateInitiating,
RecoveryInstanceDataReplicationStateInitialSync,
RecoveryInstanceDataReplicationStateBacklog,
RecoveryInstanceDataReplicationStateCreatingSnapshot,
RecoveryInstanceDataReplicationStateContinuous,
RecoveryInstanceDataReplicationStatePaused,
RecoveryInstanceDataReplicationStateRescan,
RecoveryInstanceDataReplicationStateStalled,
RecoveryInstanceDataReplicationStateDisconnected,
}
}
|
//Wine trading in Gergovia
public class A410877027_9_1 {
static long persons;
static long[] bottles;
static long sum;
public static void main(String[] argv) {
//讀資料
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
//人
persons = scanner.nextLong();
//沒人就跳出
if (persons == 0)
break;
//幾人幾瓶
bottles = new long[Math.toIntExact(persons)];
for (int i = 0; i < persons; i++) {
bottles[i] = scanner.nextLong();
}
long result = 0;
//計算出來 sum = 前一個 前一個 = 自己 + 前一個 如果sum是負的取絕對值 不然就原本的sum
for (int i = 1; i < persons; i++) {
sum = bottles[i - 1];
bottles[i] += bottles[i - 1];
result += (sum < 0) ? (sum * -1) : sum;
}
System.out.println(result);
}
}
}
|
/**
* Permanently delete the given {@link Tag}s from the State (including from
* all {@link ItemThread}s which reference the Tags).
*
* @param tagsToDelete
*/
public void deleteTags(Set<Tag> tagsToDelete) {
for (Tag t : tagsToDelete) {
threadsAndTags.deleteTag(t);
}
}
|
/**
* Builds the log settings to be used for a test. The log settings here
* add to those specified in a <tt>logback.xml</tt> or
* <tt>logback-test.xml</tt> file on your class path. In particular, if
* the logging configuration already redirects the Drill logger to the
* console, setting console logging here does nothing.
*/
public static class LogFixtureBuilder {
private String consoleFormat = DEFAULT_CONSOLE_FORMAT;
private boolean logToConsole;
private List<LogSpec> loggers = new ArrayList<>();
/**
* Send all enabled logging to the console (if not already configured.) Some
* Drill log configuration files send the root to the console (or file), but
* the Drill loggers to Lilith. In that case, Lilith "hides" the console
* logger. Using this call adds a console logger to the Drill logger so that
* output does, in fact, go to the console regardless of the configuration
* in the Logback configuration file.
*
* @return this builder
*/
public LogFixtureBuilder toConsole() {
logToConsole = true;
return this;
}
/**
* Send logging to the console using the defined format.
*
* @param format valid Logback log format
* @return this builder
*/
public LogFixtureBuilder toConsole(String format) {
consoleFormat = format;
return toConsole();
}
/**
* Set a specific logger to the given level.
*
* @param loggerName name of the logger (typically used for package-level
* loggers)
* @param level the desired Logback-defined level
* @return this builder
*/
public LogFixtureBuilder logger(String loggerName, Level level) {
loggers.add(new LogSpec(loggerName, level));
return this;
}
/**
* Set a specific logger to the given level.
*
* @param loggerClass class that defines the logger (typically used for
* class-specific loggers)
* @param level the desired Logback-defined level
* @return this builder
*/
public LogFixtureBuilder logger(Class<?> loggerClass, Level level) {
loggers.add(new LogSpec(loggerClass.getName(), level));
return this;
}
/**
* Turns off all logging. If called first, you can set disable as your
* general policy, then turn back on loggers selectively for those
* of interest.
* @return this builder
*/
public LogFixtureBuilder disable() {
return rootLogger(Level.OFF);
}
/**
* Set the desired log level on the root logger.
* @param level the desired Logback log level
* @return this builder
*/
public LogFixtureBuilder rootLogger(Level level) {
loggers.add(new LogSpec(Logger.ROOT_LOGGER_NAME, level));
return this;
}
/**
* Apply the log levels and output, then return a fixture to be used
* in a try-with-resources block. The fixture automatically restores
* the original configuration on completion of the try block.
* @return the log fixture
*/
public LogFixture build() {
return new LogFixture(this);
}
}
|
/**
*
* WARNING - THIS FILE HAS BEEN HARD PURGED! REFERENCE master_2019 FOR PREVIOUS IMPLEMENTATIONS
*
*/
public class Map {
/** Vision Constants */
public static final double YAW_LEFT_MARGIN = 0;
public static final double YAW_RIGHT_MARGIN = 0;
public static final double PITCH_TOP_MARGIN = 0;
public static final double PITCH_BOTTOM_MARGIN = 0;
/** Utilities */
public static final double UTIL_JOYSTICK_DEADZONE = 0.05;
/** Camera */
public static final long CAMERA_X = 180;
public static final long CAMERA_Y = 160;
public static final int VISION_INTERFACE_CAMERA_PORT_BUTTON = 5;
/** Arduino Addresses */
public static final byte ARDUINO_ADDRESS = 64;
public static final byte GROUNDTRUTH_ADDRESS = 1;
public static final byte ARM_LIGHTS_ADDRESS = 2;
public static final byte ARM_MODE_ADDRESS = 3;
public static final byte POST_LIGHTS_ADDRESS = 4;
public static final byte POST_MODE_ADDRESS = 5;
public static final byte PARTY_MODE_ADDRESS = 8;
public static final byte PULSE_SPEED_ADDRESS = 11;
/** Ground Truth Sensor */
public static final byte GROUNDTRUTH_QUALITY_MINIMUM = 40;
public static final double GROUNDTRUTH_DISTANCE_PER_COUNT = 1.0;
public static final double GROUNDTRUTH_TURN_CIRCUMFERENCE = 3.1416 * 1.25;
public static final int GROUNDTRUTH_SPEED_AVERAGING_SAMPLES = 4;
// Maximum (empirically determined) speed the robot can go in its three directions.
public static final double[] GROUNDTRUTH_MAX_SPEEDS = { 12.0, 5.0, 7.0 };
/** IO Stuff */
// Joystick raw axes
public static final int JOYSTICK_Y_AXIS = 1;
public static final int JOYSTICK_X_AXIS = 0;
public static final int LIFT_DROP_BUTTON = 10;
/** Robot Config Stuff */
public static final double ROBOT_WARNING_TIME_LONG = 20.0;
public static final double ROBOT_WARNING_TIME_SHORT = 10.0;
/** Crash Detection Stuff */
public static final double CRASH_DETECTION_PORT = 3;
public static final double GET_AVERAGE_TIME_DELAY = 500;
public static final double CRASH_DETECTION_THRESHOLD_MULTIPLIER = 1.1;
public static final int CRASH_DETECTION_DISTANCE_THRESHOLD = 700;
public static final int CRASH_DETECTION_MODE = 0;
public static final double DETECTION_DELAY = 1000;
/**
* Drive Class Things
*/
// Drive Motor enumeration
public static enum DRIVE_MOTOR { FRONT_LEFT, BACK_LEFT, BACK_RIGHT, FRONT_RIGHT }
// Drive Motor ports
public static final int FRONT_LEFT_TALON_PORT = 11;
public static final int BACK_LEFT_TALON_PORT = 12;
public static final int BACK_RIGHT_TALON_PORT = 13;
public static final int FRONT_RIGHT_TALON_PORT = 10;
//public static final int[] DRIVE_MOTOR_PORTS = { FRONT_LEFT_TALON_PORT, BACK_LEFT_TALON_PORT, BACK_RIGHT_TALON_PORT, FRONT_RIGHT_TALON_PORT };
public static final int[] DRIVE_MOTOR_PORTS = { 10, 11, 12, 13 };
// Drive disable orbit point buttons
public static final int DRIVE_LEFT_BOTTOM = 7;
public static final int DRIVE_LEFT_TOP = 6;
public static final int DRIVE_RIGHT_BOTTOM = 10;
public static final int DRIVE_RIGHT_TOP = 11;
public static final int[] DRIVE_OP_BUTTONS = { DRIVE_LEFT_BOTTOM, DRIVE_LEFT_TOP, DRIVE_RIGHT_BOTTOM,
DRIVE_RIGHT_TOP };
// Drive Input magic numbers
public static final double[] DRIVE_INPUT_MAGIC_NUMBERS = { 1.0, -1.0, -0.6 };
public static final double DRIVE_INPUT_TURN_FACTOR = 0.2;
public static final double DRIVE_INPUT_VISmanual_ion_speed = 0.75;
// Drive Front Side changing
public static final int DRIVE_FRONTSIDE_FRONT = 1;
public static final int DRIVE_FRONTSIDE_BACK = 1;
// Glide gain
public static final double[][] DRIVE_GLIDE_GAIN = { { 0.0015, 0.003 }, { 0.008, 0.008 } };
// Drive Output magic numbers - for getting everything spinning the correct direction
public static final double[] DRIVE_OUTPUT_MAGIC_NUMBERS = { 1.0, 1.0, -1.0, -1.0 };
public static final int DRIVE_MAX_UNLOGGED_LOOPS = 15;
/**
* Inputs & Controls
*/
public static final int DRIVE_CARTESIAN_JOYSTICK = 0;
public static final int DRIVE_POLAR_JOYSTICK = 1;
public static final int DRIVE_SECONDARY_JOYSTICK = 2;
/** Controler Mappings */
// <<God Mode>>
// 1 : A - Tractor Beam on toggle?
// 2 : B - #Pizza Auto
// 3 : X - Ion Cannon Low <<Toggle Shooter>>
// 4 : Y - Ion Cannon High <<Toggle Cow>>
// 5 : Left Shoulder Button - Snake Reverse
// 6 : Right Shoulder Button - Vision Alignment
// 7 : Back - Enable safe mode
// 8 : Start - Enable god mode
// 9 : Press left joystick -
// 10 : Press right joystick - Pizza extend or retract
// 0 : X axis-left joystick -
// 1 : Y axis-left joystick - Telescope up down << Move Snake >>
// 2 : LT - << Acts as a toggle for Tractor Beam >>
// 3 : RT - << Ion Cannon Raw Voltage >>
// 4 : X axis-right joystick - Pizza Manual Spin
// 5 : Y axis-right joystick - << Move Serializer >>
/** Controler Map Assignment */
// Ion Cannon
public static final int ION_LOW_BT = 3; // X
public static final int ION_HIGH_BT = 4; // Y
public static final int ION_SHOOT_BT = 6; // Right Shoulder Button
public static final int ION_VISION_BT = 2;
public static final int GOD_ION_AX = 3; // << RT >>
public static final int GOD_EX_BT = 3; // << X >>
// Lightsaber
public static final int LIGHTSABER_AX = 1; // Y axis-left joystick
// Pizza
public static final int PIZZA_AUTO_BT = 2; // B
public static final int PIZZA_EXTEND_BT = 10; // Press right joystick
public static final int PIZZA_SPIN_AX = 4; // X axis right
// Tokamak
public static final int SNAKE_REVERSE = 5;
public static final int GOD_SNAKE_AX = 1; // << Y axis-left joystick >
public static final int GOD_SERIALIZER_AX = 5; // << Y axis-right joystick >>
// Tractor Beam
public static final int TB_ACTIVATE_BT = 1; // A
public static final int GOD_TB_AX = 2; // << LT >> acts as button
public static final int GOD_EF_BT = 4; // << Y >>
/** Misc */
public static final int GOD_ENABLE = 8;
public static final int SAFE_ENABLE = 7;
/**
* Unique Game Values Go Here
*/
/**
* Ports: Talons, Sparks and Pistons
*/
// TESTING
public static final int testing1talon = 30;
public static final int testing2talon = 31;
/** Ion Cannon */
public static final int ION_CANNON_TOP = 20; // Talon
public static final int ION_CANNON_BOTTOM = 21; // Talon
public static final int SHOOTER_BOTTOM_EXTEND_HP = 4; // Double Solenoid - High
public static final int SHOOTER_BOTTOM_EXTEND_LP = 5; // '' - Low
public static final int SHOOTER_TOP_SOLENOID_PORT = 3;
/** Lightsaber */
public static final int LIGHTSABER_TOP = 30; // Spark
public static final int LIGHTSABER_BOTTOM = 31; // Spark
public static final int LOCKING_ACTIVATOR_PORT = 1; // Solenoid
/** Pizza */
public static final int PIZZA_SLICER = 40; // UNKNOWN
public static final int SCOMP_LINK_PORT = 0; // Double Solenoid
/** Tokamak */
public static final int TOKAMAK_TOP = 51; // Talon
public static final int TOKAMAK_BOTTOM = 50; // Talon
/** Tractor Beam */
public static final int TRACTOR_BEAM = 60; // Talon
public static final int EF_ENGAGER_HIGHSIDE_PORT = 6; // Double Solenoid
public static final int EF_ENGAGER_LOWSIDE_PORT = 7; // ''
/** Ion Cannon */
public static final double IC_CORRECTIONAL_GAIN = 0.0001761804;
public static final double IC_DEPLOY_DELAY = 0.65; // In milliseconds
public static final int ION_SPEED = 2000;
public static final int ION_OFFSET = 21;
/** Lightsaber */
public static final double LS_CORRECTIONAL_GAIN = 0.1;
public static final double LS_TARGET_SPEED = 0.28;// 0.33;
public static final double MAX_ENCODER_POSITION = -82.336;
public static final double MIN_ENCODER_POSITION = 0;
/** Pizza */
/** Tokamak */
public static final double SERIALIZER_SPEED = 0.75;
public static final double TOKAMAK_SPEED = -0.65;
public static final double TOKAMAK_JIGGLE_SPEED = 0.5;
public static final double TOKAMAK_CURRENT = 1000;
public static final int JIGGLE_REPITITIONS = 2;
public static final double JIGGLE_INTERVAL = 0.5;
/** Tractor Beam */
public static final double TRACTOR_BEAM_SPEED = -0.5;
/**
* Auton Stuff
*/
/** Important Numbers */
//norm/starting conditions arm down, lift down, facing alliance station
public static final double HORIZONTAL_MULTIPLIER = 1.4;
public static final double AUTON_DEFAULT_SPEED = -0.5;
public static final double AUTON_FAST_SPEED = -0.8;
public static final double FIRE_TIME = 1500;
public static final double ARM_OPENING_TIME = 100;
public static final double AUTON_RUNTIME = 4000;
public static final double AUTON_FAST_RUNTIME = 4000;
public static final double AUTON_RETURN_MULTIPLIER = 0.75;
public static final double SIDE_TO_MID_RUNTIME = 1500;
public static final double MID_TO_CUBE_RUNTIME = 1500;
public static double DIRECTIONAL_MULTIPLIER = 1.0; //Technically the multiplier for returning to spot
public static double MID_ANGLE = 33.0; //Angles for moving from mid to switch
public static double EDGE_ANGLE = 55.0; //Angles for moving from edge (far left or right starting positions) to switch
/** Auton Sequences */
/*
public static final double[][] CONTINGENCY_RIGHT_SWITCH_FROM_LEFT_SEQUENCES = {{36.87, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}};
public static final double[][] CONTINGENCY_LEFT_SWITCH_FROM_RIGHT_SEQUENCES = {{-36.87, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}};
public static final double[][] CONTINGENCY_LEFT_SWITCH_FROM_MID_SEQUENCES = {{-14.04, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}};
public static final double[][] CONTINGENCY_RIGHT_SWITCH_FROM_MID_SEQUENCES = {{14.04, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}};
*/
/*
public static final double[][] LEFT_SWITCH_FROM_LEFT_AND_RETURN_SEQUENCES = {{0, (AUTON_DEFAULT_SPEED), 0.0, 11, AUTON_RUNTIME}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 1000}, {-32.735, AUTON_DEFAULT_SPEED, 0.0, 11, 2000}}; //Move straight to switch and eject cube
public static final double[][] LEFT_SWITCH_FROM_MID_AND_RETURN_SEQUENCES = {{-14.04, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 1000}, {-32.735, AUTON_DEFAULT_SPEED, 0.0, 11, 2000}}; //Move to switch at an angle and eject cube
public static final double[][] RIGHT_SWITCH_FROM_MID_AND_SEQUENCES = {{14.04, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 1000}, {32.735, AUTON_DEFAULT_SPEED, 0.0, 11, 2000}}; //Move to switch at an angle and eject cube
public static final double[][] RIGHT_SWITCH_FROM_LEFT_AND_SEQUENCES = {{36.87, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 1000}, {32.735, AUTON_DEFAULT_SPEED, 0.0, 11, 2000}}; //Move to switch at an angle and eject cube
public static final double[][] LEFT_SWITCH_FROM_RIGHT_AND_SEQUENCES = {{-36.87, AUTON_DEFAULT_SPEED, 0.0, 11, AUTON_RUNTIME}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 1000}, {-32.735, AUTON_DEFAULT_SPEED, 0.0, 11, 2000}}; //Move to switch at an angle and eject cube
public static final double[][] RIGHT_SWITCH_FROM_RIGHT_AND_SEQUENCES = {{0, (AUTON_DEFAULT_SPEED), 0.0, 11, AUTON_RUNTIME}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 1000}, {32.735, AUTON_DEFAULT_SPEED, 0.0, 11, 2000}}; //Move straight to switch and eject cube
*/
public static final double[] PUSH_FORWARD = {0, -.35, 0.0, 11, 750};
public static final double[][] TEST_SEQUENCES = {{0.0, (AUTON_FAST_SPEED), 0.0, 13, 1000}};
public static final double[][] FORWARD_SHOOT_SEQUENCES = {{0.0, (AUTON_FAST_SPEED), 0.0, 13, 2800}, PUSH_FORWARD, {0.0, 0.0, 0.0, 2, ARM_OPENING_TIME}, {0.0, 0.0, 0.0, 14, FIRE_TIME}};
public static final double[][] FORWARD_SHOOT_GRAB_CUBE_SEQUENCES = {{0, (AUTON_FAST_SPEED), 0.0, 13, AUTON_FAST_RUNTIME}, {0.0, 0.0, 0.0, 2, ARM_OPENING_TIME}, {0.0, 0.0, 0.0, 14, FIRE_TIME}, {0.0, -1.0*AUTON_FAST_SPEED, 0.0, 11, AUTON_FAST_RUNTIME*AUTON_RETURN_MULTIPLIER}, {90.0*DIRECTIONAL_MULTIPLIER, AUTON_DEFAULT_SPEED, 0.0, 11, SIDE_TO_MID_RUNTIME}, {0.0, 0.0, 0.5, 11, 1000}, {0.0, 0.0, 0.0, 1, 50}, {0.0, 0.0, 0.0, 6, 500}, {0.0, AUTON_DEFAULT_SPEED, 0.0, 11, MID_TO_CUBE_RUNTIME}, {0.0, 0.0, 0.0, 5, 1000}, {0.0, 0.0, 0.0, 9, 50}, {90.0*DIRECTIONAL_MULTIPLIER, -1.0*AUTON_DEFAULT_SPEED, 0.0, 11, SIDE_TO_MID_RUNTIME}};//, {-32.735, AUTON_FAST_SPEED, 0.0, 11, AUTON_FAST_RUNTIME*AUTON_RETURN_MULTIPLIER}}; //Move straight to switch and eject cube
public static final double[][] LEFT_SWITCH_FROM_MID_SEQUENCES = {{(-1*(MID_ANGLE + 4.0)), AUTON_FAST_SPEED, 0.0, 13, AUTON_FAST_RUNTIME}, PUSH_FORWARD, {0.0, 0.0, 0.0, 2, ARM_OPENING_TIME}, {0.0, 0.0, 0.0, 14, FIRE_TIME}}; //Move to switch at an angle and eject cube
public static final double[][] RIGHT_SWITCH_FROM_MID_SEQUENCES = {{MID_ANGLE, AUTON_FAST_SPEED, 0.0, 13, AUTON_FAST_RUNTIME}, PUSH_FORWARD, {0.0, 0.0, 0.0, 2, ARM_OPENING_TIME}, {0.0, 0.0, 0.0, 14, FIRE_TIME}}; //Move to switch at an angle and eject cube
//public static final double[][] RIGHT_SWITCH_FROM_LEFT_SEQUENCES = {{EDGE_ANGLE, AUTON_FAST_SPEED, 0.0, 13, AUTON_FAST_RUNTIME}, {0.0, 0.0, 0.0, 2, ARM_OPENING_TIME}, {0.0, 0.0, 0.0, 14, FIRE_TIME}}; //Move to switch at an angle and eject cube
//public static final double[][] LEFT_SWITCH_FROM_RIGHT_SEQUENCES = {{(-1*(EDGE_ANGLE)), AUTON_FAST_SPEED, 0.0, 13, AUTON_FAST_RUNTIME}, {0.0, 0.0, 0.0, 2, ARM_OPENING_TIME}, {0.0, 0.0, 0.0, 14, FIRE_TIME}};//Move to switch at an angle and eject cube
//public static final double[][] LEFT_SIDE_DELIVERY_SEQUENCES = {{0.0, 0.0, ((-0.4)), 0, 1000}, {0.0, AUTON_DEFAULT_SPEED, 0.0, 11, 1000}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 100}, {0.0, 0.0, 0.0, 5, 100}}; //After forwards sequence turn using DIRECTIONAL_MULTIPLIER multiplier and then move forwards and eject cube into switch
//public static final double[][] RIGHT_SIDE_DELIVERY_SEQUENCES = {{0.0, 0.0, ((0.4)), 0, 1000}, {0.0, AUTON_DEFAULT_SPEED, 0.0, 11, 1000}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 100}, {0.0, 0.0, 0.0, 5, 100}}; //After forwards sequence turn using DIRECTIONAL_MULTIPLIER multiplier and then move forwards and eject cube into switch
public static final double[][] FORWARD_SEQUENCE = {{0, (AUTON_DEFAULT_SPEED), 0.0, 11, 2800}};
//public static final double[][] RIGHT_SCALE_UNIVERSAL_AUTON_SEQUENCES = {{Autonomous.find_angle_theta(Robot.right_x, Robot.right_y), -0.5, 0.0, 13, 5000}, {0.0, 0.0, 0.0, 10, 1000}, {0.0, 0.0, 0.0, 1, 50}, {0.0, 0.0, 0.0, 2, 50}, {-90.0, 0.75, 0.0, 13, 2000}, {0.0, -0.75, 0.0, 11, 2500}, {90.0, -0.75, 0.0, 11, 2000}, {0.0, 0.5, 0.0, 11, 1000}, {0.0, 0.0, 0.0, 6, 50}, {0.0, 0.0, 0.0, 5, 500}, {0.0, 0.0, 0.0, 3, 50}, {0.0, 0.0, 0.0, 4, 100}, {0.0, 0.0, 0.0, 2, 50}, {0.0, 0.0, 0.0, 5, 1}, {0.0, -0.75, 0.0, 13, 2000}, {0.0, 0.0, 0.0, 7, 100}, {0.0, 0.0, 0.0, 10, 200}}; // Add an angle into index 0
//public static final double[][] LEFT_SCALE_UNIVERSAL_AUTON_SEQUENCES = {{Autonomous.find_angle_theta(Robot.left_x, Robot.left_y), -0.5, 0.0, 13, 5000}, {0.0, 0.0, 0.0, 10, 1000}, {0.0, 0.0, 0.0, 1, 50}, {0.0, 0.0, 0.0, 2, 50}, {90.0, 0.75, 0.0, 13, 2000}, {0.0, -0.75, 0.0, 11, 2500}, {-90.0, -0.75, 0.0, 11, 2000}, {0.0, 0.5, 0.0, 11, 1000}, {0.0, 0.0, 0.0, 6, 50}, {0.0, 0.0, 0.0, 5, 500}, {0.0, 0.0, 0.0, 3, 50}, {0.0, 0.0, 0.0, 4, 100}, {0.0, 0.0, 0.0, 2, 50}, {0.0, 0.0, 0.0, 5, 1}, {0.0, -0.75, 0.0, 13, 2000}, {0.0, 0.0, 0.0, 7, 100}, {0.0, 0.0, 0.0, 10, 200}}; // Add an angle into index 0
public static final double[][] PICKUP_FROM_SPOT = {{0.0, 0.0, 0.5, 0, 1000}, {(-1*AUTON_DEFAULT_SPEED), 0.0, 0.0, 13, 2000}, {0.0, 0.0, 0.0, 2, 50}, {0.0, 0.0, 0.0, 6, 50}, {(-1*AUTON_DEFAULT_SPEED), 0.0, 0.0, 13, 1000}, {0.0, 0.0, 0.0, 5, 50}, {0.0, 0.0, 0.0, 9, 50}, {AUTON_DEFAULT_SPEED, 0.0, 0.0, 11, 2000}}; //Pickup a cube, return to common starting spot, and then move cube onto lift
public static final double[][] RIGHT_SCALE_FROM_SPOT = {{90.0, (-1*(AUTON_DEFAULT_SPEED)), 0.0, 13, 3000}, {0.0, AUTON_DEFAULT_SPEED, 0.0, 13, 3000}, {0.0, 0.0, 0.0, 7, 500}, {0.0, 0.0, 0.0, 14, 100}};
public static final double[][] LEFT_SCALE_FROM_SPOT = {{-90.0, (-1*(AUTON_DEFAULT_SPEED)), 0.0, 13, 3000}, {0.0, AUTON_DEFAULT_SPEED, 0.0, 13, 3000}, {0.0, 0.0, 0.0, 7, 500}, {0.0, 0.0, 0.0, 14, 100}};
public static final double[][] AUTON_EXCHANGE_FROM_SPOT = {{32.0, (-1*(AUTON_DEFAULT_SPEED)), 0.0, 13, 3000}};
// {angle,strength/speed,turning,mode,time}
// {ROTATIONS, ANGLE, SHOOTING TIME, INTAKE TIME} 2020 AUTON FORMAT
// DRIVING AROUND HAPPENS LAST
public static final double[][] SIMPLE_NEW_AUTON = {{100, 0, 0, 0}, {0, 0, 10, 0}, };
public static final double[] FORWARD_CLOCKWISE = {0.3, 0.0, -0.5};
public static final double[] FORWARD_COUNTERCLOCK = {0.3, 0.0, 0.5};
public static final double[] FORWARD_RIGHT = {0.3, 0.5, 0.0};
public static final double[] FORWARD_LEFT = {0.3, -0.5, 0.0};
public static final double[] FORWARD = {0.5, 0.0, 0.0};
// {forward, right, counterclock}
// 2021 sequences
public static final double[][] RIGHT_FORWARD_PIZZA = {{0.0, 0.0, 0.0, 1.0}, {5.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 0.0, -1.0}, {-5.0, 0.0, 0.0, 0.0}};
/** Get Sequence Methods */
public static double[][] get_side_delivery_sequence(double DIRECTIONAL_MULTIPLIER) {
double[][] SIDE_DELIVERY_SEQUENCES = {{0.0, 0.0, (DIRECTIONAL_MULTIPLIER*(0.4)), 0, 1000}, {AUTON_DEFAULT_SPEED, 0.0, 0.0, 0, 1000}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 100}};
return SIDE_DELIVERY_SEQUENCES;
}
public static double[][] get_return_to_spot_sequence(double DIRECTIONAL_MULTIPLIER) {
double angle = MID_ANGLE;
if(DIRECTIONAL_MULTIPLIER == -1.0)
angle = MID_ANGLE + 4;
double[][] RETURN_TO_SPOT = {{((-angle)*(-1*DIRECTIONAL_MULTIPLIER)), (-1*AUTON_FAST_SPEED), 0.0, 11, 1500}, {0.0, 0.0, (DIRECTIONAL_MULTIPLIER*(0.4)), 0, 2000}, {0.0, 0.0, 0.0, 0.0, 100}};
return RETURN_TO_SPOT;
}
public static double[][] get_spot_to_switch_sequence(double DIRECTIONAL_MULTIPLIER) { //WARNING: HAS NOT BEEN TESTED
double[][] SPOT_TO_SWITCH = {{(90-MID_ANGLE*(-1*DIRECTIONAL_MULTIPLIER)), AUTON_DEFAULT_SPEED, 0.0, 13, 2000}};
return SPOT_TO_SWITCH;
}
public static double[][] get_alternate_switch_sequence(double DIRECTIONAL_MULTIPLIER) {
double[][] ALTERNATE_SWITCH_SEQUENCES = {{(45*(DIRECTIONAL_MULTIPLIER)), 0.0, 0.0, 11, 1000}, {0.0, AUTON_DEFAULT_SPEED, 0.0, 13, 3000}, {0.0, 0.0, 0.0, 2, 100}, {0.0, 0.0, 0.0, 14, 100}, {0.0, 0.0, 0.0, 5, 100}};
return ALTERNATE_SWITCH_SEQUENCES;
}
/** Logger */
public static enum LOGGED_CLASSES { SEMAPHORE, DRIVE, GROUNDTRUTH, PNEUMATICS, SHOOTER }
public static final String TEAM_BANNER = "ICAgICAgICAgICBfX18gICAgICAgICAgICAgIF9fICBfXw0KICAgICAgICAgICAgfCBfIF8gIF8gICAgL3wgfF8gIC8gIFwgfF9ffA0KICAgICAgICAgICAgfCgtKF98fHx8ICAgIHwgX18pIFxfXy8gICAgfA0KDQogICAgICAgICAgICAgICAgICAgICAgICAgXy4NCiAgICAgICAgICAgICAgICAgICAgICAgLicgb28NCiAgICAgICAgICAgICAgICAgICAgICAgfCAgICA+DQogICAgICAgICAgICAgICAgICAgICAgLyAvIDogYC4NCiAgICAgICAgICAgICAgICAgICAgIHxfLyAvICAgfA0KICAgICAgICAgICAgICAgICAgICAgICB8LyAgd3cNCl9fXyAgICAgICAgX18gICAgICAgICAgICAgICAgICAgICAgX18NCiB8IHxfICBfICB8ICBcIF8gXyBfICBfIF8gXyB8XyBfICB8X18pXyBfICBfICAgIC4gXyAgXw0KIHwgfCApKC0gIHxfXy8oLV8pfF8pKC18IChffHxfKC0gIHwgICgtfCApKF8pfF98fHwgKV8pDQogICAgICAgICAgICAgICAgICB8ICAgICAgICAgICAgICAgICAgICAgICBfLw==";
public static final String ROBOT_BANNER = "ICAgICAvXCAgICAgL1wgICAgICAgICAgICAgICoNCiAgICAnLiBcICAgLyAsJyAgICAgICAgICAgICAgXCAgIH4NCiAgICAgIGAuXC0vLCcgICAgICAgICAgICAgXywsIFwge10NCiAgICAgICAoIFggICApICAgICAgICAgICAiLT1cO19cICUNCiAgICAgICwnLyBcYC5cICAgICAgICAgICAgXyBcXDsoIyklDQogICAgLicgLyAgIFwgYCwgICAgICAgICAgIF9cfCBcXyUlDQogICAgIFwvLS0tLS1cLycgICAgICAgICAgIFwgIFwvXCAgXA0KX19fX19fIHxfSF9fX3xfX19fX19fX19fX19fX18gKCApfn5+X19fXw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCBcDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8gIC8=";
}
|
Single Spin Asymmetry in Open Charm Photoproduction and Decay as a Test of pQCD
We analyze the possibility of measuring the single spin asymmetry (SSA) in open charm production by linearly polarized photons in the planned E160/E161 experiments at SLAC using the inclusive spectra of secondary (decay) leptons. In leading order pQCD, the SSA in the azimuthal distribution of the charged decay lepton is predicted to be about 0.2 for SLAC kinematics. Our calculations show that the SSA in the decay lepton distribution is well defined in pQCD: it is stable both perturbatively and parametrically, and practically insensitive to theoretical uncertainties in the charm semileptonic decays. Nonperturbative contributions to the leptonic SSA due to the gluon transverse motion in the target, heavy quark fragmentation and Fermi motion of the $c$-quark inside the $D$-meson are predicted to be about 10%. We conclude that measurements of the azimuthal asymmetry in the secondary lepton distribution would provide a good test of the applicability of pQCD to open charm production at energies of fixed target experiments. Our analysis of the SLAC experimental conditions shows that this SSA can be measured in E160/E161 with an accuracy of about ten percent.
INTRODUCTION
In the framework of perturbative QCD, the basic spin-averaged characteristics of heavy flavor hadro-, photo-and electroproduction are known exactly up to the next-to-leading order (NLO). During the last ten years, these NLO results have been widely used for a phenomenological description of available data (for a review see ). At the same time, the key question remains open: How to test the applicability of QCD at fixed order to heavy quark production? The problem is twofold. On the one hand, the NLO corrections are large; they increase the leading order (LO) predictions for both charm and bottom production cross sections by approximately a factor of two. For this reason, one could expect that higher-order corrections, as well as nonperturbative contributions, can be essential, especially for the c-quark case. On the other hand, it is very difficult to compare pQCD predictions for spin-averaged cross sections with experimental data directly, without additional assumptions, because of a high sensivity of the theoretical calculations to standard uncertainties in the input QCD parameters. The total uncertainties associated with the unknown values of the heavy quark mass, m Q , the factorization and renormalization scales, µ F and µ R , Λ QCD and the parton distribution functions are so large that one can only estimate the order of magnitude of the pQCD predictions for total cross sections at fixed target energies .
In recent years, the role of higher-order corrections has been extensively investigated in the framework of the soft gluon resummation formalism. For a review see Ref. . Formally resummed cross sections are ill-defined due to the Landau pole contribution, and a few prescriptions have been proposed to avoid the renormalon ambiguities . Unfortunately, numerical predictions for the heavy quark production cross sections can depend significantly on the choice of resummation prescription . Another open question, also closely related to convergence of the perturbative series, is the role of subleading contributions which are not, in principle, under control of the resummation procedure .
For this reason, it is of special interest to study those observables that are well-defined in pQCD. An nontrivial example of such an observable is proposed in , where the charm and bottom production by linearly polarized photons, was considered 1 . In particular, the single spin asymmetry (SSA) parameter, A Q (p QT ), which measures the parallelperpendicular asymmetry in the quark azimuthal distribution, where has been calculated. In (2) and (3), dpQT dϕQ (p QT , ϕ Q ), P γ is the degree of linear polarization of the incident photon beam and ϕ Q is the angle between the beam polarization direction and the observed quark transverse momentum, p QT . The following remarkable properties of the SSA, A Q (p QT ), have been observed : • The azimuthal asymmetry (3) is of leading twist; in a wide kinematical region, it is predicted to be about 0.2 for both charm and bottom quark production.
• At energies sufficiently above the production threshold, the LO predictions for A Q (p QT ) are insensitive (to within few percent) to uncertainties in the QCD input parameters.
• Nonperturbative corrections to the b-quark azimuthal asymmetry are negligible. Because of the smallness of the c-quark mass, the analogous corrections to A c (p QT ) are larger; they are of the order of 20%.
In Ref. , radiative corrections to the integrated cross section, have been investigated in the soft-gluon approximation. (In Eq. (4), √ S is the center-of-mass energy of the process (1)). Calculations indicate a high perturbative stability of the pQCD predictions for A Q (S). In particular, • At the next-to-leading logarithmic (NLL) level, the NLO and NNLO predictions for A Q (S) affect the LO results by less than 1% and 2%, respectively.
• Computations of the higher order contributions (up to the 6th order in α s ) to the NLL accuracy lead only to a few percent corrections to the Born result for A Q (S). This implies that large soft-gluon contributions to the spin-dependent and unpolarized cross sections cancel each other in Eq. (3) with a good accuracy.
Therefore, contrary to the production cross sections, the single spin asymmetry in heavy flavor photoproduction is an observable quantitatively well defined in pQCD: it is stable, both parametrically and perturbatively, and insensitive to nonperturbative corrections. Measurements of the SSA in bottom photoproduction would provide an ideal test of pQCD. Data on the D-meson azimuthal distribution would make it possible to clarify the role of subleading twist contributions .
Concerning the experimental aspects, the azimuthal asymmetry in charm photoproduction can be measured at SLAC where a coherent bremsstrahlung beam of linearly polarized photons with energies up to 40 GeV will be available soon . In the approved experiments E160 and E161, charm production will be investigated using the spectra of decay muons: In this paper, we analyze the possibility to measure the SSA in heavy quark photoproduction using the decay lepton spectra. We calculate the SSA in the decay lepton azimuthal distribution: where ϕ ℓ is the angle between the photon polarization direction and the decay lepton transverse momentum, p ℓT . Our main results can be formulated as follows: • The SSA transferred from the decaying c-quark to the decay muon is large in the SLAC kinematics; the ratio • pQCD predictions for A ℓ (p ℓT ) are also stable, both perturbatively and parametrically.
• Nonperturbative corrections to A ℓ (p ℓT ) due to the gluon transverse motion in the target and the c-quark fragmentation are small; they are about 10% for p ℓT >1 GeV.
• The SSA in Eq. (6) depends weakly on theoretical uncertainties in the charm semileptonic decays 2 , c → ℓ + ν ℓ X q (q = d, s). In particular, -Contrary to the the production cross sections, the asymmetry A ℓ (p ℓT ) is practically insensitive to the unobserved stange quark mass, m s , for p ℓT >1 GeV.
-The bound state effects due to the Fermi motion of the c-quark inside the D-meson have only a small impact on A ℓ (p ℓT ), in practically the whole region of p ℓT .
We conclude that the SSA in the decay lepton azimuthal distribution (6) is also well-defined in the framework of perturbation theory and can be used as a good test of pQCD applicability to open charm production.
The paper is organized as follows. In Section 2 we analyze the properties of the decay lepton azimuthal distribution at leading order. We also give the physical explanation of the fact that pQCD predictions for the SSA are approximately the same at LO and at NLO. The details of our calculations of radiative corrections are too long to be presented in this paper; they will be reported separately in a forthcoming publication . In Section 3 we discuss the nonperturbative contributions to A ℓ (p ℓT ) caused by the Peterson fragmentation, the k T -kick and the Fermi motion of the heavy quark inside the heavy hadron. Section 4 contains experimental considerations. We discuss the conditions needed to measure the SSA at SLAC, estimate background contributions and expected errors.
is given by B Q (s, t 1 , u 1 ) = πe 2 Q α em α s with e Q the quark charge in units of electromagnetic coupling constant. The corresponding partonic kinematical variables are with θ Q and E Q the heavy quark polar angle and energy in the γg center-of-mass system. At the tree level, the invariant width of the semileptonic decay Q → ℓν ℓ X q can be written as Here V CKM denotes the corresponding element of the Cabbibo-Kobayashi-Maskawa matrix, G F is the Fermi constant, δ = m q /m Q and where E ℓ is the lepton energy and θ ℓQ is the angle between the lepton and heavy quark momenta in the γg center-of-mass system. To perform the angular integrations in Eq. (9), we use the cosine theorem: where ϕ ℓQ is the azimuth of the lepton momentum in the frame where the third axis is directed along the heavy quark momentum. Substituting d 2 Ω Q →d 2 Ω ℓQ =dcos θ ℓQ dϕ ℓQ in Eq. (9), we obtain the following master formula for the decay lepton azimuthal distribution: where the limits of integration are given by Note that Eqs.(17)- (19) are applicable not only at the Born level, but also in all those cases when radiative corrections have a factorizable form (9). At the tree level, Eq.(17) can be simplified due to δ-function in the Born cross sections (10) and (11).
B. Hadron Level Results at LO
At the hadron level, the overall one-particle inclusive kinematical invariants of the reaction (5) are defined as The hadron level cross section has the form of a convolution: in which g(z, µ F ) is the gluon distribution function and µ F is the factorization scale. The lower limit of integration in Eq. (21) can be found from the kinematical restriction x ≤ 1 − δ 2 . The result is: where Experimentally, to suppress the background contributions originating from semileptonic decays of light hadrons and Bethe-Heitler process, a cut of the lepton energy in the reaction (5) is usually used . For this reason, apart from the usual differential distribution, we consider also the quantity In Eqs. (24) and (25), E * ℓ is the lepton energy in the lab (nucleon rest) frame, with the maximum value and an experimental cutoff E * ℓ,cut ; λ ± = 1 ± m 2 N /S and β = 1 − 4m 2 Q /S. Let us discuss the hadron level pQCD predictions for the asymmetry in azimuthal distribution of the decay lepton. In this paper, we will discuss only the charm photoproduction at the SLAC energy E γ ≈ 35 GeV, with E γ = (S −m 2 N )/2m N . Unless otherwise stated, the CTEQ5M parametrization of the gluon distribution function is used. The default value of the charm quark mass is m c = 1.5 GeV.
Our calculations of the quantities A µ (p T ) and A c (p T ) are given in Fig.1 by solid and dashed lines, respectively. One can see that the asymmetry transferred from the decaying c-quark to the decay muon is large in the SLAC kinematics; the ratio A µ (p T )/A c (p T ) is about 90% for p T >1 GeV. Note that p T ≡ p QT when we consider the heavy quark production and p T ≡ p ℓT when the quantity A µ (p ℓT ) is discussed.
In Fig. 2 we show the LO predictions for A µ (p T ) at different values of the cutoff parameter E * ℓ,cut . One can see that, contrary to the production cross sections, the SSA depends weakly on E * ℓ,cut over practically the whole region of p T . This property of A µ (p T ) will be especially useful in interpretation of data. In Fig. 3 we show the SSA, A µ (p T ), in different intervals of the muon energy E * ℓ . The most interesting property of the azimuthal asymmetry, closely related to fast perturbative convergence, is its parametric stability 3 . As was shown in , the LO predictions for A Q (p T ) are insensitive (to within few percent) to standard theoretical uncertainties in the QCD input parameters: µ R , µ F , Λ QCD and in the gluon distribution function. We have verified that the same situation takes place in the case of decay leptons too. In particular, all the CTEQ5 versions of the gluon density, as well as the MRST parametrizations, lead to predictions for A µ (p T ) that coincide with each other with an accuracy of better than 1-2%.
The main source of uncertainties in the LO predictions for both A c (p T ) and A µ (p T ) is the charm quark mass. The dependence of p T -spectra on the variation of m c is shown in Fig. 4 and Fig. 5 for A c (p T ) and A µ (p T ), respectively. One can see that changes of the charm quark mass in the interval 1.3 < m c < 1.7 GeV affect the quantity A c (p T ) by less than 20% at p T < 2.5 GeV. Analogous changes of m c lead to 20% variations of A µ (p T ) at 1 < p T < 2.5 GeV.
We have also analyzed the dependence of the SSA in the lepton distribution on the unobserved strange quark mass, m s . Fig. 5 shows that the LO predictions for A µ (p T ) are practically independent of δ = m s /m c at p T >1 GeV.
C. Radiative Corrections
In Ref. , radiative corrections to the SSA in heavy quark production by linearly polarized photons have been investigated in the soft-gluon approximation. The calculations show that the azimuthal asymmetry in both charm and bottom production is practically insensitive to the soft-gluon corrections at energies of the fixed target experiments. This implies that large soft-gluon contributions to the spin-dependent and unpolarized cross sections cancel each other in Eq. (3) with a good accuracy. One can assume that the same situation takes place for the azimuthal asymmetry in the decay lepton distribution.
Our calculations of the factorizable NLO corrections to A µ (p T ) show that this is really the case. We have computed both spin-dependent and unpolarized differential distributions (10) of the heavy-quark photoproduction at NLO to the next-to-leading logarithmic accuracy. The NLO corrections to the width of the heavy quark semileptonic decays are known exactly . We have found that radiative corrections to the leptonic SSA, A µ (p T ), in the reaction (5) are of the order of 1% in the SLAC kinematics.
Two main reasons are responsible for perturbative stability of the quantity A µ (p T ). First, radiative corrections to the SSA in heavy quark production are small . Second, the ratio I NLO sl (x)/I Born sl (x) is a constant practically at all x, except for a narrow endpoint region x ≈ 1 . (Note that I Born sl (x) is the LO invariant width of the semileptonic decay c → ℓ + ν ℓ X q given by (14) while I NLO sl (x) is the corresponding NLO one.) The details of our NLO analysis are too long to be presented here and will be given in a separate publication .
III. NONPERTURBATIVE CONTRIBUTIONS
Let us discuss how the pQCD predictions for single spin asymmetry are affected by nonperturbative contributions due to the intrinsic transverse motion of the gluon and the hadronization of the produced heavy quark. Because of the relatively low c-quark mass, these contributions are especially important in the description of the cross section for charmed particle production . At the same time, our analysis shows that nonperturbative corrections to the single spin asymmetry are not large.
A. Fragmentation
Hadronization effects in heavy flavor production are usually modeled with the help of the Peterson fragmentation function , where a ε is a normalization factor and ε D = 0.06 in the case of a D-meson production. The double differential distribution of a heavy meson has the form where d 2 σQ dpQT dϕQ is the inclusive spectrum of the reaction (1) and y m = 2pDT β √ S . Our calculations of the asymmetry in a D-meson production at LO with and without the Peterson fragmentation effect are presented in Fig. 6 by dotted and solid curves, respectively. For p DT ≥ 1 GeV the fragmentation corrections to A c (p T ) are less than 10%.
Analogous corrections to the asymmetry in the decay lepton azimuthal distribution, A µ (p T ), are given in Fig. 7. One can see that the effect of the fragmentation function (28) is practically negligible in the whole region of p ℓT .
B. kT Smearing
To introduce k T degrees of freedom, k g ≃ z k N + k T , one extends the integral over the parton distribution function in Eq. (21) The transverse momentum distribution, f k T , is usually taken to be a Gaussian: In practice, an analytic treatment of k T effects is usually used. According to , the k T -smeared differential cross section of the process (1) is a 2-dimensional convolution: The factor 1 2 in front of k T in the r.h.s. of Eq. (32) reflects the fact that the heavy quark carries away about one half of the initial energy in the reaction (1).
Values of the k T -kick corrections to the asymmetry in the charm production, A c (p T ), are shown in Fig. 6 by dashed ( k 2 T = 0.5 GeV 2 ) and dash-dotted ( k 2 T = 1 GeV 2 ) curves. One can see that k T -smearing is important only in the region of relatively low p QT ≤ m c . Note also that the fragmentation and k T -kick effects practically cancel each other in the case of k 2 T = 0.5 GeV 2 . Corresponding calculations for the case of the lepton asymmetry are presented in Fig. 7. It is seen that A µ (p T ) is affected by k T -corrections systematically less than A c (p T ).
C. Fermi Motion
The third type of nonperturbative corrections we considered can be associated with the motion of the heavy quark inside the produced (and decaying) hadron; they are commonly referred to as Fermi motion. These effects are included in the heavy-quark expansion by resumming an infinite set of leading-twist corrections into a shape function F (k + ), where k + = k 0 + k 3 is the positive light cone component of the heavy quark residual momentum inside the heavy meson . The physical decay distributions, dΓ (H) sl , are obtained from a convolution of parton model spectra, dΓ (Q) sl , with this function. This convolution is such that, in the perturbative formula for the decay distribution, the heavy quark mass is replaced by the momentum-dependent mass m * = m Q + k + : The parton-level width, d 3 Γ Some of the properties of F (k + ) are known. The first three moments satisfy Λ 0 = 1, Λ 1 = 0 and Λ 2 = 1 3 µ 2 π , where µ 2 π is the average momentum squared of the heavy quark inside the heavy meson and the moments are defined by Λ n = k n + = Λ −mQ dk + k n + F (k + ) with Λ = M H − m Q . In our calculations we use a simple two-parametric model : where the condition Λ 0 = 1 fixes the normalization factor N and the parameter a is related to the second moment as Λ 2 = 1 3 µ 2 π = Λ 2 /(1 + a).
Our predictions for the asymmetry A µ (p T ) at different values of µ 2 π and Λ are give in Fig. 8. One can see that the bound state effects due to the Fermi motion of the heavy quark inside the heavy hadron are small in the whole region of p ℓT . Taking into account that A µ (p T ) is also practically independent of m s at p ℓT ≥ 1 GeV, we conclude that our predictions for the SSA in secondary lepton distribution are insensitive to the theoretical uncertainties in description of the charm semileptonic decays .
IV. EXPERIMENTAL CONSIDERATIONS
The conditions needed to measure the SSA in open charm photoproduction are: • a high intensity photon beam with energy above 30 GeV, • a high degree of linear polarization, and • a large acceptance spectrometer.
These conditions are similar to those of the approved E161 experiment at SLAC, in which circularly polarized photons impinging on longitudinally polarized nucleons will be used to study ∆G(x) via open charm production. To measure the SSA under consideration, target polarization is not needed, so the microwaves that polarize the planned LiD target can be turned off. Linearly polarized photons can be obtained with an appropriate choice of the diamond used to produce coherent bremsstrahlung. Two orientations of linear polarization are obtained by rotating the diamond. The SSA can be measured using high p T muons in the E161 spectrometer, with cuts that minimize backgrounds.
A. Photon Beam
The most important difference from E161 is the change from circular to linear polarization. The E161 experiment plans to use coherent bremsstrahlung from a diamond target to produce polarized photons. Longitudinally polarized electrons are needed for circular polarization, which is largest for large values of E γ /E e , where E e is the incident electron beam energy, and E γ is the resulting photon beam energy. To obtain linear polarization, the electrons can be unpolarized, and the extent of linear polarization is largest for low values of E γ /E e . For a fixed photon energy, it is therefore essential to use the highest possible value of E e , which is about 50 GeV at SLAC. Traditionally, thin diamonds and a high degree of photon collimation are used to enhance the ratio of coherent to incoherent photons, and hence the effective polarization. To obtain a sufficient flux of photons at SLAC, it is necessary to use a relatively thick diamond (we choose 1.5 mm), and a modest collimation angle of 35 µr, which is several times the characteristic bremsstrahlung angle m e /E e ≈ 10 µr. The photon intensity and the degree of linear polarization for a diamond orientation that produces a primary peak from the (022) inverse lattice point at 35 GeV are shown in Fig. 9 for the emittance and maximum intensity conditions of the SLAC electron beam. Calculations were done using a Monte Carlo simulation based on the formulas of Ref. . The flux in the region 30 to 35 GeV is about 10 10 photons/sec. The linear polarization peaks at about 0.4, with an average value of about 0.2 in the 30 to 35 GeV region. Contributions from the higher energy peaks (from the (044), (066), etc. inverse lattice points) will be small because both the flux and polarization are considerably reduced compared to the primary coherent peak.
B. Open Charm Detection and Backgrounds
Because of the poor duty factor at SLAC, simulations made for E161 have shown that the best signal-tobackground ratio is obtained by tagging open charm with one or more high transverse momentum muons. In the case of the SSA, the asymmetry rises rapidly with p T , then becomes roughly constant for p T > 1 GeV. All background processes except J/ψ decay decrease more rapidly with p T than open charm (as discussed in more detail below), therefore measuring at the highest possible p T will optimize signals over backgrounds. However, the open charm cross section decreases with p T , which reduces statistical accuracy. The best compromise is for p T values centered at 1 GeV.
The most significant background process generating single muon with high p T is the decay of pions and kaons. This was simulated using PYTHIA for typical photoproduction events that were allowed to decay in a block of copper placed close to the target. Studies using GEANT indicate that an effective path length before pions and kaons are absorbed is 50 cm of copper, so this was used as the effective decay length. The rates from π, K decays are shown as the diamonds in Fig. 10 for any sign muon with 7.5 < E * µ < 10 GeV. They are compared with the rate of muons predicted from open charm decay as calculated using the photon-gluon fusion process in PYTHIA, scaled by a factor of two to match experimental data. The π, K decay background is lower for negative muons than for positive muons by typically 50%, so one sign will be easier to measure than the other. The rate and SSA for π, K decay muons can be measured by moving the copper absorber a significant distance from the target, thus doubling or tripling the decay rates. Measurements can also be made for 5 < E * µ < 7.5 GeV, with somewhat larger relative backgrounds from π, K decays. In the interesting range 0.8 < p T < 1.2 GeV, π and K decays become dominant below E * µ ≈ 4 GeV, making experimental measurements difficult in this energy region. Another significant process is wide-angle muon pair production from the target nuclei (Li and D). The rates calculated using Ref. are shown as the crosses in Fig. 10. The rates are for events in which only one of the two muons from the Bethe-Heitler pair is detected in the proposed E161 spectrometer. Events in which both muons would be detected can be vetoed in the data analysis, reducing the Bethe-Heitler background by about a factor of two. The remaining background is well below the open charm rate. It can be calculated quite accurately, and reliable corrections applied to the data.
Backgrounds from the decay of vector mesons are relatively unimportant for p T ≈ 1 GeV, and can be measured using the approximately 50% of events in which both muons are detected in the spectrometer.
The final background is from J/ψ decay, for which the typical p T peaks around 1.5 GeV. Fortunately, most of the time the second muon is detected in the E161 spectrometer, so the background only becomes large for p T > 1. 3 GeV and E * µ > 10 GeV, and can be measured using the large sample of events in which both muons are detected. In summary, in the optimal case of negative muons with 7.5 < E * µ < 10 GeV and p T > 0.9 GeV, the signal-tobackground ratio is estimated to be about 3:1, leading to an effective dilution factor of about 1.3, equivalent to a factor of 1.6 more running time than is needed in the absence of backgrounds. This estimate relies crucially on the open charm cross section as a function of p T , which is poorly known at present (factor of two uncertainties). Thus, the relative background situation could be better or worse, depending on what open charm cross sections are measured in the experiment.
C. Projected Errors
The cross section for producing negative muons from open charm decays with 7.5 < E * µ < 10 GeV and p T > 0.9 GeV is approximately 0.2 to 0.5 nb at E γ = 35 GeV, as estimated using the PYTHIA Monte Carlo. If we assume the E161 luminosity, i.e. a flux of 10 10 photons per second, a 1.6 gm/cm 2 target, and a spectrometer acceptance of about 50% for the events of interest, the open charm rate is of order 100,000 events per day. For an average linear polarization of 0.2, a statistical error of about 0.02 on the SSA would be obtained in one day of running. This error bar is sufficient to make a good test of the QCD predictions, and further improvements to the statistical error would be soon be lost in the estimated 10% (relative) systematics error, dominated by the uncertainty in the linear polarization. With about a factor of four larger running time, measurements with an error of about 0.02 could be separately made of positive and negative muons, and in several bins of E * µ spanning 5 < E * µ < 20 GeV.
This would be very useful in testing the assumed dominance of the photon-gluon fusion mechanism. A difference in positive and negative muon results might indicate contributions from soft associated production processes, while high-x F behavior of the SSA can be sensitive to diffractive contributions . Approximately the same running time would be needed for 25 GeV incident photons as for E γ = 35 GeV, because the lower charm cross section and higher backgrounds would be compensated for by higher photon linear polarization.
V. CONCLUSION
In this paper we analyze the possibility to measure the SSA in open charm photoproduction in the E160/E161 experiments at SLAC where a coherent bremsstrahlung beam of linearly polarized photons with energies up to 40 GeV will be available soon. In these experiments, charm production will be investigated with the help of inclusive spectra of secondary muons. The SSA transferred from the decaying c-quark to the decay muon is predicted to be large for SLAC kinematics; the ratio A ℓ (p T )/A c (p T ) is about 90% at p T >1 GeV. Our calculations show that the SSA in decay lepton distribution preserves all remarkable properties of the SSA in heavy flavor production: it is stable, both perturbatively and parametrically, and practically insensitive to nonperturbative contributions due to the gluon transverse motion in the target and heavy quark fragmentation. We have also found that QCD predictions for A ℓ (p T ) depend weekly on theoretical uncertainties in the charm semileptonic decays. We conclude that measurements of A ℓ (p T ) in the E160/E161 experiments would provide a good test of pQCD applicability to open charm production.
Note also that because of the low c-quark mass, the power corrections to the charm production can be essential. As was shown in , the pQCD and Regge approaches lead to strongly different predictions for the single spin asymmetry in the region of low p T and large Feynman x F . Data on the p T -and x F -distributions of the SSA in D-meson photoproduction could make it possible to discriminate between these mechanisms.
|
ADVERTISEMENT
A year into Donald Trump's presidency, with the end of Robert Mueller's painstaking investigation of Russian interference in the 2016 election nowhere in sight, I have a confession to make.
On multiple occasions over the last several years I have attended private meetings with individuals who are members of a Moscow-based international organization that opposes gay marriage, the European Union, globalism, and secularism. Also present at some of these meetings were right-leaning journalists, heads of think tanks, and even federal officials. Over drinks — sometimes, yes, vodka — and cigarettes, political issues were discussed, the Obama administration roundly criticized, and at least once there was a long conversation about Russian intelligence. Between meetings I communicated via email and Twitter with these individuals, who were based for a time in Australia, where both were involved in politics and even lobbying. On more than one occasion I was responsible for ensuring that payments in the four-figure range were made into the bank account of one of the individuals. A few months before the first of the above encounters, I met Trump himself at a D.C. hotel. At a later meeting, the individual I had been compensating appeared at another meeting in Manhattan with prominent social conservatives at which she made arguments on behalf of Trump. A few months later he was president.
I hope Mueller's people are taking notes. The fact that the individuals in question are old friends, one of whom contributed to a magazine where I used to be an editor, that the Russian group to which they belong is the Orthodox Church, that one of these gatherings was their wedding reception, and that the discussion of foreign intelligence was actually a conversation about the old BBC television adaptation of John le Carré's Tinker Tailor Soldier Spy are probably irrelevant. Written vaguely enough, filtered through two or three other sources in a kind of telephone game, they sound like a breathless Daily Beast scooplette about what I like to think of as "the Russia thing." If I lied to a federal investigator about any of this — claiming, for example, that I was not in any way involved with the payments in question even though I negotiated the rates because our accounting department was responsible for mailing the check or getting the timeline of my first meeting with the president wrong — I could be writing this column under house arrest. Which might be fair, but would hardly prove "collusion."
That Trump in some unknown and indescribable but absolutely significant manner "colluded" — whatever that might involve — with "Russia" — a vague entity that might refer to anything or anyone from a nameless academic to Vladimir Putin himself — in order to steal the 2016 election from Hillary Clinton, who was otherwise an attractive candidate with a firm base of support even in the states she didn't bother to visit, is now one of the most begged questions in American history.
It's time to stop begging it. The investigation that began under James Comey and has continued under Robert Mueller has turned up absolutely nothing to support this thesis. Michael Flynn lied to the FBI about a conversation with Russian Ambassador Sergey Kislyak that took place after the election, which is shocking if you want to pretend that there is anything out of the ordinary about a member of a presidential transition team contacting foreign officials. An obscure character named George Papadopoulos once emailed an equally obscure character known only as "the Professor," an exchange that went nowhere. Paul Manafort has pled not guilty to money laundering, which is as unsurprising as it is far removed from what the investigation is supposed to be about. The Russia thing is a tedious and lurid spectacle, a shooting match, like Whitewater before it, in which armed participants are allowed to circle endlessly, at taxpayers' expense, around invisible targets that they mysteriously never manage to hit but whose existence is as obvious to one group of partisan onlookers as it is unthinkable to the other.
It is also a master course in how to construct a political narrative, something reporters and commentators do without realizing it. Most of them have memories as short as those of their readers and a frame of reference that, except for a handful of clichés about McCarthyism and Boss Tweed and the Compromise of 18-something-or-other, doesn't extend much further than Pizza Rat. It doesn't matter. Start with an irresistible general narrative, sprinkle in some suitably exotic if unconfirmable details about obviously grotesque characters, quote a handful of decontextualized communications, throw in some legalese that you don't understand, and you have an appalling scandal that deserves the attention of the entire American public, one that makes a mockery of the august values upon which this country was founded.
If the Russia thing has legs, so does Benghazi, a story about how individuals in the State Department actively worked to cover up the woeful under-preparedness of the security forces at a U.S. consulate in a war-torn country at the behest of the individual responsible for its ill-fated bombardment by NATO forces. So too does the new right-wing comic strip about a sinister "deep state" plot to prevent Trump from taking office — we even have a text message from an actual FBI agent admitting they have an "insurance policy" against it, guys! The news that a special prosecutor marched in to the offices of an obscure federal department and demanded records instead of obtaining them via subpoena is not going to keep me up at night agonizing over the future of the republic. But neither is anything that the Russia investigation has turned up or is ever likely to turn up.
I am not a partisan. Trump is a wicked man and his presidency a colossal failure. I would gladly see him impeached tomorrow, removed from office, and replaced with Bob, a guy I know from the coffee shop by my house.
That doesn't mean I'm going to pretend that "Russia" rather than the voters of Macomb County elected him president or that it is a good use of anyone's time to spend any more than a year of federal resources combing through Nigerian prince emails and asking gotcha questions trying to prove otherwise.
|
THE AERODYNANIIC CALCULATION OF RAILROAD TUNNELS LINE OF MARABDA-AKHALQALAQI
The provided air expenses in tunnel are determined with the aerodynamic calculation of train motion pistol effect and after movement effect. It is ascertained, that for the tunnel conditions air expenses that are processed with pistol effect are approximately 2/3 removed towards train motion and 1/3 flows орposite to the free space between train and tunnel strengthening. The last one provokes air turbulence and represents common aerodynamic resistance stand face. Despite this, all galleries of Marabda-Akhalqalaqi train main lines can be aerated on expense of train pistol effect with aroused natural pressure. The use of his pressure could be more effective if every chamber and niche will be equipped with ventilation cavity on the both sides of tunnel. The every cavity section area should be 5.6 m2. The noted measures will shorten aerodynamic resistance a rouse by air flowing in distances and would be more outhunted by calculation of railroad tunnels line of Marabda—Akhalqalaqi.
|
<gh_stars>1-10
import { ReactNode } from 'react';
import s from './Wrapper.module.scss';
import Header from '../../components/Header';
import { IUser } from '../../types/user';
import cn from 'classnames';
import Footer from '../../components/Footer';
interface WrapperProps {
children: ReactNode
me: IUser
}
const Wrapper = ({
children,
me
}: WrapperProps) => {
return (
<div className={s.wrapper}>
<Header me={me} />
<div className={cn('container', s.page)}>
{children}
</div>
<Footer />
</div>
);
};
export default Wrapper;
|
def project_label_credit(bq_client: bigquery.Client, env_vars: {}) -> None:
execute_query(bq_client, env_vars, PROJECT_LABEL_CREDIT_SQL,
env_vars['project_label_credit_breakout_table'], False)
|
#pragma once
#include <bundle/data/pose.h>
#include <bundle/error/error_utils.h>
#include <foundation/types.h>
#include <Eigen/Eigen>
namespace bundle {
struct LinearMotionError {
LinearMotionError(double alpha, double position_std_deviation,
double orientation_std_deviation)
: alpha_(alpha),
position_scale_(1.0 / position_std_deviation),
orientation_scale_(1.0 / orientation_std_deviation) {}
template <typename T>
bool operator()(const T* const shot0, const T* const shot1,
const T* const shot2, T* r) const {
Eigen::Map<const Vec3<T> > R0(shot0 + Pose::Parameter::RX);
Eigen::Map<const Vec3<T> > t0(shot0 + Pose::Parameter::TX);
Eigen::Map<const Vec3<T> > R1(shot1 + Pose::Parameter::RX);
Eigen::Map<const Vec3<T> > t1(shot1 + Pose::Parameter::TX);
Eigen::Map<const Vec3<T> > R2(shot2 + Pose::Parameter::RX);
Eigen::Map<const Vec3<T> > t2(shot2 + Pose::Parameter::TX);
// Residual have the general form :
// op( alpha . op(2, -0), op(0, -1))
// with - being the opposite
Eigen::Map<Eigen::Matrix<T, 6, 1> > residual(r);
// Position residual : op is translation
residual.segment(0, 3) =
T(position_scale_) * (T(alpha_) * (t2 - t0) + (t0 - t1));
// Rotation residual : op is rotation
const Vec3<T> R2_R0t = T(alpha_) * MultRotations(R2.eval(), (-R0).eval());
const Vec3<T> R0_R1t = MultRotations(R0.eval(), (-R1).eval());
residual.segment(3, 3) =
T(position_scale_) * MultRotations(R2_R0t.eval(), R0_R1t);
return true;
}
double alpha_;
Vec3d acceleration_;
double position_scale_;
double orientation_scale_;
};
} // namespace bundle
|
<gh_stars>0
/**
* Copyright © 2019 Johnson & Johnson
*
* 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.
*/
/* eslint-disable no-console */
import path from 'path';
import fs from 'fs-extra';
import { Tree } from './type';
type Props = {
paths: Tree,
loc: string,
};
type Copier = (docPath: string, filePath: string) => Promise<void>;
/**
* Copies a documentation file or resource to a location within the docs structure.
*
* @param docPath The absolute path of the source document.
* @param filePath The path of the target document relative to `process.cwd`
*/
const copyFile: Copier = (docPath: string, filePath: string) => {
const relPath = path.relative(process.cwd(), docPath);
try {
return fs.copy(relPath, filePath, { overwrite: false });
} catch (error) {
console.warn('Error writing', filePath, relPath, error);
return Promise.resolve();
}
};
/**
* Symlinks a documentation file or resource to a location within the docs structure.
*
* @param docPath The absolute path of the source document.
* @param filePath The path of the target document relative to `process.cwd`
*/
const symlinkFile: Copier = (docPath: string, filePath: string) => {
const relPath = path.relative(path.dirname(filePath), docPath);
try {
return fs.ensureSymlink(relPath, filePath);
} catch (error) {
console.warn('Error writing', filePath, relPath, error);
return Promise.resolve();
}
};
/**
* Copies or symlinks all doc files from a `Tree` object to their correct locations in the
* documentation file hierarchy.
*
* @param props.loc The path of the root of the target doc hierarchy, relative to `process.cwd`
* @param props.paths The `Tree` object describing the hierarchy and source file locations.
*/
const writeTree = (props: Props, copier: Copier) => {
const { paths, loc } = props;
const promises = [] as Promise<any>[];
Object.keys(paths).forEach(async (key:string) => {
try {
const branch = {
paths: paths[key],
loc: path.join(loc, key),
};
if (typeof paths[key] === 'object') {
try {
fs.ensureDirSync(branch.loc);
promises.push(writeTree(branch as Props, copier));
} catch (error) {
console.warn('Error creating directory', branch, loc, error);
}
} else {
const filePath = path.join(loc, key);
const docPath = (branch.paths as string);
promises.push(copier(docPath, filePath));
}
} catch (error) {
console.warn('Error writing key', key, error);
}
});
return Promise.all(promises);
};
/**
* Copies or symlinks docsify resources to the root of the docs tree.
*
* @param loc The path of the root directory of the docs tree, relative to `process.cwd`.
*/
const writeResources = (loc: string, copier: Copier) => {
const resourceDir = path.dirname(require.resolve(path.join('..', 'resources', 'index.html')));
const resources = fs.readdirSync(resourceDir)
.filter(fn => fs.statSync(path.join(resourceDir, fn)).isFile());
return resources.map(fn => copier(
path.join(resourceDir, fn),
path.join(loc, fn),
));
};
export {
writeTree, writeResources, copyFile, symlinkFile,
};
|
def do_string(self):
self.unpack_int()
return self.unpack_string()
|
/**
* Apply viewport according to the latest known expected width/height and the latest known pixel
* scales.
*/
public void applyViewport() {
if (autoAdaptToHiDPI) {
actualWidth = (int) (desiredWidth * pixelScaleX);
actualHeight = (int) (desiredHeight * pixelScaleY);
} else {
actualWidth = desiredWidth;
actualHeight = desiredHeight;
}
CC.gl_viewport(desiredX, desiredY, actualWidth, actualHeight);
}
|
<filename>netbsdsrc/sys/arch/arm32/arm32/fault.c
/* $NetBSD: fault.c,v 1.16 1997/10/17 00:09:52 mark Exp $ */
/*
* Copyright (c) 1994-1997 <NAME>.
* Copyright (c) 1994 Brini.
* All rights reserved.
*
* This code is derived from software written for Brini by <NAME>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Brini.
* 4. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI OR CONTRIBUTORS 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.
*
* RiscBSD kernel project
*
* fault.c
*
* Fault handlers
*
* Created : 28/11/94
*/
/*
* Special compilation symbols
*
* CONTINUE_AFTER_SVC_PREFETCH - Do not panic following a prefetch abort
* in SVC mode. Used during developement.
*/
/*#define CONTINUE_AFTER_SVC_PREFETCH*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/kernel.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <machine/frame.h>
#include <machine/katelib.h>
#include <machine/cpu.h>
#include <machine/pte.h>
#include <machine/irqhandler.h>
#ifndef POSTMORTEM
#define postmortem(x)
#endif /* POSTMORTEM */
#ifdef PMAP_DEBUG
extern int pmap_debug_level;
#endif /* PMAP_DEBUG */
static int onfault_count = 0;
int pmap_modified_emulation __P((pmap_t, vm_offset_t));
int pmap_handled_emulation __P((pmap_t, vm_offset_t));
pt_entry_t *pmap_pte __P((pmap_t pmap, vm_offset_t va));
u_int disassemble __P((u_int));
int fetchuserword __P((u_int address, u_int *location));
extern char fusubailout[];
/* Abort code */
/* Define text descriptions of the different aborts */
static char *aborts[16] = {
"Write buffer fault",
"Alignment fault",
"Write buffer fault",
"Alignment fault",
"Bus error (LF section)",
"Translation fault (section)",
"Bus error (page)",
"Translation fault (page)",
"Bus error (section)",
"Domain error (section)",
"Bus error (page)",
"Domain error (page)",
"Bus error trans (L1)",
"Permission error (section)",
"Bus error trans (L2)",
"Permission error (page)"
};
/*
* void data_abort_handler(trapframe_t *frame)
*
* Abort handler called when read/write occurs at an address of
* a non existant or restricted (access permissions) memory page.
* We first need to identify the type of page fault.
*/
#define TRAP_CODE ((fault_status & 0x0f) | (fault_address & 0xfffffff0))
void
data_abort_handler(frame)
trapframe_t *frame;
{
struct proc *p;
struct pcb *pcb;
u_int fault_address;
u_int fault_status;
u_int fault_pc;
u_int fault_instruction;
int s;
int fault_code;
u_quad_t sticks = 0;
int error;
/*
* Enable IRQ's (disabled by CPU on abort) if trapframe
* shows they were enabled.
*/
#ifndef BLOCK_IRQS
if (!(frame->tf_spsr & I32_bit))
enable_interrupts(I32_bit);
#endif /* BLOCK_IRQS */
/* Update vmmeter statistics */
cnt.v_trap++;
/* Get fault address and status from the CPU */
fault_address = cpu_faultaddress();
fault_status = cpu_faultstatus();
fault_pc = frame->tf_pc;
fault_instruction = ReadWord(fault_pc);
#ifdef DIAGNOSTIC
if (current_intr_depth > 0) {
#ifdef DDB
printf("Fault with intr_depth > 0\n");
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff,
fault_address, fault_pc);
printf("Instruction @V%08x = %08x\n",
fault_pc, fault_instruction);
Debugger();
#else
panic("Fault with intr_depth > 0\n");
#endif /* DDB */
}
#endif /* DIAGNOSTIC */
/* More debug stuff */
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0) {
s = spltty();
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff,
fault_address, fault_pc);
printf("Instruction @V%08x = %08x\n",
fault_pc, fault_instruction);
(void)splx(s);
}
#endif
/* Call the cpu specific abort fixup routine */
error = cpu_dataabt_fixup(frame);
if (error == ABORT_FIXUP_RETURN)
return;
if (error == ABORT_FIXUP_FAILED)
panic("data abort fixup failed\n");
/* Extract the fault code from the fault status */
fault_code = fault_status & FAULT_TYPE_MASK;
/* Get the current proc structure or proc0 if there is none */
if ((p = curproc) == 0)
p = &proc0;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("fault in process %08x\n", (u_int)p);
#endif
/* can't use curpcb, as it might be NULL; and we have p in a register anyway */
pcb = &p->p_addr->u_pcb;
if (pcb == 0) {
vm_offset_t va;
va = trunc_page((vm_offset_t)fault_address);
if (pmap_handled_emulation(kernel_pmap, va))
return;
if (pmap_modified_emulation(kernel_pmap, va))
return;
printf("data_abort_handler: pc=%08x fault addr=%08x faultcode=%08x\n",
fault_pc, fault_address, fault_status);
panic("data_abort_handler: no pcb ... we're toast !\n");
}
#ifdef DIAGNOSTIC
if (pcb != curpcb) {
printf("data_abort: Alert ! pcb(%08x) != curpcb(%08x)\n", (u_int)pcb,
(u_int)curpcb);
printf("data_abort: Alert ! proc(%08x), curproc(%08x)\n", (u_int)p,
(u_int)curproc);
}
#endif /* DIAGNOSTIC */
/* fusubail is used by [fs]uswintr to avoid page faulting */
if ((pcb->pcb_onfault
&& (fault_code != FAULT_TRANS_S && fault_code != FAULT_TRANS_P))
|| pcb->pcb_onfault == fusubailout) {
copyfault:
printf("Using pcb_onfault=%08x addr=%08x st=%08x curproc=%x\n",
(u_int)pcb->pcb_onfault, fault_address, fault_status, (u_int)curproc);
frame->tf_pc = (u_int)pcb->pcb_onfault;
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE)
panic("Yikes pcb_onfault=%08x during USR mode fault\n",
(u_int)pcb->pcb_onfault);
#ifdef PORTMASTER
++onfault_count;
if (onfault_count == 10) {
printf("Bummer: OD'ing on onfault_count\n");
#ifdef DDB
/* Debugger();*/
onfault_count = 0;
#endif /* DDB */
}
#endif /* PORTMASTER */
return;
}
/* Were we in user mode when the abort occurred ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
sticks = p->p_sticks;
/*
* Modify the fault_code to reflect the USR/SVC state
* at time of fault
*/
fault_code |= FAULT_USER;
p->p_md.md_regs = frame;
}
/* Now act of the fault type */
switch (fault_code) {
case FAULT_WRTBUF_0 | FAULT_USER: /* Write Buffer Fault */
case FAULT_WRTBUF_1 | FAULT_USER: /* Write Buffer Fault */
case FAULT_WRTBUF_0: /* Write Buffer Fault */
case FAULT_WRTBUF_1: /* Write Buffer Fault */
/* If this happens forget it no point in continuing */
panic("Write Buffer Fault [%d] - Halting\n", fault_code);
break;
case FAULT_ALIGN_0 | FAULT_USER: /* Alignment Fault */
case FAULT_ALIGN_1 | FAULT_USER: /* Alignment Fault */
case FAULT_ALIGN_0: /* Alignment Fault */
case FAULT_ALIGN_1: /* Alignment Fault */
/*
* Really this should just kill the process.
* Alignment faults are turned off in the kernel
* in order to get better performance from shorts with
* GCC so an alignment fault means somebody has played
* with the control register in the CPU. Might as well
* panic as the kernel was not compiled for aligned accesses.
*/
panic("Alignment fault [%d] - Halting\n", fault_code);
break;
case FAULT_BUSERR_0 | FAULT_USER: /* Bus Error LF Section */
case FAULT_BUSERR_1 | FAULT_USER: /* Bus Error Page */
case FAULT_BUSERR_2 | FAULT_USER: /* Bus Error Section */
case FAULT_BUSERR_3 | FAULT_USER: /* Bus Error Page */
case FAULT_BUSERR_0: /* Bus Error LF Section */
case FAULT_BUSERR_1: /* Bus Error Page */
case FAULT_BUSERR_2: /* Bus Error Section */
case FAULT_BUSERR_3: /* Bus Error Page */
/* What will accutally cause a bus error ? */
/* Real bus errors are not a process problem but hardware */
panic("Bus Error [%d]- Halting\n", fault_code);
break;
case FAULT_DOMAIN_S | FAULT_USER: /* Section Domain Error Fault */
case FAULT_DOMAIN_P | FAULT_USER: /* Page Domain Error Fault*/
case FAULT_DOMAIN_S: /* Section Domain Error Fault */
case FAULT_DOMAIN_P: /* Page Domain Error Fault*/
/*
* Right well we dont use domains, everything is
* always a client and thus subject to access permissions.
* If we get a domain error then we have corrupts PTE's
* so we might as well die !
* I suppose eventually this should just kill the process
* who owns the PTE's but if this happens it implies a
* kernel problem.
*/
panic("Domain Error [%d] - Halting\n", fault_code);
break;
case FAULT_PERM_P: /* Page Permission Fault*/
case FAULT_PERM_P | FAULT_USER: /* Page Permission Fault*/
/* Ok we have a permission fault in user or kernel mode */
{
register vm_offset_t va;
register struct vmspace *vm = p->p_vmspace;
register vm_map_t map;
int rv;
vm_prot_t ftype;
/*
* Ok we have a permission fault in user mode. The only cause
* must be that a read only page has been written to. This may
* be genuine or it may be a bad access. In the future it may
* also be cause by the software emulation of the modified
* flag.
*/
va = trunc_page((vm_offset_t)fault_address);
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("ok we have a page permission fault - addr=V%08x ",
(u_int)va);
#endif
if ((fault_code & FAULT_USER) && va >= VM_MAXUSER_ADDRESS) {
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
break;
}
/*
* It is only a kernel address space fault iff:
* 1. (fault_code & FAULT_USER) == 0 and
* 2. pcb_onfault not set or
* 3. pcb_onfault set but supervisor space fault
* The last can occur during an exec() copyin where the
* argument space is lazy-allocated.
*/
if ((fault_code & FAULT_USER) == 0
&& (va >= KERNEL_BASE || va <= VM_MIN_ADDRESS)) {
/* Was the fault due to the FPE/IPKDB ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_UND32_MODE) {
printf("UND32 Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
/*
* Force exit via userret()
* This is necessary as the FPE is an extension to userland
* that actually runs in a priveldged mode but uses USR mode
* permissions for its accesses.
*/
userret(p, frame->tf_pc, p->p_sticks);
return;
}
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
postmortem(frame);
panic("permission fault in kernel by kernel\n");
} else
map = &vm->vm_map;
#ifdef DIAGNOSTIC
if (va == 0 && map == kernel_map) {
printf("fault: bad kernel access at %x\n", (u_int)va);
goto we_re_toast;
}
#endif
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("vmmap=%08x ", (u_int)map);
#endif
/*
* We need to know whether the page should be mapped as
* R or R/W. The MMU does not give us the info as to
* whether the fault was caused by a read or a write.
* This means we need to disassemble the instruction
* responcible and determine if it was a read or write
* instruction.
*/
ftype = VM_PROT_READ;
if ((fault_instruction & 0x0c100000) == 0x04000000)
ftype |= VM_PROT_WRITE;
else if ((fault_instruction & 0x0a100000) == 0x08000000)
ftype |= VM_PROT_WRITE;
else if ((fault_instruction & 0x0fb00ff0) == 0x01000090)
ftype |= VM_PROT_WRITE;
/* if (!(ftype & VM_PROT_WRITE)) {
panic("permission fault on a read !\n");
}*/
if (pmap_modified_emulation(map->pmap, va))
goto out;
else {
/* The page must be mapped to cause a permission fault. */
rv = vm_fault(map, va, ftype, FALSE);
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("fault result=%d\n", rv);
#endif
if (rv == KERN_SUCCESS)
goto out;
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
break;
}
}
break;
case FAULT_PERM_S | FAULT_USER: /* Section Permission Fault */
/*
* Section permission faults should not happen often.
* Only from user processes mis-behaving
*/
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
disassemble(fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
break;
case FAULT_BUSTRNL1 | FAULT_USER: /* Bus Error Trans L1 Fault */
case FAULT_BUSTRNL2 | FAULT_USER: /* Bus Error Trans L2 Fault */
case FAULT_BUSTRNL1: /* Bus Error Trans L1 Fault */
case FAULT_BUSTRNL2: /* Bus Error Trans L2 Fault */
/*
* These faults imply that the PTE is corrupt.
* Likely to be a kernel fault so we had better stop.
*/
panic("Bus Error Translation [%d] - Halting\n", fault_code);
break;
case FAULT_TRANS_P: /* Page Translation Fault */
case FAULT_TRANS_P | FAULT_USER: /* Page Translation Fault */
/* Ok page translation fault - The page does not exist */
{
register vm_offset_t va;
register struct vmspace *vm = p->p_vmspace;
register vm_map_t map;
int rv;
vm_prot_t ftype;
extern vm_map_t kernel_map;
u_int nss;
va = trunc_page((vm_offset_t)fault_address);
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("ok we have a page fault - addr=V%08x ", (u_int)va);
#endif
if ((fault_code & FAULT_USER) && va >= VM_MAXUSER_ADDRESS) {
printf("Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
break;
}
/*
* It is only a kernel address space fault iff:
* 1. (fault_code & FAULT_USER) == 0 and
* 2. pcb_onfault not set or
* 3. pcb_onfault set but supervisor space fault
* The last can occur during an exec() copyin where the
* argument space is lazy-allocated.
*/
if (fault_code == FAULT_TRANS_P
&& (va >= KERNEL_BASE || va < VM_MIN_ADDRESS))
map = kernel_map;
else
map = &vm->vm_map;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("vmmap=%08x ", (u_int)map);
#endif
if (pmap_handled_emulation(map->pmap, va))
goto out;
/* debug_show_vm_map(map, "fault");*/
/*
* We need to know whether the page should be mapped
* as R or R/W. The MMU does not give us the info as
* to whether the fault was caused by a read or a write.
* This means we need to disassemble the instruction
* responcible and determine if it was a read or write
* instruction. For the moment we will cheat and make
* it read only. If it was a write, when the instruction
* is re-executed we will get a permission fault instead.
*/
ftype = VM_PROT_READ;
/* STR instruction ? */
if ((fault_instruction & 0x0c100000) == 0x04000000)
ftype |= VM_PROT_WRITE;
/* STM instruction ? */
else if ((fault_instruction & 0x0a100000) == 0x08000000)
ftype |= VM_PROT_WRITE;
/* SWP instruction ? */
else if ((fault_instruction & 0x0fb00ff0) == 0x01000090)
ftype |= VM_PROT_WRITE;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("fault protection = %d\n", ftype);
#endif
#ifdef DIAGNOSTIC
if (va == 0 && map == kernel_map) {
printf("trap: bad kernel access at %x\n", (u_int)va);
goto we_re_toast;
}
#endif /* DIAGNOSTIC */
nss = 0;
if ((caddr_t)va >= vm->vm_maxsaddr
&& (caddr_t)va < (caddr_t)VM_MAXUSER_ADDRESS
&& map != kernel_map) {
nss = clrnd(btoc(USRSTACK-(u_int)va));
if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
rv = KERN_FAILURE;
goto nogo;
}
}
/* check if page table is mapped, if not, fault it first */
/*
if (*(((pt_entry_t **)(PROCESS_PAGE_TBLS_BASE + va >> (PD_SHIFT+2)))[]) == 0)
panic("vm_fault: Page table is needed first\n")
*/
rv = vm_fault(map, va, ftype, FALSE);
/*printf("fault result=%d\n", rv);*/
if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize)
vm->vm_ssize = nss;
va = trunc_page(vtopte(va));
/*
* for page table, increment wiring as long as not
* a page table fault as well
*/
if (map != kernel_map)
vm_map_pageable(map, va, round_page(va+1), FALSE);
if (fault_code == FAULT_TRANS_P)
return;
goto out;
}
nogo:
if (fault_code == FAULT_TRANS_P) {
printf("Failed page fault in kernel\n");
if (pcb->pcb_onfault)
goto copyfault;
printf("vm_fault(%x, %x, %x, 0) -> %x\n",
(u_int)map, (u_int)va, ftype, rv);
goto we_re_toast;
}
printf("nogo, Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
disassemble(fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
break;
}
/* panic("Page Fault - Halting\n");*/
break;
case FAULT_TRANS_S: /* Section Translation Fault */
case FAULT_TRANS_S | FAULT_USER: /* Section Translation Fault */
/* Section translation fault - the L1 page table does not exist */
{
register vm_offset_t va;
register struct vmspace *vm = p->p_vmspace;
register vm_map_t map;
int rv;
vm_prot_t ftype;
u_int nss, v;
va = trunc_page((vm_offset_t)fault_address);
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("ok we have a section fault page addr=V%08x\n",
(u_int)va);
#endif
/*
* It is only a kernel address space fault iff:
* 1. (fault_code & FAULT_USER) == 0 and
* 2. pcb_onfault not set or
* 3. pcb_onfault set but supervisor space fault
* The last can occur during an exec() copyin where the
* argument space is lazy-allocated.
*/
if (fault_code == FAULT_TRANS_S && va >= KERNEL_BASE)
map = kernel_map;
else
map = &vm->vm_map;
/*
debug_show_vm_map(map, "fault");
debug_show_vm_map(kernel_map, "kernel");
*/
/* We are mapping a page table so this must be kernel r/w */
ftype = VM_PROT_READ | VM_PROT_WRITE;
#ifdef DIAGNOSTIC
if (map == kernel_map && va == 0) {
printf("trap: bad kernel access at %x\n", (u_int)va);
goto we_re_toast;
}
#endif /* DIAGNOSTIC */
nss = 0;
if ((caddr_t)va >= vm->vm_maxsaddr
&& (caddr_t)va < (caddr_t)VM_MAXUSER_ADDRESS
&& map != kernel_map) {
/* printf("Address is in the stack\n");*/
nss = clrnd(btoc(USRSTACK-(u_int)va));
if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) {
printf("Stack limit exceeded %08x %08x\n",
nss, btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur));
rv = KERN_FAILURE;
goto nogo1;
}
}
/* check if page table is mapped, if not, fault it first */
v = trunc_page(vtopte(va));
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("v=%08x\n", v);
#endif
rv = vm_fault(map, v, ftype, FALSE);
if (rv != KERN_SUCCESS)
goto nogo1;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("vm_fault succeeded\n");
#endif
/* update increment wiring as this is a page table fault */
vm_map_pageable(map, v, round_page(v+1), FALSE);
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("faulting in page %08x\n", (u_int)va);
#endif
ftype = VM_PROT_READ;
rv = vm_fault(map, va, ftype, FALSE);
if (rv == KERN_SUCCESS) {
if (nss > vm->vm_ssize)
vm->vm_ssize = nss;
va = trunc_page(vtopte(va));
/*
* for page table, increment wiring as long as not
* a page table fault as well
*/
if (!v && map != kernel_map)
vm_map_pageable(map, va, round_page(va+1), FALSE);
if (fault_code == FAULT_TRANS_S)
return;
goto out;
}
nogo1:
printf("nogo1, Data abort: '%s' status = %03x address = %08x PC = %08x\n",
aborts[fault_status & 0xf], fault_status & 0xfff, fault_address,
fault_pc);
disassemble(fault_pc);
if (fault_code == FAULT_TRANS_S) {
printf("Section fault in SVC mode\n");
if (pcb->pcb_onfault)
goto copyfault;
printf("vm_fault(%x, %x, %x, 0) -> %x\n",
(u_int)map, (u_int)va, ftype, rv);
goto we_re_toast;
}
postmortem(frame);
trapsignal(p, SIGSEGV, TRAP_CODE);
break;
}
/* panic("Section Fault - Halting\n");
break;*/
default :
/* Are there any combinations I have missed ? */
printf("fault status = %08x fault code = %08x\n",
fault_status, fault_code);
we_re_toast:
/*
* Were are dead, try and provide some debug
* infomation before dying
*/
postmortem(frame);
panic("Fault cannot be handled (frame = %p)\n", frame);
break;
}
out:
if ((fault_code & FAULT_USER) == 0)
return;
userret(p, frame->tf_pc, sticks);
}
/*
* void prefetch_abort_handler(trapframe_t *frame)
*
* Abort handler called when instruction execution occurs at
* a non existant or restricted (access permissions) memory page.
* If the address is invalid and we were in SVC mode then panic as
* the kernel should never prefetch abort.
* If the address is invalid and the page is mapped then the user process
* does no have read permission so send it a signal.
* Otherwise fault the page in and try again.
*/
extern int kernel_debug;
void
prefetch_abort_handler(frame)
trapframe_t *frame;
{
register u_int fault_pc;
register struct proc *p;
register struct pcb *pcb;
u_int fault_instruction;
u_int s;
int fault_code;
u_quad_t sticks;
pt_entry_t *pte;
int error;
#ifdef DIAGNOSTIC
/* Paranoia: We should always be in SVC32 mode at this point */
if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE) {
s = spltty();
printf("fault being handled in non SVC32 mode\n");
postmortem(frame);
#ifdef PMAP_DEBUG
pmap_debug_level = 0;
#endif
(void)splx(s);
panic("Fault handler not in SVC mode\n");
}
#endif /* DIAGNOSTIC */
/*
* Enable IRQ's (disabled by the abort) This always comes
* from user mode so we know interrupts were not disabled.
* But we check anyway.
*/
#ifndef BLOCK_IRQS
if (!(frame->tf_spsr & I32_bit))
enable_interrupts(I32_bit);
#endif
/* Update vmmeter statistics */
cnt.v_trap++;
/* Call the cpu specific abort fixup routine */
error = cpu_prefetchabt_fixup(frame);
if (error == ABORT_FIXUP_RETURN)
return;
if (error == ABORT_FIXUP_FAILED)
panic("prefetch abort fixup failed\n");
/* Get the current proc structure or proc0 if there is none */
if ((p = curproc) == 0) {
p = &proc0;
printf("Prefetch about with curproc == 0\n");
}
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("prefetch fault in process %08x %s\n", (u_int)p, p->p_comm);
#endif
/*
* can't use curpcb, as it might be NULL; and we have p in a
* register anyway
*/
pcb = &p->p_addr->u_pcb;
if (pcb == 0)
panic("prefetch_abort_handler: no pcb ... we're toast !\n");
#ifdef DIAGNOSTIC
if (pcb != curpcb) {
printf("data_abort: Alert ! pcb(%08x) != curpcb(%08x)\n",
(u_int)pcb, (u_int)curpcb);
printf("data_abort: Alert ! proc(%08x), curproc(%08x)\n",
(u_int)p, (u_int)curproc);
}
#endif /* DIAGNOSTIC */
/* Was the prefectch abort from USR32 mode ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
sticks = p->p_sticks;
/*
* Modify the fault_code to reflect the USR/SVC state
* at time of fault
*/
fault_code |= FAULT_USER;
p->p_md.md_regs = frame;
} else {
/* All the kernel code pages are loaded at boot and do not get paged */
s = spltty();
printf("Prefetch address = %08x\n", frame->tf_pc);
postmortem(frame);
#ifdef CONTINUE_AFTER_SVC_PREFETCH
printf("prefetch abort in non-USR mode !\n");
printf("The system should now be considered very unstable :-)\n");
sigexit(curproc, SIGILL);
/* Not reached */
panic("prefetch_abort_handler: How did we get here ?\n");
#else
panic("Prefetch abort in non-USR mode (frame=%p)\n", frame);
#endif /* CONTINUE_AFTER_SVC_PREFETCH */
}
/* Get fault address */
fault_pc = frame->tf_pc;
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0)
printf("prefetch_abort: PC = %08x\n", fault_pc);
#endif
/* Ok validate the address, can only execute in USER space */
if (fault_pc < VM_MIN_ADDRESS || fault_pc >= VM_MAXUSER_ADDRESS) {
s = spltty();
printf("prefetch: pc (%08x) not in user process space\n",
fault_pc);
/* postmortem(frame);*/
trapsignal(p, SIGSEGV, fault_pc);
(void)splx(s);
userret(p, frame->tf_pc, sticks);
return;
}
/* Is the page already mapped ? */
/* This is debugging for rev K SA110 silicon */
pte = pmap_pte(p->p_vmspace->vm_map.pmap, (vm_offset_t)fault_pc);
if (pte && *pte != 0) {
if (kernel_debug & 1) {
printf("prefetch_abort: page is already mapped - pte=%08x *pte=%08x\n",
pte, *pte);
printf("prefetch_abort: pc=%08x proc=%08x process=%s\n", fault_pc, p, p->p_comm);
printf("prefetch_abort: far=%08x fs=%x\n", cpu_faultaddress(), cpu_faultstatus());
printf("prefetch_abort: trapframe=%08x\n", (u_int)frame);
}
#ifdef DDB
if (kernel_debug & 2)
Debugger();
#endif
}
/* Ok read the fault address. This will fault the page in for us */
if (fetchuserword(fault_pc, &fault_instruction) != 0) {
s = spltty();
printf("prefetch: faultin failed for address %08x!!\n",
fault_pc);
postmortem(frame);
trapsignal(p, SIGSEGV, fault_pc);
(void)splx(s);
} else {
#ifdef DIAGNOSTIC
/* More debug stuff */
#ifdef PMAP_DEBUG
if (pmap_debug_level >= 0) {
s = spltty();
printf("Instruction @V%08x = %08x\n", fault_pc,
fault_instruction);
disassemble(fault_pc);
printf("return addr=%08x", frame->tf_pc);
pte = pmap_pte(p->p_vmspace->vm_map.pmap,
(vm_offset_t)fault_pc);
if (pte)
printf(" pte=%08x *pte=%08x\n", pte, *pte);
else
printf("\n");
(void)splx(s);
}
#endif /* PMAP_DEBUG */
#endif /* DIAGNOSTIC */
}
userret(p, frame->tf_pc, sticks);
}
/* End of fault.c */
|
/**
* Indicates if the node itself is viable for the head, or if it's best descendant is viable for
* the head.
*
* @param node
* @return
*/
private boolean nodeLeadsToViableHead(ProtoNode node) {
boolean bestDescendantIsViableForHead =
node.getBestDescendantIndex().map(nodes::get).map(this::nodeIsViableForHead).orElse(false);
return bestDescendantIsViableForHead || nodeIsViableForHead(node);
}
|
<reponame>maxwellpeterson/charter<filename>src/tsc-example.ts
import ts from 'typescript';
function makeFactorialFunction() {
const functionName = ts.factory.createIdentifier('factorial');
const paramName = ts.factory.createIdentifier('n');
const parameter = ts.factory.createParameterDeclaration(
/*decorators*/ undefined,
/*modifiers*/ undefined,
/*dotDotDotToken*/ undefined,
paramName
);
const condition = ts.factory.createBinaryExpression(
paramName,
ts.SyntaxKind.LessThanEqualsToken,
ts.factory.createNumericLiteral(1)
);
const ifBody = ts.factory.createBlock(
[ts.factory.createReturnStatement(ts.factory.createNumericLiteral(1))],
/*multiline*/ true
);
const decrementedArg = ts.factory.createBinaryExpression(
paramName,
ts.SyntaxKind.MinusToken,
ts.factory.createNumericLiteral(1)
);
const recurse = ts.factory.createBinaryExpression(
paramName,
ts.SyntaxKind.AsteriskToken,
ts.factory.createCallExpression(functionName, /*typeArgs*/ undefined, [
decrementedArg,
])
);
const statements = [
ts.factory.createIfStatement(condition, ifBody),
ts.factory.createReturnStatement(recurse),
];
return ts.factory.createFunctionDeclaration(
/*decorators*/ undefined,
/*modifiers*/ [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
/*asteriskToken*/ undefined,
functionName,
/*typeParameters*/ undefined,
[parameter],
/*returnType*/ ts.factory.createKeywordTypeNode(
ts.SyntaxKind.NumberKeyword
),
ts.factory.createBlock(statements, /*multiline*/ true)
);
}
const resultFile = ts.createSourceFile(
'someFileName.ts',
'',
ts.ScriptTarget.Latest,
/*setParentNodes*/ false,
ts.ScriptKind.TS
);
const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
const result = printer.printNode(
ts.EmitHint.Unspecified,
makeFactorialFunction(),
resultFile
);
console.log(result);
|
/**
* This class runs as a thread, and waits for messages to arrive in its queue that are to be sent back to the client.
*
* @author jwb
*/
class SendResultsCallable implements Callable<String> {
// one per callable as it is stateless, but not thread safe
private Gson gson = new Gson();
public SendResultsCallable() {
}
@Override
public String call() throws Exception {
// keep going until all messages are sent
while (keepRunning.get()) {
if (tickerSymbols.size() > 0) {
TickerResponse tickerResponse = new TickerResponse();
tickerResponse.setResult("success");
tickerResponse.setTickerData(getPricesForSymbols(tickerSymbols));
String response = gson.toJson(tickerResponse);
// send the client an update
channel.get().writeAndFlush(new TextWebSocketFrame(response));
}
// only try to send back to client every 2 seconds so it isn't overwhelmed with messages
Thread.sleep(2000L);
}
return "done";
}
}
|
An improved comparison circuit for low power pre-computation-based content-addressable memory designs
This paper proposes a CMOS comparison architecture for low-power pre-computation-based content-addressable memory (PB-CAM). Instead of conventional architecture, we implement ours by CMOS logic gates to eliminate power consumption induced by short-circuit current. We use TSMC 0.18-µm techfile to estimate the power consumption by Synopsys Nanosim. The width ratio between PMOS and NMOS is set as 3∶1. This ratio can effectively reduce both rise time and fall time, thereby reducing the delay for each comparison cycle. Compare with static pseudo-nMOS CAM word circuit, this architecture can save 50.2% power consumption on average.
|
/**
* Abstract service to handle zipping and transferring a set of iRODS paths as
* one bundle
*
* @author Mike Conway - DICE
*
*/
public class JargonZipServiceImpl extends AbstractJargonService implements JargonZipService {
private ZipServiceConfiguration zipServiceConfiguration = null;
private final Random random;
public static final Logger log = LoggerFactory.getLogger(JargonZipServiceImpl.class);
public JargonZipServiceImpl() {
super();
random = new Random();
}
/**
* Constructor with dependencies
*
* @param zipServiceConfiguration
* {@link ZipServiceConfiguration}
* @param irodsAccessObjectFactory
* {@link IRODSAccessObjectFactory}
* @param irodsAccount
* {@link IRODSAccount}
*/
public JargonZipServiceImpl(final ZipServiceConfiguration zipServiceConfiguration,
final IRODSAccessObjectFactory irodsAccessObjectFactory, final IRODSAccount irodsAccount) {
super(irodsAccessObjectFactory, irodsAccount);
if (zipServiceConfiguration == null) {
throw new IllegalArgumentException("null zipServiceConfiguration");
}
this.zipServiceConfiguration = zipServiceConfiguration;
random = new Random();
}
@Override
public ZipServiceConfiguration getZipServiceConfiguration() {
return zipServiceConfiguration;
}
@Override
public void setZipServiceConfiguration(final ZipServiceConfiguration zipServiceConfiguration) {
this.zipServiceConfiguration = zipServiceConfiguration;
}
/**
* Handy method to verify configuration of this service before any opeerations
*
* @throws ZipServiceConfigurationException
* {@link ZipServiceConfigurationException}
*/
protected void validateConfiguration() throws ZipServiceConfigurationException {
if (zipServiceConfiguration == null) {
throw new ZipServiceConfigurationException(
"null zipServiceConfiguration, needs to be set before operations");
}
}
@Override
public BundleStreamWrapper obtainBundleAsInputStreamWithAdditionalMetadataGivenPaths(
final List<String> irodsAbsolutePaths) throws ZipServiceException {
log.info("obtainBundleAsInputStreamWithAdditionalMetadataGivenPaths()");
FileIOOperations fileIOOperations;
try {
fileIOOperations = new FileIOOperationsAOImpl(getIrodsAccessObjectFactory().getIrodsSession(),
getIrodsAccount());
IRODSFile bundleFile = obtainBundleAsIrodsFileGivenPaths(irodsAbsolutePaths);
BundleClosingInputStream inputStream = new BundleClosingInputStream(bundleFile, fileIOOperations);
return new BundleStreamWrapper(inputStream, bundleFile.length(), bundleFile.getName());
} catch (JargonException | FileNotFoundException e) {
log.error("JargonException getting input stream", e);
throw new ZipServiceException("Jargon exception getting input stream", e);
}
}
@Override
public InputStream obtainBundleAsInputStreamGivenPaths(final List<String> irodsAbsolutePaths)
throws ZipServiceException {
log.info("obtainInputStreamForBundleGivenPaths()");
FileIOOperations fileIOOperations;
try {
fileIOOperations = new FileIOOperationsAOImpl(getIrodsAccessObjectFactory().getIrodsSession(),
getIrodsAccount());
IRODSFile bundleFile = obtainBundleAsIrodsFileGivenPaths(irodsAbsolutePaths);
return new BundleClosingInputStream(bundleFile, fileIOOperations);
} catch (JargonException | FileNotFoundException e) {
log.error("JargonException getting input stream", e);
throw new ZipServiceException("Jargon exception getting input stream", e);
}
}
@Override
public IRODSFile obtainBundleAsIrodsFileGivenPaths(final List<String> irodsAbsolutePaths)
throws ZipServiceException {
log.info("obtainInputStreamForBundleGivenPaths()");
if (irodsAbsolutePaths == null) {
throw new IllegalArgumentException("null irodsAbsolutePaths");
}
if (irodsAbsolutePaths.isEmpty()) {
throw new ZipServiceException("empty zip request");
}
validateConfiguration();
long totalLength = computeBundleSizeInBytes(irodsAbsolutePaths);
log.info("computed total size:{}", totalLength);
if (totalLength > getZipServiceConfiguration().getMaxTotalBytesForZip()) {
log.error("bundle total size is:{} and is larger than the configured maximum", totalLength);
throw new ZipRequestTooLargeException("total size is larger than configured bundle max");
}
log.info("copy phase, building a local subdir");
log.info("building in user home");
String parentPath = createOrReturnZipParentPath();
log.info("parent path:{}", parentPath);
long currentTime = System.currentTimeMillis();
IRODSFile bundleParent = createOrReturnBundlePath(currentTime, parentPath);
log.info("begin the copy phase...");
copyFilesToBundleDir(irodsAbsolutePaths, bundleParent);
log.info("create the bundle...");
BulkFileOperationsAO bulkFileOperationsAO;
try {
bulkFileOperationsAO = getIrodsAccessObjectFactory().getBulkFileOperationsAO(getIrodsAccount());
} catch (JargonException e) {
log.error("JargonException getting bulkFileOperationsAO", e);
throw new ZipServiceException("Jargon exception getting bulkFileOperationsAO", e);
}
StringBuilder sb = new StringBuilder(parentPath);
sb.append("/");
sb.append(bundleParent.getName());
sb.append(
BulkFileOperationsAOImpl.fileExtensionForBundleType(zipServiceConfiguration.getPreferredBundleType()));
String zipFileName = sb.toString();
IRODSFile zipFile;
try {
bulkFileOperationsAO.createABundleFromIrodsFilesAndStoreInIrods(zipFileName, bundleParent.getAbsolutePath(),
"", getZipServiceConfiguration().getPreferredBundleType());
zipFile = getIrodsAccessObjectFactory().getIRODSFileFactory(getIrodsAccount())
.instanceIRODSFile(zipFileName);
log.info("delete temp files before returning the bundle file");
bundleParent.deleteWithForceOption();
} catch (JargonException e) {
log.error("JargonException creating bundle", e);
throw new ZipServiceException("Jargon exception creating bundle", e);
}
log.info("bundle is in file:{}", bundleParent);
return zipFile;
}
/**
* Copy files from the disparate paths to the bundle dir
*
* @param irodsAbsolutePaths
* {@code List} of {@code String} of iRODS paths with the paths that
* will be copied to the bundle directory
* @param bundleParent
* <code>String</code> with the absolute path of the bundle directory
* @throws ZipServiceException
* for any exception that occurs, there are subclasses of this
* top-level exception that can be discerned
*/
private void copyFilesToBundleDir(final List<String> irodsAbsolutePaths, final IRODSFile bundleParent)
throws ZipServiceException {
// now bundle parent exists and is blank, start the copies
log.info("starting copies, may take a while...");
DataTransferOperations dataTransferOperations;
try {
dataTransferOperations = getIrodsAccessObjectFactory().getDataTransferOperations(getIrodsAccount());
} catch (JargonException e) {
log.error("JargonException getting data transfer operations:{}", e);
throw new ZipServiceException("Jargon exception getting data transfer operations", e);
}
for (String path : irodsAbsolutePaths) {
log.info("copy {}", path);
try {
TransferControlBlock tcb = irodsAccessObjectFactory
.buildDefaultTransferControlBlockBasedOnJargonProperties();
tcb.getTransferOptions().setForceOption(ForceOption.USE_FORCE);
dataTransferOperations.copy(path, "", bundleParent.getAbsolutePath(), null, tcb);
} catch (JargonException e) {
if (zipServiceConfiguration.isFailFast()) {
log.error("JargonException copying to bundle dir for:{}, fail fast is set", path, e);
throw new ZipServiceException("Unable to copy a file into the bundle dir - fail fast is set", e);
} else {
log.warn("JargonException copying to bundle dir for:{}, fail fast is not set, so we will proceed",
path, e);
}
}
}
}
/**
* Given a time stamp and parent path, make sure an initialized (created but
* empty) bundle path exists
* <p/>
* Default algo is configured prefix + time stamp + a random int
*
* @param currentTime
* <code>long</code> with the timestamp of the request, used to
* differentiate the files
* @param parentPath
* <code>String</code> with the absolute path to the main parent of
* bundle files in general
* @return <code>String</code> with the absolute path to the parent for this
* particular bundle, which will be cleared and created
* @throws ZipServiceException
* {@link ZipServiceException}
*/
private IRODSFile createOrReturnBundlePath(final long currentTime, final String parentPath)
throws ZipServiceException {
log.info("createOrReturnBundlePath()");
if (parentPath == null || parentPath.isEmpty()) {
throw new IllegalArgumentException("null or empty parentPath");
}
StringBuilder sb = new StringBuilder(getZipServiceConfiguration().getBundlePrefix());
sb.append('-');
sb.append(currentTime);
sb.append('-');
sb.append(random.nextInt());
IRODSFile subdirFile;
try {
subdirFile = getIrodsAccessObjectFactory().getIRODSFileFactory(getIrodsAccount())
.instanceIRODSFile(parentPath, sb.toString());
subdirFile.deleteWithForceOption();
subdirFile.mkdirs();
} catch (JargonException e) {
log.error("JargonException getting the file:{}", sb.toString(), e);
throw new ZipServiceException("Jargon exception getting subdir", e);
}
return subdirFile;
}
/**
* Given the configuration, return a path to the subdir under which bundle dirs
* will be created. The subdirs are guaranteed to exist at least when this
* method returns
*
* @return <code>String</code> with the iRODS absloute path to the bundle parent
* @throws ZipServiceException
* {@link ZipServiceException}
*/
private String createOrReturnZipParentPath() throws ZipServiceException {
log.info("createOrReturnZipParentPath()");
if (!zipServiceConfiguration.isGenerateTempDirInUserHome()) {
log.error("currently needs a subdir under the user home");
throw new ZipServiceConfigurationException("unsupported zip location");
}
StringBuilder sb = new StringBuilder();
sb.append(MiscIRODSUtils.buildIRODSUserHomeForAccountUsingDefaultScheme(getIrodsAccount()));
sb.append('/');
sb.append(zipServiceConfiguration.getBundleSubDirPath());
IRODSFile subdirFile;
try {
subdirFile = getIrodsAccessObjectFactory().getIRODSFileFactory(getIrodsAccount())
.instanceIRODSFile(sb.toString());
subdirFile.mkdirs();
} catch (JargonException e) {
log.error("JargonException getting the file:{}", sb.toString(), e);
throw new ZipServiceException("Jargon exception getting subdir", e);
}
return subdirFile.getAbsolutePath();
}
@Override
public long computeBundleSizeInBytes(final List<String> irodsAbsolutePaths) throws ZipServiceException {
log.info("computeBundleSizeInBytes()");
if (irodsAbsolutePaths == null) {
throw new IllegalArgumentException("null irodsAbsolutePaths");
}
if (irodsAbsolutePaths.isEmpty()) {
return 0;
}
CollectionAndDataObjectListAndSearchAO collectionAndDataObjectAO;
try {
collectionAndDataObjectAO = getIrodsAccessObjectFactory()
.getCollectionAndDataObjectListAndSearchAO(getIrodsAccount());
} catch (JargonException e) {
log.error("JargonException getting CollectionAndDataObjectListAndSearchAO", e);
throw new ZipServiceException("Jargon exception getting CollectionAndDataObjectListAndSearchAO", e);
}
long totalCount = 0;
for (String path : irodsAbsolutePaths) {
log.info("getting count for path:{}", path);
try {
totalCount += collectionAndDataObjectAO.totalDataObjectSizesUnderPath(path);
} catch (JargonException e) {
log.error("JargonException counting under paths", e);
throw new ZipServiceException("Jargon exception getting CollectionAndDataObjectListAndSearchAO", e);
}
}
log.info("total count:{}", totalCount);
return totalCount;
}
}
|
def train(inputfile, pattern=None, output=None, algorithm=None, nthreads=1, maxiter=None, rho1=None, rho2=None, model=None, compact=False):
cmd = [command_name(), "train"]
if pattern is not None: cmd.extend(["-p", pattern])
if algorithm is not None: cmd.extend(["-a", str(algorithm)])
if nthreads > 1: cmd.extend(["-t", str(nthreads)])
if maxiter is not None: cmd.extend(["-i", str(maxiter)])
if rho1 is not None: cmd.extend(["-1", str(rho1)])
if rho2 is not None: cmd.extend(["-2", str(rho2)])
if model is not None: cmd.extend(["-m", str(model)])
if compact: cmd.append("-c")
cmd.append(str(inputfile))
if output is not None: cmd.append(str(output))
exit_status = subprocess.call(cmd)
if exit_status != 0:
if output is None: output = "*stdout"
raise RuntimeError("Wapiti exited with status {0}.\n{1:>6}: {2}\n{3:>6}: {4}\n{5:>6}: {6}".format(exit_status, "input", inputfile, "pattern", pattern, "output", output))
|
/*
- What's your team number?
Team 6
- What is the functionality being tested?
The effect of Delta-compression in building positional index
Method:
compare the IO counters between non-compression and compression
- Describe your tests briefly:
To compare the difference, we need to set up two different index managers.
In test1:
We test while writing documents to disk, the difference between IO counters
In test2:
We test while searching for phrase in document, the difference between IO counters
- Does each test case have comments/documentation?
Yes
*/
public class Team6IndexCompressionTest {
private final String path = "./index/Team6AndSearchTest1";
private final String path2 = "./index/Team6AndSearchTest2";
private final String docPath = "https://grape.ics.uci.edu/wiki/public/raw-attachment/wiki/cs221-2019-spring-project2/Team2StressTest.txt";
private InvertedIndexManager nonCompressManager = null;
private InvertedIndexManager compressManager = null;
private Analyzer analyzer = new ComposableAnalyzer(new PunctuationTokenizer(), new PorterStemmer());
Document sampleDoc = generateDoc();
Document emptyDoc = new Document(" ");
//initialize a set of counters to record IO performance
double nonCompressReadCounter = 0;
double nonCompressWriteCounter = 0;
double compressReadCounter = 0;
double compressWriteCounter = 0;
@Before
public void before() {
// Initialize InvertedIndexManager
this.nonCompressManager = createPositionalManager(path, analyzer, false);
this.compressManager = createPositionalManager(path2, analyzer, true);
}
/**
* input documents 10 times into each manager, compare the reader counters
* We assume the compressed one will be 2/3 smaller than non-compressed one
* search the phase and compare read counters
* We assume the compressed one will be 2/3 smaller than non-compressed one
* */
@Test
public void test1() {
//naive compressor manager add document
for(int i = 0; i<100; i++)
nonCompressManager.addDocument(sampleDoc);
nonCompressManager.flush();
nonCompressWriteCounter = PageFileChannel.writeCounter;
PageFileChannel.resetCounters();
//Compress manager add documents
for(int i = 0; i<100; i++)
compressManager.addDocument(sampleDoc);
compressManager.flush();
compressWriteCounter = PageFileChannel.writeCounter;
PageFileChannel.resetCounters();
//search for phase, test the differences between read counters
List<String> keywords = new ArrayList<>();
keywords.add("Pride ");
keywords.add("Prejudice");
//searching the keywords using two managers for multiple times
for(int i = 0; i<10; i++)
nonCompressManager.searchPhraseQuery(keywords);
nonCompressReadCounter = PageFileChannel.readCounter;
PageFileChannel.resetCounters();
for(int i = 0; i<10; i++)
compressManager.searchPhraseQuery(keywords);
compressReadCounter = PageFileChannel.readCounter;
PageFileChannel.resetCounters();
assertEquals(true, compressWriteCounter/nonCompressWriteCounter < (double)2/3);
}
/**
This testcase is to test the empty input document. The write counter of
compressed and non-compressed should be the same number.
* */
@Test
public void test2() {
nonCompressManager.addDocument(emptyDoc);
nonCompressManager.flush();
nonCompressWriteCounter = PageFileChannel.writeCounter;
PageFileChannel.resetCounters();
//Compress manager add documents
compressManager.addDocument(emptyDoc);
compressManager.flush();
compressWriteCounter = PageFileChannel.writeCounter;
PageFileChannel.resetCounters();
assertEquals(true,compressWriteCounter == nonCompressWriteCounter);
}
@After
public void after() {
deleteDirectory(path);
deleteDirectory(path2);
}
/**
* Create Positional inverted index using different compressions
*
* @param ifCompress choose whether using Delta-compression
* @return Inverted index managers
* */
private InvertedIndexManager createPositionalManager(String path, Analyzer analyzer, boolean ifCompress){
File directory = new File(path);
if (!directory.exists()) {
directory.mkdirs();
}
if(ifCompress)
return InvertedIndexManager.createOrOpenPositional(path, analyzer, new DeltaVarLenCompressor());
else
return InvertedIndexManager.createOrOpenPositional(path, analyzer, new NaiveCompressor());
}
/**
* Reading text from online resource and generate document
*
* @return document
* */
private Document generateDoc(){
String text = new String();
try {
URL docURL = new URL(docPath);
BufferedReader reader = new BufferedReader(new InputStreamReader(docURL.openStream()));
StringBuilder strbuilder = new StringBuilder();
String inputStr;
while((inputStr = reader.readLine()) != null){
strbuilder.append(inputStr + "\n");
}
reader.close();
text = strbuilder.toString();
}catch (Exception e){
e.printStackTrace();
}
return new Document(text);
}
private void deleteDirectory(String path){
File cacheFolder = new File(path);
for (File file : cacheFolder.listFiles()) {
try {
file.delete();
} catch (Exception e) {
e.printStackTrace();
}
}
cacheFolder.delete();
}
}
|
<reponame>NCIP/lexevs-remote<gh_stars>1-10
package gov.nih.nci.cacoresdk.installer.portal.generation;
import gov.nih.nci.cacoresdk.installer.common.DeployPropertiesManager;
import gov.nih.nci.cacoresdk.installer.common.SdkInstallerLookAndFeel;
import gov.nih.nci.cagrid.common.portal.PortalLookAndFeel;
import gov.nih.nci.cagrid.common.portal.validation.IconFeedbackPanel;
import gov.nih.nci.cagrid.introduce.common.FileFilters;
import gov.nih.nci.cagrid.introduce.common.ResourceManager;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.jgoodies.validation.Severity;
import com.jgoodies.validation.ValidationResult;
import com.jgoodies.validation.ValidationResultModel;
import com.jgoodies.validation.message.SimpleValidationMessage;
import com.jgoodies.validation.util.DefaultValidationResultModel;
import com.jgoodies.validation.util.ValidationUtils;
import com.jgoodies.validation.view.ValidationComponentUtils;
/**
* SDK Generation Viewer
*
* @author <A HREF="MAILTO:<EMAIL>"><NAME></A>
* @created November 6, 2008
*/
public class GenerationViewer extends GenerationViewerBaseComponent {
private static final long serialVersionUID = 1L;
public static final String SCHEMA_DIR = "schema";
public static final String SDK_INSTALL_DIR = "SDK installation directory";
public static final String PROJECT_NAME = "Project name";
public static final String NAMESPACE_PREFIX = "Project namespace prefix";
public static final String WEBSERVICE_NAME = "Project Webservice name";
public static final String MODEL_FILE_PATH = "Model file absolute path";
public static final String DB_JNDI_URL = "Database JNDI URL";
public static final String DB_CONNECTION_URL = "Database Connection URL";
public static final String DB_USERNAME = "Database Username";
public static final String DB_PASSWORD = "<PASSWORD>";
public static final String DB_DRIVER = "Database Driver";
public static final String DB_DIALECT = "Database Dialect";
public static final String CSM_DB_JNDI_URL = "CSM Database JNDI URL";
public static final String CSM_DB_CONNECTION_URL = "CSM Database Connection URL";
public static final String CSM_DB_USERNAME = "CSM Database Username";
public static final String CSM_DB_PASSWORD = "<PASSWORD>";
public static final String CSM_DB_DRIVER = "CSM Database Driver";
public static final String CSM_DB_DIALECT = "CSM Database Dialect";
private JPanel mainPanel = null;
private JPanel buttonPanel = null;
// Buttons
private JButton previousButton = null;
private JButton nextButton = null;
private JButton generateButton = null;
private JButton sdkInstallDirButton = null;
private JButton modelFilePathButton = null;
private JButton closeButton = null;
private ValidationResultModel validationModel = new DefaultValidationResultModel();
private JTabbedPane mainTabbedPane = null;
private int LOGGING_PANEL_INDEX = 5;
private int CSM_PANEL_INDEX = 7;
private int CAGRID_AUTH_PANEL_INDEX = 8;
private JCheckBox lifetimeResource = null;
private JCheckBox persistantResource = null;
private JCheckBox notificationResource = null;
private JCheckBox secureResource = null;
private JCheckBox resourceProperty = null;
/*
* caCore SDK Panel definitions
*/
// Primary
private JPanel projectSettingsPanel = null;
private JPanel modelSettingsPanel = null;
private JPanel codeGenSettingsPanel = null;
private JPanel dbConnectionSettingsPanel = null;
// Writable API
private JPanel writableApiSettingsPanel = null;
private JPanel writableApiSettingsSubPanel = null;
// Common Logging (CLM)
private JPanel clmSettingsPanel = null;
private JPanel clmSettingsSubPanel = null;
// Security
private JPanel securitySettingsPanel = null;
private JPanel securitySettingsSubPanel = null;
private JPanel csmDbConnectionSettingsPanel = null;
private JPanel caGridAuthSettingsPanel = null;
// App Server
private JPanel appServerSettingsPanel = null;
// Advanced
private JPanel advancedSettingsPanel = null;
/*
* caCore SDK Component definitions
*/
// Common Label Definitions
private String blankLine = "---------------------------------------";
// Project Settings Panel Label Definitions
private JLabel sdkInstallDirLabel = null;
private JLabel projectNameLabel = null;
private JLabel namespacePrefixLabel = null;
private JLabel webserviceNameLabel = null;
//Project Settings Panel Component Definitions
private JTextField sdkInstallDirField = null;
private JTextField projectNameField = null;
private JTextField namespacePrefixField = null;
private JTextField webserviceNameField = null;
private boolean hasUserModifiedWebserviceName=false;
//Model Settings Panel Label Definitions
private JLabel modelFileLabel = null;
private JLabel modelFileTypeLabel = null;
private JLabel logicalModelLabel = null;
private JLabel dataModelLabel = null;
private JLabel includePackageLabel = null;
private JLabel excludePackageLabel = null;
private JLabel excludeNameLabel = null;
private JLabel excludeNamespaceLabel = null;
//Model Settings Panel Component Definitions
private JTextField modelFileField = null;
private JComboBox modelFileTypeComboBox = null;
private JTextField logicalModelField = null;
private JTextField dataModelField = null;
private JTextField includePackageField = null;
private JTextField excludePackageField = null;
private JTextField excludeNameField = null;
private JTextField excludeNamespaceField = null;
//Code Generation Settings Panel Label Definitions
private JLabel validateLogicalModelLabel = null;
private JLabel validateModelMappingLabel = null;
private JLabel validateGmeTagsLabel = null;
private JLabel generateHibernateMappingLabel = null;
private JLabel generateBeansLabel = null;
private JLabel generateCastorMappingLabel = null;
private JLabel generateXsdLabel = null;
private JLabel generateXsdWithGmeTagsLabel = null;
private JLabel generateXsdWithPermissibleValuesLabel = null;
private JLabel generateWsddLabel = null;
private JLabel generateHibernateValidatorLabel = null;
//Code Generation Settings Panel Component Definitions
private JCheckBox validateLogicalModelCheckBox = null;
private JCheckBox validateModelMappingCheckBox = null;
private JCheckBox validateGmeTagsCheckBox = null;
private JCheckBox generateHibernateMappingCheckBox = null;
private JCheckBox generateBeansCheckBox = null;
private JCheckBox generateCastorMappingCheckBox = null;
private JCheckBox generateXsdCheckBox = null;
private JCheckBox generateXsdWithGmeTagsCheckBox = null;
private JCheckBox generateXsdWithPermissibleValuesCheckBox = null;
private JCheckBox generateWsddCheckBox = null;
private JCheckBox generateHibernateValidatorCheckBox = null;
//DB Connection Settings Panel Label Definitions
private JLabel useJndiBasedConnectionLabel = null;
private JLabel dbJndiUrlLabel = null;
private JLabel dbConnectionUrlLabel = null;
private JLabel dbUsernameLabel = null;
private JLabel dbPasswordLabel = null;
private JLabel dbDriverLabel = null;
private JLabel dbDialectLabel = null;
//DB Connection Settings Panel Component Definitions
private JCheckBox useJndiBasedConnectionCheckBox = null;
private JTextField dbJndiUrlField = null;
private JTextField dbConnectionUrlField = null;
private JTextField dbUsernameField = null;
private JTextField dbPasswordField = null;
private JTextField dbDriverField = null;
private JTextField dbDialectField = null;
//Writable API Settings Panel Label Definitions
private JLabel enableWritableApiExtensionLabel = null;
private JLabel databaseTypeLabel = null;
private JLabel identityGeneratorTagLabel = null;
private JLabel caDsrConnectionUrlLabel = null;
private JLabel enableCommonLoggingModuleLabel = null;
private JLabel clmProjectNameLabel = null;
private JLabel clmDbConnectionUrlLabel = null;
private JLabel clmDbUsernameLabel = null;
private JLabel clmDbPasswordLabel = null;
private JLabel clmDbDriverLabel = null;
//Writable API Settings Panel Component Definitions
private JCheckBox enableWritableApiExtensionCheckBox = null;
private JTextField databaseTypeField = null;
private JTextField identityGeneratorTagField = null;
private JTextField caDsrConnectionUrlField = null;
private JCheckBox enableCommonLoggingModuleCheckBox = null;
private JTextField clmProjectName = null;
private JTextField clmDbConnectionUrlField = null;
private JTextField clmDbUsernameField = null;
private JTextField clmDbPasswordField = null;
private JTextField clmDbDriverField = null;
//Security Settings Panel Label Definitions
private JLabel enableSecurityLabel = null;
private JLabel enableInstanceLevelSecurityLabel = null;
private JLabel enableAttributeLevelSecurityLabel = null;
private JLabel csmProjectNameLabel = null;
private JLabel cacheProtectionElementsLabel = null;
//Security Settings Panel Component Definitions
private JCheckBox enableSecurityCheckBox = null;
private JCheckBox enableInstanceLevelSecurityCheckBox = null;
private JCheckBox enableAttributeLevelSecurityCheckBox = null;
private JTextField csmProjectNameField = null;
private JCheckBox cacheProtectionElementsCheckBox = null;
//CSM DB Connection Settings Panel Label Definitions
private JLabel csmUseJndiBasedConnectionLabel = null;
private JLabel csmDbJndiUrlLabel = null;
private JLabel csmDbConnectionUrlLabel = null;
private JLabel csmDbUsernameLabel = null;
private JLabel csmDbPasswordLabel = null;
private JLabel csmDbDriverLabel = null;
private JLabel csmDbDialectLabel = null;
//CSM DB Connection Settings Panel Component Definitions
private JCheckBox csmUseJndiBasedConnectionCheckBox = null;
private JTextField csmDbJndiUrlField = null;
private JTextField csmDbConnectionUrlField = null;
private JTextField csmDbUsernameField = null;
private JTextField csmDbPasswordField = null;
private JTextField csmDbDriverField = null;
private JTextField csmDbDialectField = null;
//caGRID Authentication Settings Panel Label Definitions
private JLabel enableCaGridLoginModuleLabel = null;
private JLabel caGridLoginModuleNameLabel = null;
private JLabel caGridAuthSvcUrlLabel = null;
private JLabel caGridDorianSvcUrlLabel = null;
private JLabel enableCsmLoginModuleLabel = null;
private JLabel sdkGridLoginSvcNameLabel = null;
private JLabel sdkGridLoginSvcUrlLabel = null;
//caGRID Authentication Settings Panel Component Definitions
private JCheckBox enableCaGridLoginModuleCheckBox = null;
private JTextField caGridLoginModuleNameField = null;
private JTextField caGridAuthSvcUrlField = null;
private JTextField caGridDorianSvcUrlField = null;
private JCheckBox enableCsmLoginModuleCheckBox = null;
private JTextField sdkGridLoginSvcNameField = null;
private JTextField sdkGridLoginSvcUrlField = null;
//Application Server Settings Panel Label Panel Label Definitions
private JLabel serverTypeLabel = null;
private JLabel serverUrlLabel = null;
//Application Server Settings Panel Label Panel Component Definitions
private JComboBox serverTypeComboBox = null;
private JTextField serverUrlField = null;
//Advanced Settings Panel Label Panel Label Definitions
private JLabel cachePathLabel = null;
//Advanced Settings Panel Label Panel Component Definitions
private JTextField cachePathField = null;
//TODO
public GenerationViewer() {
super();
initialize();
}
/**
* This method initializes this Viewer
*/
private void initialize() {
this.setContentPane(getMainPanel());
this.setFrameIcon(SdkInstallerLookAndFeel.getGenerateApplicationIcon());
this.setTitle("Generate an SDK Application");
initValidation();
}
private void initValidation() {
ValidationComponentUtils.setMessageKey(getSdkInstallDirField(), SDK_INSTALL_DIR);
ValidationComponentUtils.setMessageKey(getProjectNameField(), PROJECT_NAME);
ValidationComponentUtils.setMessageKey(getNamespacePrefixField(), NAMESPACE_PREFIX);
ValidationComponentUtils.setMessageKey(getWebServiceNameField(), WEBSERVICE_NAME);
ValidationComponentUtils.setMessageKey(getModelFileField(), MODEL_FILE_PATH);
ValidationComponentUtils.setMandatory(getModelFileField(), true);
ValidationComponentUtils.setMessageKey(getDbJndiUrlField(), DB_JNDI_URL);
ValidationComponentUtils.setMessageKey(getDbConnectionUrlField(), DB_CONNECTION_URL);
ValidationComponentUtils.setMessageKey(getDbUsernameField(), DB_USERNAME);
ValidationComponentUtils.setMessageKey(getDbPasswordField(), DB_PASSWORD);
ValidationComponentUtils.setMessageKey(getDbDriverField(), DB_DRIVER);
ValidationComponentUtils.setMessageKey(getDbDialectField(), DB_DIALECT);
//TODO - Add Writable API components
//TODO - Add Security components
ValidationComponentUtils.setMessageKey(getCsmDbJndiUrlField(), CSM_DB_JNDI_URL);
ValidationComponentUtils.setMessageKey(getCsmDbConnectionUrlField(), CSM_DB_CONNECTION_URL);
ValidationComponentUtils.setMessageKey(getCsmDbUsernameField(), CSM_DB_USERNAME);
ValidationComponentUtils.setMessageKey(getCsmDbPasswordField(), CSM_DB_PASSWORD);
ValidationComponentUtils.setMessageKey(getCsmDbDriverField(), CSM_DB_DRIVER);
ValidationComponentUtils.setMessageKey(getCsmDbDialectField(), CSM_DB_DIALECT);
//TODO - Add caGrid Auth components
//TODO - Add Application Server Components
//TODO - Advanced Settings components
toggleDbConnectionFields();
toggleWritableApiFields();
toggleSecurityFields();
toggleCsmDbConnectionFields();
toggleCaGridLoginFields();
toggleCsmLoginFields();
validateInput();
updateComponentTreeSeverity();
}
private final class FocusChangeHandler implements FocusListener {
public void focusGained(FocusEvent e) {
update();
}
public void focusLost(FocusEvent e) {
update();
}
private void update() {
//updateModel();
validateInput();
}
}
private void validateInput() {
ValidationResult result = new ValidationResult();
if (!ValidationUtils.isNotBlank(this.getSdkInstallDirField().getText())) {
result.add(new SimpleValidationMessage(SDK_INSTALL_DIR + " must not be blank.", Severity.ERROR, SDK_INSTALL_DIR));
} else {
File file = new File(this.getSdkInstallDirField().getText());
if(!file.exists()){
result.add(new SimpleValidationMessage(SDK_INSTALL_DIR + " does not exist. Please select the Home directory of an existing SDK Installation.", Severity.ERROR, SDK_INSTALL_DIR));
}
}
if (!ValidationUtils.isNotBlank(this.getModelFileField().getText())) {
result.add(new SimpleValidationMessage(MODEL_FILE_PATH + " must not be blank.", Severity.ERROR, MODEL_FILE_PATH));
} else {
File file = new File(this.getModelFileField().getText());
if(!file.exists()){
result.add(new SimpleValidationMessage(MODEL_FILE_PATH + " does not exist. Please select an existing Model file.", Severity.ERROR, MODEL_FILE_PATH));
}
}
//DB Connection Setting Validation
if (!getUseJndiBasedConnectionCheckBox().isSelected()){
if (!ValidationUtils.isNotBlank(this.getDbConnectionUrlField().getText())) {
result.add(new SimpleValidationMessage(DB_CONNECTION_URL + " must not be blank.", Severity.ERROR, DB_CONNECTION_URL));
}
if (!ValidationUtils.isNotBlank(this.getDbUsernameField().getText())) {
result.add(new SimpleValidationMessage(DB_USERNAME + " must not be blank.", Severity.ERROR, DB_USERNAME));
}
if (!ValidationUtils.isNotBlank(this.getDbPasswordField().getText())) {
result.add(new SimpleValidationMessage(DB_PASSWORD + " must not be blank.", Severity.ERROR, DB_PASSWORD));
}
if (!ValidationUtils.isNotBlank(this.getDbDriverField().getText())) {
result.add(new SimpleValidationMessage(DB_DRIVER + " must not be blank.", Severity.ERROR, DB_DRIVER));
}
if (!ValidationUtils.isNotBlank(this.getDbDialectField().getText())) {
result.add(new SimpleValidationMessage(DB_DIALECT + " must not be blank.", Severity.ERROR, DB_DIALECT));
}
} else {
if (!ValidationUtils.isNotBlank(this.getDbJndiUrlField().getText())) {
result.add(new SimpleValidationMessage(DB_JNDI_URL + " must not be blank.", Severity.ERROR, DB_JNDI_URL));
}
}
if (getEnableSecurityCheckBox().isSelected()){
//CSM DB Connection Setting Validation
if (!getCsmUseJndiBasedConnectionCheckBox().isSelected()){
if (!ValidationUtils.isNotBlank(this.getCsmDbConnectionUrlField().getText())) {
result.add(new SimpleValidationMessage(CSM_DB_CONNECTION_URL + " must not be blank.", Severity.ERROR, CSM_DB_CONNECTION_URL));
}
if (!ValidationUtils.isNotBlank(this.getCsmDbUsernameField().getText())) {
result.add(new SimpleValidationMessage(CSM_DB_USERNAME + " must not be blank.", Severity.ERROR, CSM_DB_USERNAME));
}
if (!ValidationUtils.isNotBlank(this.getCsmDbPasswordField().getText())) {
result.add(new SimpleValidationMessage(CSM_DB_PASSWORD + " must not be blank.", Severity.ERROR, CSM_DB_PASSWORD));
}
if (!ValidationUtils.isNotBlank(this.getCsmDbDriverField().getText())) {
result.add(new SimpleValidationMessage(CSM_DB_DRIVER + " must not be blank.", Severity.ERROR, CSM_DB_DRIVER));
}
if (!ValidationUtils.isNotBlank(this.getCsmDbDialectField().getText())) {
result.add(new SimpleValidationMessage(CSM_DB_DIALECT + " must not be blank.", Severity.ERROR, CSM_DB_DIALECT));
}
} else {
if (!ValidationUtils.isNotBlank(this.getCsmDbJndiUrlField().getText())) {
result.add(new SimpleValidationMessage(CSM_DB_JNDI_URL + " must not be blank.", Severity.ERROR, CSM_DB_JNDI_URL));
}
}
}
this.validationModel.setResult(result);
updateComponentTreeSeverity();
updateGenerateButton();
updatePreviousButton();
updateNextButton();
}
private void updateComponentTreeSeverity() {
ValidationComponentUtils.updateComponentTreeMandatoryAndBlankBackground(this);
ValidationComponentUtils.updateComponentTreeSeverityBackground(this, this.validationModel.getResult());
}
private void updateGenerateButton() {
if (this.validationModel.hasErrors()) {
this.getGenerateButton().setEnabled(false);
} else {
this.getGenerateButton().setEnabled(true);
}
}
private void updatePreviousButton() {
if (mainTabbedPane.getSelectedIndex() <= 0){
this.getPreviousButton().setEnabled(false);
} else {
this.getPreviousButton().setEnabled(true);
}
}
private void updateNextButton() {
if (mainTabbedPane.getSelectedIndex() >= mainTabbedPane.getTabCount()-1){
this.getNextButton().setEnabled(false);
} else {
this.getNextButton().setEnabled(true);
}
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getMainPanel() {
if (mainPanel == null) {
GridBagConstraints gridBagConstraints111 = new GridBagConstraints();
gridBagConstraints111.fill = GridBagConstraints.BOTH;
gridBagConstraints111.weighty = 1.0;
gridBagConstraints111.weightx = 1.0;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.insets = new java.awt.Insets(5, 5, 5, 5);
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 2;
gridBagConstraints1.anchor = java.awt.GridBagConstraints.SOUTH;
gridBagConstraints1.gridheight = 1;
mainPanel = new JPanel();
mainPanel.setLayout(new GridBagLayout());
mainPanel.add(getButtonPanel(), gridBagConstraints1);
mainPanel.add(getMainTabbedPane(), gridBagConstraints111);
}
return mainPanel;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getButtonPanel() {
if (buttonPanel == null) {
buttonPanel = new JPanel();
buttonPanel.add(getPreviousButton(), null);
buttonPanel.add(getNextButton(), null);
buttonPanel.add(getGenerateButton(), null);
buttonPanel.add(getCloseButton(), null);
}
return buttonPanel;
}
/**
* This method initializes the Previous jButton
*
* @return javax.swing.JButton
*/
private JButton getPreviousButton() {
if (previousButton == null) {
previousButton = new JButton();
previousButton.setText("Previous");
previousButton.setIcon(SdkInstallerLookAndFeel.getPreviousIcon());
previousButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
mainTabbedPane.setSelectedIndex(getPreviousIndex());
validateInput();
}
});
}
return previousButton;
}
/**
* This method initializes the Previous jButton
*
* @return javax.swing.JButton
*/
private JButton getNextButton() {
if (nextButton == null) {
nextButton = new JButton();
nextButton.setText("Next");
nextButton.setIcon(SdkInstallerLookAndFeel.getNextIcon());
nextButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
mainTabbedPane.setSelectedIndex(getNextIndex());
validateInput();
}
});
}
return nextButton;
}
private int getPreviousIndex(){
int index = mainTabbedPane.getSelectedIndex();
while (index >= 0){
--index;
if (mainTabbedPane.isEnabledAt(index))
return index;
}
return 0;
}
private int getNextIndex(){
int index = mainTabbedPane.getSelectedIndex();
while (index <= mainTabbedPane.getTabCount()-1){
++index;
if (mainTabbedPane.isEnabledAt(index))
return index;
}
return mainTabbedPane.getTabCount() - 1;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getGenerateButton() {
if (generateButton == null) {
generateButton = new JButton();
generateButton.setText("Generate");
generateButton.setIcon(SdkInstallerLookAndFeel.getGenerateApplicationIcon());
generateButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
generateApplication(getSdkInstallDirField().getText(),getInstallerPropsMap());
}
});
}
return generateButton;
}
/**
* This method initializes projectNameField
*
* @return javax.swing.JTextField
*/
private JTextField getProjectNameField() {
if (projectNameField == null) {
projectNameField = new JTextField();
projectNameField.setText(DeployPropertiesManager.getDeployPropertyValue("PROJECT_NAME"));
projectNameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
updateSuggestedWebserviceName();
validateInput();
}
public void removeUpdate(DocumentEvent e) {
updateSuggestedWebserviceName();
validateInput();
}
public void insertUpdate(DocumentEvent e) {
updateSuggestedWebserviceName();
validateInput();
}
});
projectNameField.addFocusListener(new FocusChangeHandler());
}
return projectNameField;
}
protected void updateSuggestedWebserviceName() {
if (!hasUserModifiedWebserviceName)
getWebServiceNameField().setText(getProjectNameField().getText()+"Service");
}
protected void toggleDbConnectionFields() {
if (useJndiBasedConnectionCheckBox.isSelected()){
dbJndiUrlField.setEnabled(true);
dbConnectionUrlField.setEnabled(false);
dbUsernameField.setEnabled(false);
dbPasswordField.setEnabled(false);
dbDriverField.setEnabled(false);
dbDialectField.setEnabled(false);
} else{
dbJndiUrlField.setEnabled(false);
dbConnectionUrlField.setEnabled(true);
dbUsernameField.setEnabled(true);
dbPasswordField.setEnabled(true);
dbDriverField.setEnabled(true);
dbDialectField.setEnabled(true);
}
}
protected void toggleWritableApiFields() {
if (enableWritableApiExtensionCheckBox.isSelected()){
databaseTypeField.setEnabled(true);
identityGeneratorTagField.setEnabled(true);
caDsrConnectionUrlField.setEnabled(true);
mainTabbedPane.setEnabledAt(LOGGING_PANEL_INDEX, true); // CLM Panel
enableCommonLoggingModuleCheckBox.setEnabled(true);
if (enableCommonLoggingModuleCheckBox.isSelected()){
clmProjectName.setEnabled(true);
clmDbConnectionUrlField.setEnabled(true);
clmDbUsernameField.setEnabled(true);
clmDbPasswordField.setEnabled(true);
clmDbDriverField.setEnabled(true);
} else {
clmProjectName.setEnabled(false);
clmDbConnectionUrlField.setEnabled(false);
clmDbUsernameField.setEnabled(false);
clmDbPasswordField.setEnabled(false);
clmDbDriverField.setEnabled(false);
}
} else{
databaseTypeField.setEnabled(false);
identityGeneratorTagField.setEnabled(false);
caDsrConnectionUrlField.setEnabled(false);
mainTabbedPane.setEnabledAt(LOGGING_PANEL_INDEX, false); // CLM Panel
enableCommonLoggingModuleCheckBox.setEnabled(false);
clmProjectName.setEnabled(false);
clmDbConnectionUrlField.setEnabled(false);
clmDbUsernameField.setEnabled(false);
clmDbPasswordField.setEnabled(false);
clmDbDriverField.setEnabled(false);
}
}
protected void toggleSecurityFields() {
if (enableSecurityCheckBox.isSelected()){
enableInstanceLevelSecurityCheckBox.setEnabled(true);
enableAttributeLevelSecurityCheckBox.setEnabled(true);
csmProjectNameField.setEnabled(true);
cacheProtectionElementsCheckBox.setEnabled(true);
mainTabbedPane.setEnabledAt(CSM_PANEL_INDEX, true); // CSM Panel
mainTabbedPane.setEnabledAt(CAGRID_AUTH_PANEL_INDEX, true); // caGrid Auth Panel
} else{
enableInstanceLevelSecurityCheckBox.setEnabled(false);
enableAttributeLevelSecurityCheckBox.setEnabled(false);
csmProjectNameField.setEnabled(false);
cacheProtectionElementsCheckBox.setEnabled(false);
mainTabbedPane.setEnabledAt(CSM_PANEL_INDEX, false); // CSM Panel
mainTabbedPane.setEnabledAt(CAGRID_AUTH_PANEL_INDEX, false); // caGrid Auth Panel
}
}
protected void toggleCsmDbConnectionFields() {
if (csmUseJndiBasedConnectionCheckBox.isSelected()){
csmDbJndiUrlField.setEnabled(true);
csmDbConnectionUrlField.setEnabled(false);
csmDbUsernameField.setEnabled(false);
csmDbPasswordField.setEnabled(false);
csmDbDriverField.setEnabled(false);
csmDbDialectField.setEnabled(false);
} else{
csmDbJndiUrlField.setEnabled(false);
csmDbConnectionUrlField.setEnabled(true);
csmDbUsernameField.setEnabled(true);
csmDbPasswordField.setEnabled(true);
csmDbDriverField.setEnabled(true);
csmDbDialectField.setEnabled(true);
}
}
protected void toggleCaGridLoginFields() {
if (enableCaGridLoginModuleCheckBox.isSelected()){
caGridLoginModuleNameField.setEnabled(true);
caGridAuthSvcUrlField.setEnabled(true);
caGridDorianSvcUrlField.setEnabled(true);
} else{
caGridLoginModuleNameField.setEnabled(false);
caGridAuthSvcUrlField.setEnabled(false);
caGridDorianSvcUrlField.setEnabled(false);
}
}
protected void toggleCsmLoginFields() {
if (enableCsmLoginModuleCheckBox.isSelected()){
sdkGridLoginSvcNameField.setEnabled(true);
sdkGridLoginSvcUrlField.setEnabled(true);
} else{
sdkGridLoginSvcNameField.setEnabled(false);
sdkGridLoginSvcUrlField.setEnabled(false);
}
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getSdkInstallDirField() {
if (sdkInstallDirField == null) {
sdkInstallDirField = new JTextField();
// sdkInstallDirField.setText(home + File.separator
// + IntroduceEnginePropertiesManager.getIntroducePropertyValue(IntroduceConstants.DEFAULT_SERVICE_NAME));
sdkInstallDirField.setText("");
sdkInstallDirField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
sdkInstallDirField.addFocusListener(new FocusChangeHandler());
}
return sdkInstallDirField;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getSdkInstallDirButton() {
if (sdkInstallDirButton == null) {
sdkInstallDirButton = new JButton();
sdkInstallDirButton.setText("Browse");
sdkInstallDirButton.setIcon(SdkInstallerLookAndFeel.getBrowseIcon());
sdkInstallDirButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
try {
String previous = getSdkInstallDirField().getText();
String location = ResourceManager.promptDir(previous);
if (location != null && location.length() > 0) {
getSdkInstallDirField().setText(location);
} else {
getSdkInstallDirField().setText(previous);
}
validateInput();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
}
return sdkInstallDirButton;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getModelFilePathButton() {
if (modelFilePathButton == null) {
modelFilePathButton = new JButton();
modelFilePathButton.setText("Browse");
modelFilePathButton.setIcon(SdkInstallerLookAndFeel.getBrowseIcon());
modelFilePathButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
try {
String previous = getModelFileField().getText();
String location = ResourceManager.promptFile(previous, FileFilters.XMI_FILTER);
if (location != null && location.length() > 0) {
getModelFileField().setText(location);
} else {
getModelFileField().setText(previous);
}
validateInput();
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
}
return modelFilePathButton;
}
/**
* This method initializes Project Namespace Prefix Field
*
* @return javax.swing.JTextField
*/
private JTextField getNamespacePrefixField() {
if (namespacePrefixField == null) {
namespacePrefixField = new JTextField();
namespacePrefixField.setText(DeployPropertiesManager.getDeployPropertyValue("NAMESPACE_PREFIX"));
namespacePrefixField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
namespacePrefixField.addFocusListener(new FocusChangeHandler());
}
return namespacePrefixField;
}
/**
* This method initializes webserviceNameField
*
* @return javax.swing.JTextField
*/
private JTextField getWebServiceNameField() {
if (webserviceNameField == null) {
webserviceNameField = new JTextField();
//webserviceNameField.setText(DeployPropertiesManager.getDeployPropertyValue("WEBSERVICE_NAME"));
webserviceNameField.setText(DeployPropertiesManager.getDeployPropertyValue("PROJECT_NAME")+"Service");
webserviceNameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
if (isFocusOwner())
hasUserModifiedWebserviceName=true;
validateInput();
}
public void removeUpdate(DocumentEvent e) {
if (isFocusOwner())
hasUserModifiedWebserviceName=true;
validateInput();
}
public void insertUpdate(DocumentEvent e) {
if (isFocusOwner())
hasUserModifiedWebserviceName=true;
validateInput();
}
});
webserviceNameField.addFocusListener(new FocusChangeHandler());
}
return webserviceNameField;
}
/**
* This method initializes Model File Field
*
* @return javax.swing.JTextField
*/
private JTextField getModelFileField() {
if (modelFileField == null) {
modelFileField = new JTextField();
//modelFileField.setText(DeployPropertiesManager.getDeployPropertyValue("MODEL_FILE"));
modelFileField.setText("");
modelFileField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
modelFileField.addFocusListener(new FocusChangeHandler());
}
return modelFileField;
}
/**
* This method initializes Model File Type Combo Box
*
* @return javax.swing.JComboBox
*/
private JComboBox getModelFileTypeField() {
if (modelFileTypeComboBox == null) {
modelFileTypeComboBox = new JComboBox();
modelFileTypeComboBox.addItem("EA");
modelFileTypeComboBox.addItem("ARGO");
String modelFileType = DeployPropertiesManager.getDeployPropertyValue("MODEL_FILE_TYPE");
modelFileTypeComboBox.setSelectedItem(modelFileType);
// modelFileTypeComboBox.getDocument().addDocumentListener(new DocumentListener() {
// public void changedUpdate(DocumentEvent e) {
// validateInput();
// }
//
// public void removeUpdate(DocumentEvent e) {
// validateInput();
// }
//
// public void insertUpdate(DocumentEvent e) {
// validateInput();
// }
// });
modelFileTypeComboBox.addFocusListener(new FocusChangeHandler());
}
return modelFileTypeComboBox;
}
/**
* This method initializes Logical Model Field
*
* @return javax.swing.JTextField
*/
private JTextField getLogicalModelField() {
if (logicalModelField == null) {
logicalModelField = new JTextField();
logicalModelField.setText(DeployPropertiesManager.getDeployPropertyValue("LOGICAL_MODEL"));
logicalModelField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
logicalModelField.addFocusListener(new FocusChangeHandler());
}
return logicalModelField;
}
/**
* This method initializes Data Model Field
*
* @return javax.swing.JTextField
*/
private JTextField getDataModelField() {
if (dataModelField == null) {
dataModelField = new JTextField();
dataModelField.setText(DeployPropertiesManager.getDeployPropertyValue("DATA_MODEL"));
dataModelField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dataModelField.addFocusListener(new FocusChangeHandler());
}
return dataModelField;
}
/**
* This method initializes the Include Package Field
*
* @return javax.swing.JTextField
*/
private JTextField getIncludePackageField() {
if (includePackageField == null) {
includePackageField = new JTextField();
includePackageField.setText(DeployPropertiesManager.getDeployPropertyValue("INCLUDE_PACKAGE"));
includePackageField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
includePackageField.addFocusListener(new FocusChangeHandler());
}
return includePackageField;
}
/**
* This method initializes the Exclude Package Field
*
* @return javax.swing.JTextField
*/
private JTextField getExcludePackageField() {
if (excludePackageField == null) {
excludePackageField = new JTextField();
excludePackageField.setText(DeployPropertiesManager.getDeployPropertyValue("EXCLUDE_PACKAGE"));
excludePackageField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
excludePackageField.addFocusListener(new FocusChangeHandler());
}
return excludePackageField;
}
/**
* This method initializes the Exclude Name Field
*
* @return javax.swing.JTextField
*/
private JTextField getExcludeNameField() {
if (excludeNameField == null) {
excludeNameField = new JTextField();
excludeNameField.setText(DeployPropertiesManager.getDeployPropertyValue("EXCLUDE_NAME"));
excludeNameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
excludeNameField.addFocusListener(new FocusChangeHandler());
}
return excludeNameField;
}
/**
* This method initializes the Exclude Namespace Field
*
* @return javax.swing.JTextField
*/
private JTextField getExcludeNamespaceField() {
if (excludeNamespaceField == null) {
excludeNamespaceField = new JTextField();
excludeNamespaceField.setText(DeployPropertiesManager.getDeployPropertyValue("EXCLUDE_NAMESPACE"));
excludeNamespaceField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
excludeNamespaceField.addFocusListener(new FocusChangeHandler());
}
return excludeNamespaceField;
}
/**
* This method initializes the Validate Logical Model Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getValidateLogicalModelCheckBox() {
if (validateLogicalModelCheckBox == null) {
validateLogicalModelCheckBox = new JCheckBox();
validateLogicalModelCheckBox.setToolTipText("Validate the Logical Model prior to generating the application?");
validateLogicalModelCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
validateLogicalModelCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("VALIDATE_LOGICAL_MODEL")));
validateLogicalModelCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
validateLogicalModelCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//e.g.: checkResourcePropertyOptions();
}
});
validateLogicalModelCheckBox.addFocusListener(new FocusChangeHandler());
}
return validateLogicalModelCheckBox;
}
/**
* This method initializes the Validate Model Mapping Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getValidateModelMappingCheckBox() {
if (validateModelMappingCheckBox == null) {
validateModelMappingCheckBox = new JCheckBox();
validateModelMappingCheckBox.setToolTipText("Validate the Model Mapping prior to generating the application?");
validateModelMappingCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
validateModelMappingCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("VALIDATE_MODEL_MAPPING")));
validateModelMappingCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
validateModelMappingCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
validateModelMappingCheckBox.addFocusListener(new FocusChangeHandler());
}
return validateModelMappingCheckBox;
}
/**
* This method initializes the Validate Model Mapping Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getValidateGmeTagsCheckBox() {
if (validateGmeTagsCheckBox == null) {
validateGmeTagsCheckBox = new JCheckBox();
validateGmeTagsCheckBox.setToolTipText("Validate GME tags in the logical model prior to generating the application?");
validateGmeTagsCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
validateGmeTagsCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("VALIDATE_GME_TAGS")));
validateGmeTagsCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
validateGmeTagsCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
validateGmeTagsCheckBox.addFocusListener(new FocusChangeHandler());
}
return validateGmeTagsCheckBox;
}
/**
* This method initializes the Generate Beans Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateBeansCheckBox() {
if (generateBeansCheckBox == null) {
generateBeansCheckBox = new JCheckBox();
generateBeansCheckBox.setToolTipText("Generate domain Java Beans?");
generateBeansCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateBeansCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_BEANS")));
generateBeansCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateBeansCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateBeansCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateBeansCheckBox;
}
/**
* This method initializes the Generate Hibernate Mapping File Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateHibernateMappingCheckBox() {
if (generateHibernateMappingCheckBox == null) {
generateHibernateMappingCheckBox = new JCheckBox();
generateHibernateMappingCheckBox.setToolTipText("Generate Hibernate mapping files?");
generateHibernateMappingCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateHibernateMappingCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_HIBERNATE_MAPPING")));
generateHibernateMappingCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateHibernateMappingCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateHibernateMappingCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateHibernateMappingCheckBox;
}
/**
* This method initializes the Generate Castor Mapping File Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateCastorMappingCheckBox() {
if (generateCastorMappingCheckBox == null) {
generateCastorMappingCheckBox = new JCheckBox();
generateCastorMappingCheckBox.setToolTipText("Generate Castor mapping files?");
generateCastorMappingCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateCastorMappingCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_CASTOR_MAPPING")));
generateCastorMappingCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateCastorMappingCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateCastorMappingCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateCastorMappingCheckBox;
}
/**
* This method initializes the Generate XSD Schema Files Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateXsdCheckBox() {
if (generateXsdCheckBox == null) {
generateXsdCheckBox = new JCheckBox();
generateXsdCheckBox.setToolTipText("Generate Castor mapping files?");
generateXsdCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateXsdCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_XSD")));
generateXsdCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateXsdCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateXsdCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateXsdCheckBox;
}
/**
* This method initializes the Generate XSD Files Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox generateXsdWithGmeTagsCheckBox() {
if (generateXsdWithGmeTagsCheckBox == null) {
generateXsdWithGmeTagsCheckBox = new JCheckBox();
generateXsdWithGmeTagsCheckBox.setToolTipText("Generate XSD files?");
generateXsdWithGmeTagsCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateXsdWithGmeTagsCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_XSD_WITH_GME_TAGS")));
generateXsdWithGmeTagsCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateXsdWithGmeTagsCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateXsdWithGmeTagsCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateXsdWithGmeTagsCheckBox;
}
/**
* This method initializes the Generate XSD with Permissible Values Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateXsdWithPermissibleValuesCheckBox() {
if (generateXsdWithPermissibleValuesCheckBox == null) {
generateXsdWithPermissibleValuesCheckBox = new JCheckBox();
generateXsdWithPermissibleValuesCheckBox.setToolTipText("Generate XSD files using Permissible Values?");
generateXsdWithPermissibleValuesCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateXsdWithPermissibleValuesCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_XSD_WITH_PERMISSIBLE_VALUES")));
generateXsdWithPermissibleValuesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateXsdWithPermissibleValuesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateXsdWithPermissibleValuesCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateXsdWithPermissibleValuesCheckBox;
}
/**
* This method initializes the Generate XSD with Permissible Values Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateWsddLabelCheckBox() {
if (generateWsddCheckBox == null) {
generateWsddCheckBox = new JCheckBox();
generateWsddCheckBox.setToolTipText("Generate XSD files?");
generateWsddCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateWsddCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_WSDD")));
generateWsddCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateWsddCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateWsddCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateWsddCheckBox;
}
/**
* This method initializes the Generate XSD with Permissible Values Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getGenerateHibernateValidatorCheckBox() {
if (generateHibernateValidatorCheckBox == null) {
generateHibernateValidatorCheckBox = new JCheckBox();
generateHibernateValidatorCheckBox.setToolTipText("Generate Hibernate Validator?");
generateHibernateValidatorCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
generateHibernateValidatorCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("GENERATE_HIBERNATE_VALIDATOR")));
generateHibernateValidatorCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
generateHibernateValidatorCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
;//e.g.: checkResourcePropertyOptions();
}
});
generateHibernateValidatorCheckBox.addFocusListener(new FocusChangeHandler());
}
return generateHibernateValidatorCheckBox;
}
/**
* This method initializes the Use JNDI Based Connection Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getUseJndiBasedConnectionCheckBox() {
if (useJndiBasedConnectionCheckBox == null) {
useJndiBasedConnectionCheckBox = new JCheckBox();
useJndiBasedConnectionCheckBox.setToolTipText("Use a JNDI-based Databse Connection?");
useJndiBasedConnectionCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
useJndiBasedConnectionCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("USE_JNDI_BASED_CONNECTION")));
useJndiBasedConnectionCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
useJndiBasedConnectionCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleDbConnectionFields();
validateInput();
}
});
useJndiBasedConnectionCheckBox.addFocusListener(new FocusChangeHandler());
}
return useJndiBasedConnectionCheckBox;
}
/**
* This method initializes the Database JNDI URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getDbJndiUrlField() {
if (dbJndiUrlField == null) {
dbJndiUrlField = new JTextField();
dbJndiUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_JNDI_URL"));
dbJndiUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dbJndiUrlField.addFocusListener(new FocusChangeHandler());
}
return dbJndiUrlField;
}
/**
* This method initializes the Database Connection URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getDbConnectionUrlField() {
if (dbConnectionUrlField == null) {
dbConnectionUrlField = new JTextField();
dbConnectionUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_CONNECTION_URL"));
dbConnectionUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dbConnectionUrlField.addFocusListener(new FocusChangeHandler());
}
return dbConnectionUrlField;
}
/**
* This method initializes the Database Username Field
*
* @return javax.swing.JTextField
*/
private JTextField getDbUsernameField() {
if (dbUsernameField == null) {
dbUsernameField = new JTextField();
dbUsernameField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_USERNAME"));
dbUsernameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dbUsernameField.addFocusListener(new FocusChangeHandler());
}
return dbUsernameField;
}
/**
* This method initializes the Database Password Field
*
* @return javax.swing.JTextField
*/
private JTextField getDbPasswordField() {
if (dbPasswordField == null) {
dbPasswordField = new JTextField();
dbPasswordField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_PASSWORD"));
dbPasswordField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dbPasswordField.addFocusListener(new FocusChangeHandler());
}
return dbPasswordField;
}
/**
* This method initializes the Database Driver Field
*
* @return javax.swing.JTextField
*/
private JTextField getDbDriverField() {
if (dbDriverField == null) {
dbDriverField = new JTextField();
dbDriverField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_DRIVER"));
dbDriverField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dbDriverField.addFocusListener(new FocusChangeHandler());
}
return dbDriverField;
}
/**
* This method initializes the Database Driver Field
*
* @return javax.swing.JTextField
*/
private JTextField getDbDialectField() {
if (dbDialectField == null) {
dbDialectField = new JTextField();
dbDialectField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_DIALECT"));
dbDialectField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
dbDialectField.addFocusListener(new FocusChangeHandler());
}
return dbDialectField;
}
/**
* This method initializes the Enable Writable API Extension CheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableWritableApiExtensionCheckBox() {
if (enableWritableApiExtensionCheckBox == null) {
enableWritableApiExtensionCheckBox = new JCheckBox();
enableWritableApiExtensionCheckBox.setToolTipText("Enable Writable API Extension?");
enableWritableApiExtensionCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableWritableApiExtensionCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_WRITABLE_API_EXTENSION")));
enableWritableApiExtensionCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableWritableApiExtensionCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleWritableApiFields();
validateInput();
}
});
enableWritableApiExtensionCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableWritableApiExtensionCheckBox;
}
/**
* This method initializes the Writable API Database Type Field
*
* @return javax.swing.JTextField
*/
private JTextField getDatabaseTypeField() {
if (databaseTypeField == null) {
databaseTypeField = new JTextField();
databaseTypeField.setText(DeployPropertiesManager.getDeployPropertyValue("DATABASE_TYPE"));
databaseTypeField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
databaseTypeField.addFocusListener(new FocusChangeHandler());
}
return databaseTypeField;
}
/**
* This method initializes the Writable API Identity Generator Tag Field
*
* @return javax.swing.JTextField
*/
private JTextField getIdentityGeneratorTagField() {
if (identityGeneratorTagField == null) {
identityGeneratorTagField = new JTextField();
identityGeneratorTagField.setText(DeployPropertiesManager.getDeployPropertyValue("IDENTITY_GENERATOR_TAG"));
identityGeneratorTagField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
identityGeneratorTagField.addFocusListener(new FocusChangeHandler());
}
return identityGeneratorTagField;
}
/**
* This method initializes the CLM Database Connection URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getCaDsrConnectionUrlField() {
if (caDsrConnectionUrlField == null) {
caDsrConnectionUrlField = new JTextField();
caDsrConnectionUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("CADSR_CONNECTION_URL"));
caDsrConnectionUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
caDsrConnectionUrlField.addFocusListener(new FocusChangeHandler());
}
return caDsrConnectionUrlField;
}
/**
* This method initializes the Enable Common Logging Module CheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableCommonLoggingModuleCheckBox() {
if (enableCommonLoggingModuleCheckBox == null) {
enableCommonLoggingModuleCheckBox = new JCheckBox();
enableCommonLoggingModuleCheckBox.setToolTipText("Enable Logging?");
enableCommonLoggingModuleCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableCommonLoggingModuleCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_WRITABLE_API_EXTENSION")));
enableCommonLoggingModuleCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableCommonLoggingModuleCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleWritableApiFields();
}
});
enableCommonLoggingModuleCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableCommonLoggingModuleCheckBox;
}
/**
* This method initializes the CLM Project Name Field
*
* @return javax.swing.JTextField
*/
private JTextField getClmProjectName() {
if (clmProjectName == null) {
clmProjectName = new JTextField();
clmProjectName.setText(DeployPropertiesManager.getDeployPropertyValue("PROJECT_NAME"));
clmProjectName.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
clmProjectName.addFocusListener(new FocusChangeHandler());
}
return clmProjectName;
}
/**
* This method initializes the CLM Database Connection URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getClmDbConnectionUrlField() {
if (clmDbConnectionUrlField == null) {
clmDbConnectionUrlField = new JTextField();
clmDbConnectionUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_CONNECTION_URL"));
clmDbConnectionUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
clmDbConnectionUrlField.addFocusListener(new FocusChangeHandler());
}
return clmDbConnectionUrlField;
}
/**
* This method initializes the CLM Database Username Field
*
* @return javax.swing.JTextField
*/
private JTextField getClmDbUsernameField() {
if (clmDbUsernameField == null) {
clmDbUsernameField = new JTextField();
clmDbUsernameField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_USERNAME"));
clmDbUsernameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
clmDbUsernameField.addFocusListener(new FocusChangeHandler());
}
return clmDbUsernameField;
}
/**
* This method initializes the CLM Database Password Field
*
* @return javax.swing.JTextField
*/
private JTextField getClmDbPasswordField() {
if (clmDbPasswordField == null) {
clmDbPasswordField = new JTextField();
clmDbPasswordField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_PASSWORD"));
clmDbPasswordField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
clmDbPasswordField.addFocusListener(new FocusChangeHandler());
}
return clmDbPasswordField;
}
/**
* This method initializes the Database Driver Field
*
* @return javax.swing.JTextField
*/
private JTextField getClmDbDriverField() {
if (clmDbDriverField == null) {
clmDbDriverField = new JTextField();
clmDbDriverField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_DRIVER"));
clmDbDriverField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
clmDbDriverField.addFocusListener(new FocusChangeHandler());
}
return clmDbDriverField;
}
/**
* This method initializes the Enable Common Logging Module CheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableSecurityCheckBox() {
if (enableSecurityCheckBox == null) {
enableSecurityCheckBox = new JCheckBox();
enableSecurityCheckBox.setToolTipText("Enable Security Extension?");
enableSecurityCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableSecurityCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_SECURITY")));
enableSecurityCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableSecurityCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleSecurityFields();
validateInput();
}
});
enableSecurityCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableSecurityCheckBox;
}
/**
* This method initializes the Enable Instance Level Security CheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableInstanceLevelSecurityCheckBox() {
if (enableInstanceLevelSecurityCheckBox == null) {
enableInstanceLevelSecurityCheckBox = new JCheckBox();
enableInstanceLevelSecurityCheckBox.setToolTipText("Enable Instance Level Security?");
enableInstanceLevelSecurityCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableInstanceLevelSecurityCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_INSTANCE_LEVEL_SECURITY")));
enableInstanceLevelSecurityCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableInstanceLevelSecurityCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleSecurityFields();
validateInput();
}
});
enableInstanceLevelSecurityCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableInstanceLevelSecurityCheckBox;
}
/**
* This method initializes the Enable Attribute Level Security CheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableAttributeLevelSecurityCheckBox() {
if (enableAttributeLevelSecurityCheckBox == null) {
enableAttributeLevelSecurityCheckBox = new JCheckBox();
enableAttributeLevelSecurityCheckBox.setToolTipText("Enable Attribute Level Security?");
enableAttributeLevelSecurityCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableAttributeLevelSecurityCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_ATTRIBUTE_LEVEL_SECURITY")));
enableAttributeLevelSecurityCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableAttributeLevelSecurityCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleSecurityFields();
validateInput();
}
});
enableAttributeLevelSecurityCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableAttributeLevelSecurityCheckBox;
}
/**
* This method initializes the CSM Project Name Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmProjectNameField() {
if (csmProjectNameField == null) {
csmProjectNameField = new JTextField();
csmProjectNameField.setText(DeployPropertiesManager.getDeployPropertyValue("PROJECT_NAME"));
csmProjectNameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmProjectNameField.addFocusListener(new FocusChangeHandler());
}
return csmProjectNameField;
}
/**
* This method initializes the Cache Protection Elements CheckBox
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getCacheProtectionElementsCheckBox() {
if (cacheProtectionElementsCheckBox == null) {
cacheProtectionElementsCheckBox = new JCheckBox();
cacheProtectionElementsCheckBox.setToolTipText("Cache Protection Elements?");
cacheProtectionElementsCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
cacheProtectionElementsCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("CACHE_PROTECTION_ELEMENTS")));
cacheProtectionElementsCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
cacheProtectionElementsCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleSecurityFields();
validateInput();
}
});
cacheProtectionElementsCheckBox.addFocusListener(new FocusChangeHandler());
}
return cacheProtectionElementsCheckBox;
}
/**
* This method initializes the CSM Use JNDI Based Connection Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getCsmUseJndiBasedConnectionCheckBox() {
if (csmUseJndiBasedConnectionCheckBox == null) {
csmUseJndiBasedConnectionCheckBox = new JCheckBox();
csmUseJndiBasedConnectionCheckBox.setToolTipText("Use a JNDI-based CSM Databse Connection?");
csmUseJndiBasedConnectionCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
csmUseJndiBasedConnectionCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("USE_JNDI_BASED_CONNECTION")));
csmUseJndiBasedConnectionCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
csmUseJndiBasedConnectionCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleCsmDbConnectionFields();
validateInput();
}
});
csmUseJndiBasedConnectionCheckBox.addFocusListener(new FocusChangeHandler());
}
return csmUseJndiBasedConnectionCheckBox;
}
/**
* This method initializes the CSM Database JNDI URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmDbJndiUrlField() {
if (csmDbJndiUrlField == null) {
csmDbJndiUrlField = new JTextField();
csmDbJndiUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_JNDI_URL"));
csmDbJndiUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmDbJndiUrlField.addFocusListener(new FocusChangeHandler());
}
return csmDbJndiUrlField;
}
/**
* This method initializes the CSM Database Connection URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmDbConnectionUrlField() {
if (csmDbConnectionUrlField == null) {
csmDbConnectionUrlField = new JTextField();
csmDbConnectionUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_CONNECTION_URL"));
csmDbConnectionUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmDbConnectionUrlField.addFocusListener(new FocusChangeHandler());
}
return csmDbConnectionUrlField;
}
/**
* This method initializes the CSM Database Username Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmDbUsernameField() {
if (csmDbUsernameField == null) {
csmDbUsernameField = new JTextField();
csmDbUsernameField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_USERNAME"));
csmDbUsernameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmDbUsernameField.addFocusListener(new FocusChangeHandler());
}
return csmDbUsernameField;
}
/**
* This method initializes the CSM Database Password Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmDbPasswordField() {
if (csmDbPasswordField == null) {
csmDbPasswordField = new JTextField();
csmDbPasswordField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_PASSWORD"));
csmDbPasswordField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmDbPasswordField.addFocusListener(new FocusChangeHandler());
}
return csmDbPasswordField;
}
/**
* This method initializes the CSM Database Driver Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmDbDriverField() {
if (csmDbDriverField == null) {
csmDbDriverField = new JTextField();
csmDbDriverField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_DRIVER"));
csmDbDriverField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmDbDriverField.addFocusListener(new FocusChangeHandler());
}
return csmDbDriverField;
}
/**
* This method initializes the Database Dialect Field
*
* @return javax.swing.JTextField
*/
private JTextField getCsmDbDialectField() {
if (csmDbDialectField == null) {
csmDbDialectField = new JTextField();
csmDbDialectField.setText(DeployPropertiesManager.getDeployPropertyValue("DB_DIALECT"));
csmDbDialectField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
csmDbDialectField.addFocusListener(new FocusChangeHandler());
}
return csmDbDialectField;
}
/**
* This method initializes the caGrid Authentication Service URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getCaGridAuthSvcUrlField() {
if (caGridAuthSvcUrlField == null) {
caGridAuthSvcUrlField = new JTextField();
caGridAuthSvcUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("CAGRID_AUTHENTICATION_SERVICE_URL"));
caGridAuthSvcUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
caGridAuthSvcUrlField.addFocusListener(new FocusChangeHandler());
}
return caGridAuthSvcUrlField;
}
/**
* This method initializes the caGrid Dorian Service URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getCaGridDorianSvcUrlField() {
if (caGridDorianSvcUrlField == null) {
caGridDorianSvcUrlField = new JTextField();
caGridDorianSvcUrlField.setText(DeployPropertiesManager.getDeployPropertyValue("CAGRID_DORIAN_SERVICE_URL"));
caGridDorianSvcUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
caGridDorianSvcUrlField.addFocusListener(new FocusChangeHandler());
}
return caGridDorianSvcUrlField;
}
/**
* This method initializes the SDK Grid Login Service Name Field
*
* @return javax.swing.JTextField
*/
private JTextField getSdkGridLoginSvcNameField() {
if (sdkGridLoginSvcNameField == null) {
sdkGridLoginSvcNameField = new JTextField();
sdkGridLoginSvcNameField.setText(DeployPropertiesManager.getDeployPropertyValue("SDK_GRID_LOGIN_SERVICE_NAME"));
sdkGridLoginSvcNameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
sdkGridLoginSvcNameField.addFocusListener(new FocusChangeHandler());
}
return sdkGridLoginSvcNameField;
}
/**
* This method initializes the SDK Grid Login Service URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getSdkGridLoginSvcUrlField() {
if (sdkGridLoginSvcUrlField == null) {
sdkGridLoginSvcUrlField = new JTextField();
String sdkGridLoginServiceURL = DeployPropertiesManager.getDeployPropertyValue("SDK_GRID_LOGIN_SERVICE_URL");
String sdkGridLoginServiceName = DeployPropertiesManager.getDeployPropertyValue("SDK_GRID_LOGIN_SERVICE_NAME");
sdkGridLoginServiceURL = sdkGridLoginServiceURL.substring(0, sdkGridLoginServiceURL.indexOf('$'))+sdkGridLoginServiceName;
sdkGridLoginSvcUrlField.setText(sdkGridLoginServiceURL);
sdkGridLoginSvcUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
sdkGridLoginSvcUrlField.addFocusListener(new FocusChangeHandler());
}
return sdkGridLoginSvcUrlField;
}
/**
* This method initializes the Enable caGrid Login Module Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableCaGridLoginModuleCheckBox() {
if (enableCaGridLoginModuleCheckBox == null) {
enableCaGridLoginModuleCheckBox = new JCheckBox();
enableCaGridLoginModuleCheckBox.setToolTipText("Enable Grid Login Module?");
enableCaGridLoginModuleCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableCaGridLoginModuleCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_GRID_LOGIN_MODULE")));
enableCaGridLoginModuleCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableCaGridLoginModuleCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleCaGridLoginFields();
validateInput();
}
});
enableCaGridLoginModuleCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableCaGridLoginModuleCheckBox;
}
/**
* This method initializes the Enable CSM Login Module Check Box
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getEnableCsmLoginModuleCheckBox() {
if (enableCsmLoginModuleCheckBox == null) {
enableCsmLoginModuleCheckBox = new JCheckBox();
enableCsmLoginModuleCheckBox.setToolTipText("Enable CSM Login Module?");
enableCsmLoginModuleCheckBox.setHorizontalAlignment(SwingConstants.LEADING);
enableCsmLoginModuleCheckBox.setSelected(Boolean.parseBoolean(DeployPropertiesManager.getDeployPropertyValue("ENABLE_CSM_LOGIN_MODULE")));
enableCsmLoginModuleCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
enableCsmLoginModuleCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleCsmLoginFields();
validateInput();
}
});
enableCsmLoginModuleCheckBox.addFocusListener(new FocusChangeHandler());
}
return enableCsmLoginModuleCheckBox;
}
/**
* This method initializes the caGrid Login Module Name Field
*
* @return javax.swing.JTextField
*/
private JTextField getCaGridLoginModuleNameField() {
if (caGridLoginModuleNameField == null) {
caGridLoginModuleNameField = new JTextField();
caGridLoginModuleNameField.setText(DeployPropertiesManager.getDeployPropertyValue("CAGRID_LOGIN_MODULE_NAME"));
caGridLoginModuleNameField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
caGridLoginModuleNameField.addFocusListener(new FocusChangeHandler());
}
return caGridLoginModuleNameField;
}
/**
* This method initializes the Cache Path Field
*
* @return javax.swing.JTextField
*/
private JTextField getCachePathField() {
if (cachePathField == null) {
cachePathField = new JTextField();
cachePathField.setText(DeployPropertiesManager.getDeployPropertyValue("CACHE_PATH"));
cachePathField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
cachePathField.addFocusListener(new FocusChangeHandler());
}
return cachePathField;
}
/**
* This method initializes the Server Type Combo Box
*
* @return javax.swing.JTextField
*/
private JComboBox getServerTypeComboBox() {
if (serverTypeComboBox == null) {
serverTypeComboBox = new JComboBox();
serverTypeComboBox.addItem("jboss");
serverTypeComboBox.addItem("other");
String serverType = DeployPropertiesManager.getDeployPropertyValue("SERVER_TYPE");
if (serverType.equalsIgnoreCase("jboss")){
serverTypeComboBox.setSelectedItem("jboss");
} else{
serverTypeComboBox.setSelectedItem("other");
}
// serverTypeField.getDocument().addDocumentListener(new DocumentListener() {
// public void changedUpdate(DocumentEvent e) {
// validateInput();
// }
//
// public void removeUpdate(DocumentEvent e) {
// validateInput();
// }
//
// public void insertUpdate(DocumentEvent e) {
// validateInput();
// }
// });
serverTypeComboBox.addFocusListener(new FocusChangeHandler());
}
return serverTypeComboBox;
}
/**
* This method initializes the Server URL Field
*
* @return javax.swing.JTextField
*/
private JTextField getServerUrlField() {
if (serverUrlField == null) {
serverUrlField = new JTextField();
String projectName = DeployPropertiesManager.getDeployPropertyValue("PROJECT_NAME");
String serverUrl = DeployPropertiesManager.getDeployPropertyValue("SERVER_URL");
serverUrl = serverUrl.substring(0, serverUrl.indexOf('$'))+projectName;
serverUrlField.setText(serverUrl);
serverUrlField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
validateInput();
}
public void removeUpdate(DocumentEvent e) {
validateInput();
}
public void insertUpdate(DocumentEvent e) {
validateInput();
}
});
serverUrlField.addFocusListener(new FocusChangeHandler());
}
return serverUrlField;
}
//TODO
/**
* This method initializes closeButton
*
* @return javax.swing.JButton
*/
private JButton getCloseButton() {
if (closeButton == null) {
closeButton = new JButton();
closeButton.setIcon(PortalLookAndFeel.getCloseIcon());
closeButton.setText("Cancel");
closeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
dispose();
}
});
}
return closeButton;
}
/**
* This method initializes mainTabbedPane
*
* @return javax.swing.JTabbedPane
*/
private JTabbedPane getMainTabbedPane() {
if (mainTabbedPane == null) {
mainTabbedPane = new JTabbedPane();
mainTabbedPane.addTab("Project", null, new IconFeedbackPanel(this.validationModel, getProjectSettingsPanel()), null);
mainTabbedPane.addTab("Model", null, new IconFeedbackPanel(this.validationModel, getModelSettingsPanel()), null);
mainTabbedPane.addTab("Code Gen", null, new IconFeedbackPanel(this.validationModel, getCodeGenSettingsPanel()), null);
mainTabbedPane.addTab("DB", null, new IconFeedbackPanel(this.validationModel, getDbConnectionSettingsPanel()), null);
mainTabbedPane.addTab("Writable API", null, new IconFeedbackPanel(this.validationModel, getWritableApiSettingsPanel()), null);
mainTabbedPane.addTab("Logging", null, new IconFeedbackPanel(this.validationModel, getClmSettingsPanel()), null);
mainTabbedPane.addTab("Security", null, new IconFeedbackPanel(this.validationModel, getSecuritySettingsPanel()), null);
mainTabbedPane.addTab("CSM DB", null, new IconFeedbackPanel(this.validationModel, getCsmDbConnectionSettingsPanel()), null);
mainTabbedPane.addTab("caGrid Auth", null, new IconFeedbackPanel(this.validationModel, getCaGridAuthSettingsPanel()), null);
mainTabbedPane.addTab("App Server", null, new IconFeedbackPanel(this.validationModel, getAppServerSettingsPanel()), null);
mainTabbedPane.addTab("Advanced", null, new IconFeedbackPanel(this.validationModel, getAdvancedSettingsPanel()), null);
}
return mainTabbedPane;
}
/**
* This method initializes securitySettingsSubPanel
*
* @return javax.swing.JPanel
*/
private JPanel getSecuritySettingsSubPanel() {
if (securitySettingsSubPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 3;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
// GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
// gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints50.gridy = 5;
// gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints50.gridx = 0;
//
// GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
// gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints51.gridy = 5;
// gridBagConstraints51.weightx = 1.0;
// gridBagConstraints51.gridwidth = 2;
// gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints51.weighty = 1.0D;
// gridBagConstraints51.gridx = 1;
// enableSecurityLabel = new JLabel();
// enableSecurityLabel.setText("Enable Security Extension?");
enableInstanceLevelSecurityLabel = new JLabel();
enableInstanceLevelSecurityLabel.setText("Enable Instance Level Security?");
enableAttributeLevelSecurityLabel = new JLabel();
enableAttributeLevelSecurityLabel.setText("Enable Attribute Level Security?");
csmProjectNameLabel = new JLabel();
csmProjectNameLabel.setText("Enter CSM Project Name:");
cacheProtectionElementsLabel = new JLabel();
cacheProtectionElementsLabel.setText("Cache Protection Elements?");
securitySettingsSubPanel = new JPanel();
securitySettingsSubPanel.setLayout(new GridBagLayout());
securitySettingsSubPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Security Options",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
// securitySettingsSubPanel.add(enableSecurityLabel, gridBagConstraints10);
// securitySettingsSubPanel.add(getEnableSecurityCheckBox(), gridBagConstraints11);
securitySettingsSubPanel.add(enableInstanceLevelSecurityLabel, gridBagConstraints10);
securitySettingsSubPanel.add(getEnableInstanceLevelSecurityCheckBox(), gridBagConstraints11);
securitySettingsSubPanel.add(enableAttributeLevelSecurityLabel, gridBagConstraints20);
securitySettingsSubPanel.add(getEnableAttributeLevelSecurityCheckBox(), gridBagConstraints21);
securitySettingsSubPanel.add(csmProjectNameLabel, gridBagConstraints30);
securitySettingsSubPanel.add(getCsmProjectNameField(), gridBagConstraints31);
securitySettingsSubPanel.add(cacheProtectionElementsLabel, gridBagConstraints40);
securitySettingsSubPanel.add(getCacheProtectionElementsCheckBox(), gridBagConstraints41);
securitySettingsSubPanel.validate();
}
return securitySettingsSubPanel;
}
/**
* This method initializes securitySettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getSecuritySettingsPanel() {
if (securitySettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.gridx = 0;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridwidth = 3;
gridBagConstraints20.weighty = 1.0D;
gridBagConstraints20.weightx = 1.0D;
enableSecurityLabel = new JLabel();
enableSecurityLabel.setText("Enable Security Extension?");
securitySettingsPanel = new JPanel();
securitySettingsPanel.setLayout(new GridBagLayout());
securitySettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Security Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
securitySettingsPanel.add(enableSecurityLabel, gridBagConstraints10);
securitySettingsPanel.add(getEnableSecurityCheckBox(), gridBagConstraints11);
securitySettingsPanel.add(getSecuritySettingsSubPanel(), gridBagConstraints20);
securitySettingsPanel.validate();
}
return securitySettingsPanel;
}
/**
* This method initializes writableApiSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getWritableApiSettingsPanel() {
if (writableApiSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.gridx = 0;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridwidth = 3;
gridBagConstraints20.weighty = 1.0D;
gridBagConstraints20.weightx = 1.0D;
enableWritableApiExtensionLabel = new JLabel();
enableWritableApiExtensionLabel.setText("Enable Writable API Extension?");
writableApiSettingsPanel = new JPanel();
writableApiSettingsPanel.setLayout(new GridBagLayout());
writableApiSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Writable API Module Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
writableApiSettingsPanel.add(enableWritableApiExtensionLabel, gridBagConstraints10);
writableApiSettingsPanel.add(getEnableWritableApiExtensionCheckBox(), gridBagConstraints11);
writableApiSettingsPanel.add(getWritableApiSettingsSubPanel(), gridBagConstraints20);
writableApiSettingsPanel.validate();
}
return writableApiSettingsPanel;
}
/**
* This method initializes writableApiSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getWritableApiSettingsSubPanel() {
if (writableApiSettingsSubPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 3;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
databaseTypeLabel = new JLabel();
databaseTypeLabel.setText("Enter Database Type:");
identityGeneratorTagLabel = new JLabel();
identityGeneratorTagLabel.setText("Enter Hibernate Identity Generator Tag:");
caDsrConnectionUrlLabel = new JLabel();
caDsrConnectionUrlLabel.setText("Enter caDSR Connection URL:");
writableApiSettingsSubPanel = new JPanel();
writableApiSettingsSubPanel.setLayout(new GridBagLayout());
writableApiSettingsSubPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Writable API Options",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
writableApiSettingsSubPanel.add(databaseTypeLabel, gridBagConstraints10);
writableApiSettingsSubPanel.add(getDatabaseTypeField(), gridBagConstraints11);
writableApiSettingsSubPanel.add(identityGeneratorTagLabel, gridBagConstraints20);
writableApiSettingsSubPanel.add(getIdentityGeneratorTagField(), gridBagConstraints21);
writableApiSettingsSubPanel.add(caDsrConnectionUrlLabel, gridBagConstraints30);
writableApiSettingsSubPanel.add(getCaDsrConnectionUrlField(), gridBagConstraints31);
writableApiSettingsSubPanel.validate();
}
return writableApiSettingsSubPanel;
}
/**
* This method initializes writableApiSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getClmSettingsPanel() {
if (clmSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
// gridBagConstraints11.weighty = 1.0D; // so that the CLM sub panel has priority
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.gridx = 0;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridwidth = 3;
// gridBagConstraints20.weighty = 1.0D;
gridBagConstraints20.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 2;
gridBagConstraints30.gridx = 0;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridwidth = 3;
gridBagConstraints30.weighty = 1.0D;
gridBagConstraints30.weightx = 1.0D;
enableCommonLoggingModuleLabel = new JLabel();
enableCommonLoggingModuleLabel.setText("Enable Logging?");
clmSettingsPanel = new JPanel();
clmSettingsPanel.setLayout(new GridBagLayout());
clmSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Logging Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
clmSettingsPanel.add(enableCommonLoggingModuleLabel, gridBagConstraints10);
clmSettingsPanel.add(getEnableCommonLoggingModuleCheckBox(), gridBagConstraints11);
clmSettingsPanel.add(getLoggingSettingsSubPanel(), gridBagConstraints20);
clmSettingsPanel.validate();
}
return clmSettingsPanel;
}
/**
* This method initializes clmSettingsSubPanel
*
* @return javax.swing.JPanel
*/
private JPanel getLoggingSettingsSubPanel() {
if (clmSettingsSubPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 5;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.gridy = 5;
gridBagConstraints11.weightx = 1.0;
gridBagConstraints11.gridwidth = 2;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.gridx = 1;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 6;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.gridy = 6;
gridBagConstraints21.weightx = 1.0;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.gridx = 1;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 7;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 7;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 8;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 8;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints50.gridy = 9;
gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints50.gridx = 0;
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints51.gridy = 9;
gridBagConstraints51.weightx = 1.0;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.weighty = 1.0D;
gridBagConstraints51.gridx = 1;
GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints60.gridy = 10;
gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints60.gridx = 0;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints61.gridy = 10;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints61.gridwidth = 2;
gridBagConstraints61.weighty = 1.0D;
gridBagConstraints61.gridx = 1;
clmProjectNameLabel = new JLabel();
clmProjectNameLabel.setText("Enter Logging Project Name:");
clmDbConnectionUrlLabel = new JLabel();
clmDbConnectionUrlLabel.setText("Enter Logging Database Connection URL:");
clmDbUsernameLabel = new JLabel();
clmDbUsernameLabel.setText("Enter Logging Database Username:");
clmDbPasswordLabel = new JLabel();
clmDbPasswordLabel.setText("Enter Logging Database Password:");
clmDbDriverLabel = new JLabel();
clmDbDriverLabel.setText("Enter Logging Database Driver:");
clmSettingsSubPanel = new JPanel();
clmSettingsSubPanel.setLayout(new GridBagLayout());
clmSettingsSubPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Logging Database Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
clmSettingsSubPanel.add(clmProjectNameLabel, gridBagConstraints10);
clmSettingsSubPanel.add(getClmProjectName(), gridBagConstraints11);
clmSettingsSubPanel.add(clmDbConnectionUrlLabel, gridBagConstraints20);
clmSettingsSubPanel.add(getClmDbConnectionUrlField(), gridBagConstraints21);
clmSettingsSubPanel.add(clmDbUsernameLabel, gridBagConstraints30);
clmSettingsSubPanel.add(getClmDbUsernameField(), gridBagConstraints31);
clmSettingsSubPanel.add(clmDbPasswordLabel, gridBagConstraints40);
clmSettingsSubPanel.add(getClmDbPasswordField(), gridBagConstraints41);
clmSettingsSubPanel.add(clmDbDriverLabel, gridBagConstraints50);
clmSettingsSubPanel.add(getClmDbDriverField(), gridBagConstraints51);
clmSettingsSubPanel.validate();
}
return clmSettingsSubPanel;
}
/**
* This method initializes the Project Settings jPanel
*/
private JPanel getProjectSettingsPanel() {
if (projectSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0;
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints12.gridy = 1;
gridBagConstraints12.gridx = 2;
gridBagConstraints12.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints12.gridwidth = 1;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 3;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
sdkInstallDirLabel = new JLabel();
sdkInstallDirLabel.setText("Select your existing SDK Home directory:");
sdkInstallDirLabel.setName("SDK Directory");
projectNameLabel = new JLabel();
projectNameLabel.setText("Enter the Project Name:");
namespacePrefixLabel = new JLabel();
namespacePrefixLabel.setText("Enter the Project Namespace Prefix:");
webserviceNameLabel = new JLabel();
webserviceNameLabel.setText("Enter the Project Web Service Name:");
projectSettingsPanel = new JPanel();
projectSettingsPanel.setLayout(new GridBagLayout());
projectSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Project Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
projectSettingsPanel.add(sdkInstallDirLabel, gridBagConstraints10);
projectSettingsPanel.add(getSdkInstallDirField(), gridBagConstraints11);
projectSettingsPanel.add(getSdkInstallDirButton(), gridBagConstraints12);
projectSettingsPanel.add(projectNameLabel, gridBagConstraints20);
projectSettingsPanel.add(getProjectNameField(), gridBagConstraints21);
projectSettingsPanel.add(namespacePrefixLabel, gridBagConstraints30);
projectSettingsPanel.add(getNamespacePrefixField(), gridBagConstraints31);
projectSettingsPanel.add(webserviceNameLabel, gridBagConstraints40);
projectSettingsPanel.add(getWebServiceNameField(), gridBagConstraints41);
projectSettingsPanel.validate();
}
return projectSettingsPanel;
}
/**
* This method initializes modelSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getModelSettingsPanel() {
if (modelSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0;
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints12.gridy = 1;
gridBagConstraints12.gridx = 2;
gridBagConstraints12.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints12.gridwidth = 1;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 1;
gridBagConstraints21.weightx = 0.3D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 3;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints50.gridy = 5;
gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints50.gridx = 0;
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints51.gridy = 5;
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.weightx = 1.0D;
gridBagConstraints51.weighty = 1.0D;
gridBagConstraints51.gridx = 1;
GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints60.gridy = 6;
gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints60.gridx = 0;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints61.gridy = 6;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints61.gridwidth = 2;
gridBagConstraints61.weighty = 1.0D;
gridBagConstraints61.gridx = 1;
GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
gridBagConstraints70.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints70.gridy = 7;
gridBagConstraints70.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints70.gridx = 0;
GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
gridBagConstraints71.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints71.gridy = 7;
gridBagConstraints71.weightx = 1.0;
gridBagConstraints71.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints71.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints71.gridwidth = 2;
gridBagConstraints71.weighty = 1.0D;
gridBagConstraints71.gridx = 1;
GridBagConstraints gridBagConstraints80 = new GridBagConstraints();
gridBagConstraints80.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints80.gridy = 8;
gridBagConstraints80.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints80.gridx = 0;
GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
gridBagConstraints81.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints81.gridy = 8;
gridBagConstraints81.weightx = 1.0;
gridBagConstraints81.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints81.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints81.gridwidth = 2;
gridBagConstraints81.weighty = 1.0D;
gridBagConstraints81.gridx = 1;
modelFileLabel = new JLabel();
modelFileLabel.setText("Enter the Model file name:");
modelFileTypeLabel = new JLabel();
modelFileTypeLabel.setText("Enter the Model file type:");
logicalModelLabel = new JLabel();
logicalModelLabel.setText("Enter the 'Logical Model' package name:");
dataModelLabel = new JLabel();
dataModelLabel.setText("Enter the 'Data Model' package name:");
includePackageLabel = new JLabel();
includePackageLabel.setText("Enter the 'Include Package' regex:");
excludePackageLabel = new JLabel();
excludePackageLabel.setText("Enter the 'Exclude Package' regex:");
excludeNameLabel = new JLabel();
excludeNameLabel.setText("Enter the 'Exclude Class Name' regex:");
excludeNamespaceLabel = new JLabel();
excludeNamespaceLabel.setText("Enter the 'Exclude Namespace' regex:");
modelSettingsPanel = new JPanel();
modelSettingsPanel.setLayout(new GridBagLayout());
modelSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Model Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
modelSettingsPanel.add(modelFileLabel, gridBagConstraints10);
modelSettingsPanel.add(getModelFileField(), gridBagConstraints11);
modelSettingsPanel.add(getModelFilePathButton(), gridBagConstraints12);
modelSettingsPanel.add(modelFileTypeLabel, gridBagConstraints20);
modelSettingsPanel.add(getModelFileTypeField(), gridBagConstraints21);
modelSettingsPanel.add(logicalModelLabel, gridBagConstraints30);
modelSettingsPanel.add(getLogicalModelField(), gridBagConstraints31);
modelSettingsPanel.add(dataModelLabel, gridBagConstraints40);
modelSettingsPanel.add(getDataModelField(), gridBagConstraints41);
modelSettingsPanel.add(includePackageLabel, gridBagConstraints50);
modelSettingsPanel.add(getIncludePackageField(), gridBagConstraints51);
modelSettingsPanel.add(excludePackageLabel, gridBagConstraints60);
modelSettingsPanel.add(getExcludePackageField(), gridBagConstraints61);
modelSettingsPanel.add(excludeNameLabel, gridBagConstraints70);
modelSettingsPanel.add(getExcludeNameField(), gridBagConstraints71);
modelSettingsPanel.add(excludeNamespaceLabel, gridBagConstraints80);
modelSettingsPanel.add(getExcludeNamespaceField(), gridBagConstraints81);
modelSettingsPanel.validate();
}
return modelSettingsPanel;
}
/**
* This method initializes loggingSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getCodeGenSettingsPanel() {
if (codeGenSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 3;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints50.gridy = 5;
gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints50.gridx = 0;
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints51.gridy = 5;
gridBagConstraints51.weightx = 1.0;
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.weighty = 1.0D;
gridBagConstraints51.gridx = 1;
GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints60.gridy = 6;
gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints60.gridx = 0;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints61.gridy = 6;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints61.gridwidth = 2;
gridBagConstraints61.weighty = 1.0D;
gridBagConstraints61.gridx = 1;
GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
gridBagConstraints70.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints70.gridy = 7;
gridBagConstraints70.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints70.gridx = 0;
GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
gridBagConstraints71.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints71.gridy = 7;
gridBagConstraints71.weightx = 1.0;
gridBagConstraints71.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints71.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints71.gridwidth = 2;
gridBagConstraints71.weighty = 1.0D;
gridBagConstraints71.gridx = 1;
GridBagConstraints gridBagConstraints80 = new GridBagConstraints();
gridBagConstraints80.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints80.gridy = 8;
gridBagConstraints80.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints80.gridx = 0;
GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
gridBagConstraints81.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints81.gridy = 8;
gridBagConstraints81.weightx = 1.0;
gridBagConstraints81.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints81.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints81.gridwidth = 2;
gridBagConstraints81.weighty = 1.0D;
gridBagConstraints81.gridx = 1;
GridBagConstraints gridBagConstraints90 = new GridBagConstraints();
gridBagConstraints90.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints90.gridy = 9;
gridBagConstraints90.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints90.gridx = 0;
GridBagConstraints gridBagConstraints91 = new GridBagConstraints();
gridBagConstraints91.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints91.gridy = 9;
gridBagConstraints91.weightx = 1.0;
gridBagConstraints91.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints91.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints91.gridwidth = 2;
gridBagConstraints91.weighty = 1.0D;
gridBagConstraints91.gridx = 1;
GridBagConstraints gridBagConstraints100 = new GridBagConstraints();
gridBagConstraints100.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints100.gridy = 10;
gridBagConstraints100.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints100.gridx = 0;
GridBagConstraints gridBagConstraints101 = new GridBagConstraints();
gridBagConstraints101.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints101.gridy = 10;
gridBagConstraints101.weightx = 1.0;
gridBagConstraints101.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints101.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints101.gridwidth = 2;
gridBagConstraints101.weighty = 1.0D;
gridBagConstraints101.gridx = 1;
GridBagConstraints gridBagConstraints110 = new GridBagConstraints();
gridBagConstraints110.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints110.gridy = 11;
gridBagConstraints110.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints110.gridx = 0;
GridBagConstraints gridBagConstraints111 = new GridBagConstraints();
gridBagConstraints111.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints111.gridy = 11;
gridBagConstraints111.weightx = 1.0;
gridBagConstraints111.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints111.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints111.gridwidth = 2;
gridBagConstraints111.weighty = 1.0D;
gridBagConstraints111.gridx = 1;
validateLogicalModelLabel = new JLabel();
validateLogicalModelLabel.setText("Validate Logical Model?");
validateModelMappingLabel = new JLabel();
validateModelMappingLabel.setText("Validate Model Mapping?");
validateGmeTagsLabel = new JLabel();
validateGmeTagsLabel.setText("Validate GME Tags?");
generateBeansLabel = new JLabel();
generateBeansLabel.setText("Generate domain Java Beans?");
generateHibernateMappingLabel = new JLabel();
generateHibernateMappingLabel.setText("Generate Hibernate Mapping Files?");
generateCastorMappingLabel = new JLabel();
generateCastorMappingLabel.setText("Generate Castor Mapping files?");
generateXsdLabel = new JLabel();
generateXsdLabel.setText("Generate XSD's?");
generateXsdWithGmeTagsLabel = new JLabel();
generateXsdWithGmeTagsLabel.setText("Generate XSD's with GME tags?");
generateXsdWithPermissibleValuesLabel = new JLabel();
generateXsdWithPermissibleValuesLabel.setText("Generate XSD's with Permissible Values?");
generateWsddLabel = new JLabel();
generateWsddLabel.setText("Generate WSDD?");
generateHibernateValidatorLabel = new JLabel();
generateHibernateValidatorLabel.setText("Generate Hibernate Validator?");
codeGenSettingsPanel = new JPanel();
codeGenSettingsPanel.setLayout(new GridBagLayout());
codeGenSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Code Generation Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
codeGenSettingsPanel.add(validateLogicalModelLabel, gridBagConstraints10);
codeGenSettingsPanel.add(getValidateLogicalModelCheckBox(), gridBagConstraints11);
codeGenSettingsPanel.add(validateModelMappingLabel, gridBagConstraints20);
codeGenSettingsPanel.add(getValidateModelMappingCheckBox(), gridBagConstraints21);
codeGenSettingsPanel.add(validateGmeTagsLabel, gridBagConstraints30);
codeGenSettingsPanel.add(getValidateGmeTagsCheckBox(), gridBagConstraints31);
codeGenSettingsPanel.add(generateBeansLabel, gridBagConstraints40);
codeGenSettingsPanel.add(getGenerateBeansCheckBox(), gridBagConstraints41);
codeGenSettingsPanel.add(generateHibernateMappingLabel, gridBagConstraints50);
codeGenSettingsPanel.add(getGenerateHibernateMappingCheckBox(), gridBagConstraints51);
codeGenSettingsPanel.add(generateCastorMappingLabel, gridBagConstraints60);
codeGenSettingsPanel.add(getGenerateCastorMappingCheckBox(), gridBagConstraints61);
codeGenSettingsPanel.add(generateXsdLabel, gridBagConstraints70);
codeGenSettingsPanel.add(getGenerateXsdCheckBox(), gridBagConstraints71);
codeGenSettingsPanel.add(generateXsdWithGmeTagsLabel, gridBagConstraints80);
codeGenSettingsPanel.add(generateXsdWithGmeTagsCheckBox(), gridBagConstraints81);
codeGenSettingsPanel.add(generateXsdWithPermissibleValuesLabel, gridBagConstraints90);
codeGenSettingsPanel.add(getGenerateXsdWithPermissibleValuesCheckBox(), gridBagConstraints91);
codeGenSettingsPanel.add(generateWsddLabel, gridBagConstraints100);
codeGenSettingsPanel.add(getGenerateWsddLabelCheckBox(), gridBagConstraints101);
codeGenSettingsPanel.add(generateHibernateValidatorLabel, gridBagConstraints110);
codeGenSettingsPanel.add(getGenerateHibernateValidatorCheckBox(), gridBagConstraints111);
codeGenSettingsPanel.validate();
}
return codeGenSettingsPanel;
}
/**
* This method initializes dbConnectionSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getDbConnectionSettingsPanel() {
if (dbConnectionSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
gridBagConstraints30.gridwidth = 3;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints50.gridy = 5;
gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints50.gridx = 0;
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints51.gridy = 5;
gridBagConstraints51.weightx = 1.0;
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.weighty = 1.0D;
gridBagConstraints51.gridx = 1;
GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints60.gridy = 6;
gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints60.gridx = 0;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints61.gridy = 6;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints61.gridwidth = 2;
gridBagConstraints61.weighty = 1.0D;
gridBagConstraints61.gridx = 1;
GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
gridBagConstraints70.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints70.gridy = 7;
gridBagConstraints70.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints70.gridx = 0;
GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
gridBagConstraints71.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints71.gridy = 7;
gridBagConstraints71.weightx = 1.0;
gridBagConstraints71.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints71.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints71.gridwidth = 2;
gridBagConstraints71.weighty = 1.0D;
gridBagConstraints71.gridx = 1;
GridBagConstraints gridBagConstraints80 = new GridBagConstraints();
gridBagConstraints80.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints80.gridy = 8;
gridBagConstraints80.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints80.gridx = 0;
GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
gridBagConstraints81.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints81.gridy = 8;
gridBagConstraints81.weightx = 1.0;
gridBagConstraints81.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints81.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints81.gridwidth = 2;
gridBagConstraints81.weighty = 1.0D;
gridBagConstraints81.gridx = 1;
useJndiBasedConnectionLabel = new JLabel();
useJndiBasedConnectionLabel.setText("Use a JNDI-based Database Connection?");
dbJndiUrlLabel = new JLabel();
dbJndiUrlLabel.setText("Database JNDI URL:");
dbConnectionUrlLabel = new JLabel();
dbConnectionUrlLabel.setText("Database connection URL:");
dbUsernameLabel = new JLabel();
dbUsernameLabel.setText("Database username:");
dbPasswordLabel = new JLabel();
dbPasswordLabel.setText("Database password:");
dbDriverLabel = new JLabel();
dbDriverLabel.setText("Database driver:");
dbDialectLabel = new JLabel();
dbDialectLabel.setText("Database dialect");
dbConnectionSettingsPanel = new JPanel();
dbConnectionSettingsPanel.setLayout(new GridBagLayout());
dbConnectionSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Database Connection Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
dbConnectionSettingsPanel.add(useJndiBasedConnectionLabel, gridBagConstraints10);
dbConnectionSettingsPanel.add(getUseJndiBasedConnectionCheckBox(), gridBagConstraints11);
dbConnectionSettingsPanel.add(dbJndiUrlLabel, gridBagConstraints20);
dbConnectionSettingsPanel.add(getDbJndiUrlField(), gridBagConstraints21);
dbConnectionSettingsPanel.add(new JLabel(blankLine), gridBagConstraints30);//blank spacer line
dbConnectionSettingsPanel.add(dbConnectionUrlLabel, gridBagConstraints40);
dbConnectionSettingsPanel.add(getDbConnectionUrlField(), gridBagConstraints41);
dbConnectionSettingsPanel.add(dbUsernameLabel, gridBagConstraints50);
dbConnectionSettingsPanel.add(getDbUsernameField(), gridBagConstraints51);
dbConnectionSettingsPanel.add(dbPasswordLabel, gridBagConstraints60);
dbConnectionSettingsPanel.add(getDbPasswordField(), gridBagConstraints61);
dbConnectionSettingsPanel.add(dbDriverLabel, gridBagConstraints70);
dbConnectionSettingsPanel.add(getDbDriverField(), gridBagConstraints71);
dbConnectionSettingsPanel.add(dbDialectLabel, gridBagConstraints80);
dbConnectionSettingsPanel.add(getDbDialectField(), gridBagConstraints81);
dbConnectionSettingsPanel.validate();
}
return dbConnectionSettingsPanel;
}
/**
* This method initializes csmDbConnectionSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getCsmDbConnectionSettingsPanel() {
if (csmDbConnectionSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
gridBagConstraints30.gridwidth = 3;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints50.gridy = 5;
gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints50.gridx = 0;
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints51.gridy = 5;
gridBagConstraints51.weightx = 1.0;
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.weighty = 1.0D;
gridBagConstraints51.gridx = 1;
GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints60.gridy = 6;
gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints60.gridx = 0;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints61.gridy = 6;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints61.gridwidth = 2;
gridBagConstraints61.weighty = 1.0D;
gridBagConstraints61.gridx = 1;
GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
gridBagConstraints70.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints70.gridy = 7;
gridBagConstraints70.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints70.gridx = 0;
GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
gridBagConstraints71.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints71.gridy = 7;
gridBagConstraints71.weightx = 1.0;
gridBagConstraints71.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints71.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints71.gridwidth = 2;
gridBagConstraints71.weighty = 1.0D;
gridBagConstraints71.gridx = 1;
GridBagConstraints gridBagConstraints80 = new GridBagConstraints();
gridBagConstraints80.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints80.gridy = 8;
gridBagConstraints80.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints80.gridx = 0;
GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
gridBagConstraints81.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints81.gridy = 8;
gridBagConstraints81.weightx = 1.0;
gridBagConstraints81.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints81.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints81.gridwidth = 2;
gridBagConstraints81.weighty = 1.0D;
gridBagConstraints81.gridx = 1;
csmUseJndiBasedConnectionLabel = new JLabel();
csmUseJndiBasedConnectionLabel.setText("Use a JNDI-based CSM Database Connection?");
csmDbJndiUrlLabel = new JLabel();
csmDbJndiUrlLabel.setText("Enter CSM Database JNDI URL:");
csmDbConnectionUrlLabel = new JLabel();
csmDbConnectionUrlLabel.setText("Enter CSM Database connection URL:");
csmDbUsernameLabel = new JLabel();
csmDbUsernameLabel.setText("Enter CSM Database username:");
csmDbPasswordLabel = new JLabel();
csmDbPasswordLabel.setText("Enter CSM Database password:");
csmDbDriverLabel = new JLabel();
csmDbDriverLabel.setText("Enter CSM Database driver:");
csmDbDialectLabel = new JLabel();
csmDbDialectLabel.setText("Enter CSM Database dialect");
csmDbConnectionSettingsPanel = new JPanel();
csmDbConnectionSettingsPanel.setLayout(new GridBagLayout());
csmDbConnectionSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Common Security Module (CSM) Database Connection Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
csmDbConnectionSettingsPanel.add(csmUseJndiBasedConnectionLabel, gridBagConstraints10);
csmDbConnectionSettingsPanel.add(getCsmUseJndiBasedConnectionCheckBox(), gridBagConstraints11);
csmDbConnectionSettingsPanel.add(csmDbJndiUrlLabel, gridBagConstraints20);
csmDbConnectionSettingsPanel.add(getCsmDbJndiUrlField(), gridBagConstraints21);
csmDbConnectionSettingsPanel.add(new JLabel(blankLine), gridBagConstraints30);//blank spacer line
csmDbConnectionSettingsPanel.add(csmDbConnectionUrlLabel, gridBagConstraints40);
csmDbConnectionSettingsPanel.add(getCsmDbConnectionUrlField(), gridBagConstraints41);
csmDbConnectionSettingsPanel.add(csmDbUsernameLabel, gridBagConstraints50);
csmDbConnectionSettingsPanel.add(getCsmDbUsernameField(), gridBagConstraints51);
csmDbConnectionSettingsPanel.add(csmDbPasswordLabel, gridBagConstraints60);
csmDbConnectionSettingsPanel.add(getCsmDbPasswordField(), gridBagConstraints61);
csmDbConnectionSettingsPanel.add(csmDbDriverLabel, gridBagConstraints70);
csmDbConnectionSettingsPanel.add(getCsmDbDriverField(), gridBagConstraints71);
csmDbConnectionSettingsPanel.add(csmDbDialectLabel, gridBagConstraints80);
csmDbConnectionSettingsPanel.add(getCsmDbDialectField(), gridBagConstraints81);
csmDbConnectionSettingsPanel.validate();
}
return csmDbConnectionSettingsPanel;
}
// /**
// * This method initializes loggingSettingsPanel
// *
// * @return javax.swing.JPanel
// */
// private JPanel getClmSettingsPanel() {
// if (loggingSettingsPanel == null) {
// GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
// gridBagConstraints23.gridx = 0;
// gridBagConstraints23.fill = GridBagConstraints.BOTH;
// gridBagConstraints23.gridy = 0;
// GridBagConstraints gridBagConstraints = new GridBagConstraints();
// gridBagConstraints.gridx = 1;
// gridBagConstraints.fill = GridBagConstraints.BOTH;
// gridBagConstraints.weightx = 1.0D;
// gridBagConstraints.weighty = 1.0D;
// gridBagConstraints.gridy = 0;
// loggingSettingsPanel = new JPanel();
// loggingSettingsPanel.setLayout(new GridBagLayout());
// loggingSettingsPanel.add(getServiceStylePanel(), gridBagConstraints);
// loggingSettingsPanel.add(getResourceOptionsConfigPanel(), gridBagConstraints23);
// }
// return loggingSettingsPanel;
// }
/**
* This method initializes loggingSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getCaGridAuthSettingsPanel() {
if (caGridAuthSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints30.gridy = 3;
gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints30.gridx = 0;
GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints31.gridy = 3;
gridBagConstraints31.weightx = 1.0;
gridBagConstraints31.gridwidth = 2;
gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints31.weighty = 1.0D;
gridBagConstraints31.gridx = 1;
GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints40.gridy = 4;
gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints40.gridx = 0;
GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints41.gridy = 4;
gridBagConstraints41.weightx = 1.0;
gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints41.gridwidth = 2;
gridBagConstraints41.weighty = 1.0D;
gridBagConstraints41.gridx = 1;
GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints50.gridy = 5;
gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints50.gridx = 0;
GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints51.gridy = 5;
gridBagConstraints51.weightx = 1.0;
gridBagConstraints51.gridwidth = 2;
gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints51.weighty = 1.0D;
gridBagConstraints51.gridx = 1;
GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints60.gridy = 6;
gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints60.gridx = 0;
GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints61.gridy = 6;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints61.gridwidth = 2;
gridBagConstraints61.weighty = 1.0D;
gridBagConstraints61.gridx = 1;
GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
gridBagConstraints70.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints70.gridy = 7;
gridBagConstraints70.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints70.gridx = 0;
GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
gridBagConstraints71.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints71.gridy = 7;
gridBagConstraints71.weightx = 1.0;
gridBagConstraints71.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints71.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints71.gridwidth = 2;
gridBagConstraints71.weighty = 1.0D;
gridBagConstraints71.gridx = 1;
GridBagConstraints gridBagConstraints80 = new GridBagConstraints();
gridBagConstraints80.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints80.gridy = 8;
gridBagConstraints80.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints80.gridx = 0;
GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
gridBagConstraints81.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints81.gridy = 8;
gridBagConstraints81.weightx = 1.0;
gridBagConstraints81.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints81.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints81.gridwidth = 2;
gridBagConstraints81.weighty = 1.0D;
gridBagConstraints81.gridx = 1;
enableCaGridLoginModuleLabel = new JLabel();
enableCaGridLoginModuleLabel.setText("Enable caGrid Login Module?");
caGridLoginModuleNameLabel = new JLabel();
caGridLoginModuleNameLabel.setText("Enter caGrid Login Module Name:");
caGridAuthSvcUrlLabel = new JLabel();
caGridAuthSvcUrlLabel.setText("Enter caGrid Authentication Service URL:");
caGridDorianSvcUrlLabel = new JLabel();
caGridDorianSvcUrlLabel.setText("Enter caGrid Dorian Service URL:");
enableCsmLoginModuleLabel = new JLabel();
enableCsmLoginModuleLabel.setText("Enable CSM Login Module?");
sdkGridLoginSvcNameLabel = new JLabel();
sdkGridLoginSvcNameLabel.setText("Enter SDK Grid Login Service Name:");
sdkGridLoginSvcUrlLabel = new JLabel();
sdkGridLoginSvcUrlLabel.setText("Enter SDK Grid Login Service URL:");
caGridAuthSettingsPanel = new JPanel();
caGridAuthSettingsPanel.setLayout(new GridBagLayout());
caGridAuthSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define caGrid Authentication Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
caGridAuthSettingsPanel.add(enableCaGridLoginModuleLabel, gridBagConstraints10);
caGridAuthSettingsPanel.add(getEnableCaGridLoginModuleCheckBox(), gridBagConstraints11);
caGridAuthSettingsPanel.add(caGridLoginModuleNameLabel, gridBagConstraints20);
caGridAuthSettingsPanel.add(getCaGridLoginModuleNameField(), gridBagConstraints21);
caGridAuthSettingsPanel.add(caGridAuthSvcUrlLabel, gridBagConstraints30);
caGridAuthSettingsPanel.add(getCaGridAuthSvcUrlField(), gridBagConstraints31);
caGridAuthSettingsPanel.add(caGridDorianSvcUrlLabel, gridBagConstraints40);
caGridAuthSettingsPanel.add(getCaGridDorianSvcUrlField(), gridBagConstraints41);
caGridAuthSettingsPanel.add(new JLabel(blankLine), gridBagConstraints50);//blank spacer line
caGridAuthSettingsPanel.add(enableCsmLoginModuleLabel, gridBagConstraints60);
caGridAuthSettingsPanel.add(getEnableCsmLoginModuleCheckBox(), gridBagConstraints61);
caGridAuthSettingsPanel.add(sdkGridLoginSvcNameLabel, gridBagConstraints70);
caGridAuthSettingsPanel.add(getSdkGridLoginSvcNameField(), gridBagConstraints71);
caGridAuthSettingsPanel.add(sdkGridLoginSvcUrlLabel, gridBagConstraints80);
caGridAuthSettingsPanel.add(getSdkGridLoginSvcUrlField(), gridBagConstraints81);
caGridAuthSettingsPanel.validate();
}
return caGridAuthSettingsPanel;
}
/**
* This method initializes appServerSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getAppServerSettingsPanel() {
if (appServerSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints20.gridy = 2;
gridBagConstraints20.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints20.gridx = 0;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints21.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints21.gridy = 2;
gridBagConstraints21.gridx = 1;
gridBagConstraints21.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints21.gridwidth = 2;
gridBagConstraints21.weighty = 1.0D;
gridBagConstraints21.weightx = 1.0D;
// GridBagConstraints gridBagConstraints30 = new GridBagConstraints();
// gridBagConstraints30.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints30.gridy = 3;
// gridBagConstraints30.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints30.gridx = 0;
//
// GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
// gridBagConstraints31.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints31.gridy = 3;
// gridBagConstraints31.weightx = 1.0;
// gridBagConstraints31.gridwidth = 2;
// gridBagConstraints31.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints31.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints31.weighty = 1.0D;
// gridBagConstraints31.gridx = 1;
//
// GridBagConstraints gridBagConstraints40 = new GridBagConstraints();
// gridBagConstraints40.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints40.gridy = 4;
// gridBagConstraints40.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints40.gridx = 0;
//
// GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
// gridBagConstraints41.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints41.gridy = 4;
// gridBagConstraints41.weightx = 1.0;
// gridBagConstraints41.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints41.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints41.gridwidth = 2;
// gridBagConstraints41.weighty = 1.0D;
// gridBagConstraints41.gridx = 1;
//
// GridBagConstraints gridBagConstraints50 = new GridBagConstraints();
// gridBagConstraints50.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints50.gridy = 5;
// gridBagConstraints50.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints50.gridx = 0;
//
// GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
// gridBagConstraints51.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints51.gridy = 5;
// gridBagConstraints51.weightx = 1.0;
// gridBagConstraints51.gridwidth = 2;
// gridBagConstraints51.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints51.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints51.weighty = 1.0D;
// gridBagConstraints51.gridx = 1;
//
// GridBagConstraints gridBagConstraints60 = new GridBagConstraints();
// gridBagConstraints60.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints60.gridy = 6;
// gridBagConstraints60.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints60.gridx = 0;
//
// GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
// gridBagConstraints61.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints61.gridy = 6;
// gridBagConstraints61.weightx = 1.0;
// gridBagConstraints61.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints61.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints61.gridwidth = 2;
// gridBagConstraints61.weighty = 1.0D;
// gridBagConstraints61.gridx = 1;
//
// GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
// gridBagConstraints70.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints70.gridy = 7;
// gridBagConstraints70.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints70.gridx = 0;
//
// GridBagConstraints gridBagConstraints71 = new GridBagConstraints();
// gridBagConstraints71.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints71.gridy = 7;
// gridBagConstraints71.weightx = 1.0;
// gridBagConstraints71.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints71.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints71.gridwidth = 2;
// gridBagConstraints71.weighty = 1.0D;
// gridBagConstraints71.gridx = 1;
//
// GridBagConstraints gridBagConstraints80 = new GridBagConstraints();
// gridBagConstraints80.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints80.gridy = 8;
// gridBagConstraints80.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints80.gridx = 0;
//
// GridBagConstraints gridBagConstraints81 = new GridBagConstraints();
// gridBagConstraints81.fill = java.awt.GridBagConstraints.HORIZONTAL;
// gridBagConstraints81.gridy = 8;
// gridBagConstraints81.weightx = 1.0;
// gridBagConstraints81.anchor = java.awt.GridBagConstraints.WEST;
// gridBagConstraints81.insets = new java.awt.Insets(2, 2, 2, 2);
// gridBagConstraints81.gridwidth = 2;
// gridBagConstraints81.weighty = 1.0D;
// gridBagConstraints81.gridx = 1;
serverTypeLabel = new JLabel();
serverTypeLabel.setText("Select Server Type:");
serverUrlLabel = new JLabel();
serverUrlLabel.setText("Enter Server URL:");
appServerSettingsPanel = new JPanel();
appServerSettingsPanel.setLayout(new GridBagLayout());
appServerSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Application Server Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
appServerSettingsPanel.add(serverTypeLabel, gridBagConstraints10);
appServerSettingsPanel.add(getServerTypeComboBox(), gridBagConstraints11);
appServerSettingsPanel.add(serverUrlLabel, gridBagConstraints20);
appServerSettingsPanel.add(getServerUrlField(), gridBagConstraints21);
appServerSettingsPanel.validate();
}
return appServerSettingsPanel;
}
/**
* This method initializes advancedSettingsPanel
*
* @return javax.swing.JPanel
*/
private JPanel getAdvancedSettingsPanel() {
if (advancedSettingsPanel == null) {
GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
gridBagConstraints10.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints10.gridy = 1;
gridBagConstraints10.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints10.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints11.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridx = 1;
gridBagConstraints11.insets = new java.awt.Insets(2, 2, 2, 2);
gridBagConstraints11.gridy = 1;
gridBagConstraints11.weighty = 1.0D;
gridBagConstraints11.weightx = 1.0D;
gridBagConstraints11.gridwidth = 2;
cachePathLabel = new JLabel();
cachePathLabel.setText("Enter EHCache Path:");
advancedSettingsPanel = new JPanel();
advancedSettingsPanel.setLayout(new GridBagLayout());
advancedSettingsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Define Advanced Properties",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
advancedSettingsPanel.add(cachePathLabel, gridBagConstraints10);
advancedSettingsPanel.add(getCachePathField(), gridBagConstraints11);
advancedSettingsPanel.validate();
}
return advancedSettingsPanel;
}
/**
* This method initializes lifetimeResource
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getLifetimeResource() {
if (lifetimeResource == null) {
lifetimeResource = new JCheckBox();
lifetimeResource.setToolTipText("add support for the WS-Lifetime specification");
lifetimeResource.setHorizontalAlignment(SwingConstants.LEADING);
lifetimeResource.setSelected(false);
// lifetimeResource.setText(IntroduceConstants.INTRODUCE_LIFETIME_RESOURCE);
lifetimeResource.setText("LifeTimeResource Text");
lifetimeResource.setHorizontalTextPosition(SwingConstants.TRAILING);
lifetimeResource.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
checkResourcePropertyOptions();
}
});
}
return lifetimeResource;
}
/**
* This method initializes persistantResource
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getPersistantResource() {
if (persistantResource == null) {
persistantResource = new JCheckBox();
persistantResource.setToolTipText("enables resources to save state to disk and recover from disk");
persistantResource.setSelected(false);
// persistantResource.setText(IntroduceConstants.INTRODUCE_PERSISTENT_RESOURCE);
persistantResource.setText("PersistantResource Text");
persistantResource.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
checkResourcePropertyOptions();
}
});
}
return persistantResource;
}
/**
* This method initializes notificationResource
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getNotificationResource() {
if (notificationResource == null) {
notificationResource = new JCheckBox();
notificationResource.setSelected(false);
notificationResource.setToolTipText("add support for WS-Notification");
// notificationResource.setText(IntroduceConstants.INTRODUCE_NOTIFICATION_RESOURCE);
notificationResource.setText("NotificationResource Text");
notificationResource.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
checkResourcePropertyOptions();
}
});
}
return notificationResource;
}
/**
* This method initializes secureResource
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getSecureResource() {
if (secureResource == null) {
secureResource = new JCheckBox();
secureResource.setSelected(false);
secureResource.setToolTipText("enables security to be added to this resource type");
// secureResource.setText(IntroduceConstants.INTRODUCE_SECURE_RESOURCE);
secureResource.setText("SecureResource");
secureResource.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
checkResourcePropertyOptions();
}
});
}
return secureResource;
}
/**
* This method initializes resourceProperty
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getResourceProperty() {
if (resourceProperty == null) {
resourceProperty = new JCheckBox();
resourceProperty.setSelected(true);
resourceProperty.setToolTipText("enables access/query/set operations for the resource properties");
resourceProperty.setText("resource property access");
resourceProperty.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
checkResourcePropertyOptions();
}
});
}
return resourceProperty;
}
private void checkResourcePropertyOptions() {
getLifetimeResource().setEnabled(true);
getPersistantResource().setEnabled(true);
getNotificationResource().setEnabled(true);
getSecureResource().setEnabled(true);
getResourceProperty().setEnabled(false);
}
private Map<String,String> getInstallerPropsMap(){
Map<String,String> installerPropsMap=new HashMap<String,String>();
// Project properties
installerPropsMap.put("PROJECT_NAME", getProjectNameField().getText());
installerPropsMap.put("NAMESPACE_PREFIX", getNamespacePrefixField().getText());
installerPropsMap.put("WEBSERVICE_NAME", getWebServiceNameField().getText());
// Model properties
installerPropsMap.put("MODEL_FILE_PATH", getModelFileField().getText());
installerPropsMap.put("MODEL_FILE_TYPE", getModelFileTypeField().getSelectedItem().toString());
installerPropsMap.put("LOGICAL_MODEL", getLogicalModelField().getText());
installerPropsMap.put("DATA_MODEL", getDataModelField().getText());
installerPropsMap.put("INCLUDE_PACKAGE", getIncludePackageField().getText());
installerPropsMap.put("EXCLUDE_PACKAGE", getExcludePackageField().getText());
installerPropsMap.put("EXCLUDE_NAME", getExcludeNameField().getText());
installerPropsMap.put("EXCLUDE_NAMESPACE", getExcludeNamespaceField().getText());
// Code Generation properties
installerPropsMap.put("VALIDATE_LOGICAL_MODEL", Boolean.valueOf(validateLogicalModelCheckBox.isSelected()).toString() );
installerPropsMap.put("VALIDATE_MODEL_MAPPING", Boolean.valueOf(validateModelMappingCheckBox.isSelected()).toString() );
installerPropsMap.put("VALIDATE_MODEL_MAPPING", Boolean.valueOf(validateGmeTagsCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_HIBERNATE_MAPPING", Boolean.valueOf(generateHibernateMappingCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_BEANS", Boolean.valueOf(generateBeansCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_CASTOR_MAPPING", Boolean.valueOf(generateCastorMappingCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_XSD", Boolean.valueOf(generateXsdCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_XSD_WITH_GME_TAGS", Boolean.valueOf(generateXsdWithGmeTagsCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_XSD_WITH_PERMISSIBLE_VALUES", Boolean.valueOf(generateXsdWithPermissibleValuesCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_WSDD", Boolean.valueOf(generateWsddCheckBox.isSelected()).toString() );
installerPropsMap.put("GENERATE_HIBERNATE_VALIDATOR", Boolean.valueOf(generateHibernateValidatorCheckBox.isSelected()).toString() );
// DB Connection properties
installerPropsMap.put("USE_JNDI_BASED_CONNECTION", Boolean.valueOf(useJndiBasedConnectionCheckBox.isSelected()).toString() );
installerPropsMap.put("DB_JNDI_URL", getDbJndiUrlField().getText());
installerPropsMap.put("DB_CONNECTION_URL", getDbConnectionUrlField().getText());
installerPropsMap.put("DB_USERNAME", getDbUsernameField().getText());
installerPropsMap.put("DB_PASSWORD", getDbPasswordField().getText());
installerPropsMap.put("DB_DRIVER", getDbDriverField().getText());
installerPropsMap.put("DB_DIALECT", getDbDialectField().getText());
// Writable API properties
installerPropsMap.put("ENABLE_WRITABLE_API_EXTENSION", Boolean.valueOf(enableWritableApiExtensionCheckBox.isSelected()).toString() );
installerPropsMap.put("DATABASE_TYPE", getDatabaseTypeField().getText());
installerPropsMap.put("IDENTITY_GENERATOR_TAG", getIdentityGeneratorTagField().getText());
installerPropsMap.put("CADSR_CONNECTION_URL", getCaDsrConnectionUrlField().getText());
// Common Logging Module DB Connection properties
installerPropsMap.put("ENABLE_COMMON_LOGGING_MODULE", Boolean.valueOf(enableCommonLoggingModuleCheckBox.isSelected()).toString() );
installerPropsMap.put("CLM_PROJECT_NAME", getClmProjectName().getText());
installerPropsMap.put("CLM_DB_CONNECTION_URL", getClmDbConnectionUrlField().getText());
installerPropsMap.put("CLM_DB_USERNAME", getClmDbUsernameField().getText());
installerPropsMap.put("CLM_DB_PASSWORD", getClmDbPasswordField().getText());
installerPropsMap.put("CLM_DB_DRIVER", getClmDbDriverField().getText());
// Security properties
installerPropsMap.put("ENABLE_SECURITY", Boolean.valueOf(enableSecurityCheckBox.isSelected()).toString() );
installerPropsMap.put("ENABLE_INSTANCE_LEVEL_SECURITY", Boolean.valueOf(enableInstanceLevelSecurityCheckBox.isSelected()).toString() );
installerPropsMap.put("ENABLE_ATTRIBUTE_LEVEL_SECURITY", Boolean.valueOf(enableAttributeLevelSecurityCheckBox.isSelected()).toString() );
installerPropsMap.put("CSM_PROJECT_NAME", getCsmProjectNameField().getText());
installerPropsMap.put("CACHE_PROTECTION_ELEMENTS", Boolean.valueOf(cacheProtectionElementsCheckBox.isSelected()).toString() );
// CSM DB Connection properties
installerPropsMap.put("CSM_USE_JNDI_BASED_CONNECTION", Boolean.valueOf(csmUseJndiBasedConnectionCheckBox.isSelected()).toString() );
installerPropsMap.put("CSM_DB_JNDI_URL", getCsmDbJndiUrlField().getText());
installerPropsMap.put("CSM_DB_CONNECTION_URL", getCsmDbConnectionUrlField().getText());
installerPropsMap.put("CSM_DB_USERNAME", getCsmDbUsernameField().getText());
installerPropsMap.put("CSM_DB_PASSWORD", getCsmDbPasswordField().getText());
installerPropsMap.put("CSM_DB_DRIVER", getCsmDbDriverField().getText());
installerPropsMap.put("CSM_DB_DIALECT", getCsmDbDialectField().getText());
// caGrid Authentication properties
installerPropsMap.put("ENABLE_GRID_LOGIN_MODULE", Boolean.valueOf(enableCaGridLoginModuleCheckBox.isSelected()).toString() );
installerPropsMap.put("CAGRID_LOGIN_MODULE_NAME", getCaGridLoginModuleNameField().getText());
installerPropsMap.put("CAGRID_AUTHENTICATION_SERVICE_URL", getCaGridAuthSvcUrlField().getText());
installerPropsMap.put("CAGRID_DORIAN_SERVICE_URL", getCaGridDorianSvcUrlField().getText());
installerPropsMap.put("ENABLE_CSM_LOGIN_MODULE", Boolean.valueOf(enableCsmLoginModuleCheckBox.isSelected()).toString() );
installerPropsMap.put("SDK_GRID_LOGIN_SERVICE_NAME", getSdkGridLoginSvcNameField().getText());
installerPropsMap.put("SDK_GRID_LOGIN_SERVICE_URL", getSdkGridLoginSvcUrlField().getText());
// Application Server Properties
installerPropsMap.put("SERVER_TYPE", getServerTypeComboBox().getSelectedItem().toString());
installerPropsMap.put("SERVER_URL", getServerUrlField().getText());
// Advanced Settings properties
installerPropsMap.put("CACHE_PATH", getCachePathField().getText());
// TODO
return installerPropsMap;
}
}
|
<reponame>ethanlu/pyanoled
import os
PYANOLED_ROOT = os.path.abspath(os.path.dirname(__file__))
def get_conf_path(filename: str):
return os.path.join(PYANOLED_ROOT, 'conf', filename)
|
/**
* Load the given book into the given database, either insert or update the data.
*
* @param book the data set to load into the database
* @throws SQLException if load cannot be performed
*/
public void load(final Book book)
throws SQLException
{
if (book == null) return;
if (getDataSource() == null) {
StringBuilder log = new StringBuilder("Cannot import book ").append(defaultName(book));
log.append("as no database connection can be established.");
LOG.error(log.toString());
return;
}
if (LOG.isInfoEnabled()) {
StringBuilder log = new StringBuilder("Importing book ").append(defaultName(book));
log.append("with ").append(book.getSheets().size()).append(" sheets into the database.");
LOG.info(log.toString());
}
SheetLoader loader = new SheetLoader().setDataSource(getDataSource());
List<Sheet> sheets = getSheets(book);
for (Sheet sheet : sheets) {
loader.load(sheet);
}
for (Sheet sheet : sheets) {
loader.update(sheet);
}
if (LOG.isInfoEnabled()) {
StringBuilder log = new StringBuilder("Imported book ").append(defaultName(book));
log.append("with ").append(book.getSheets().size()).append(" sheets into the database.");
LOG.info(log.toString());
}
}
|
<gh_stars>10-100
package com.iyzipay.functional;
import com.iyzipay.functional.builder.CardInformationBuilder;
import com.iyzipay.functional.builder.request.CreateCardRequestBuilder;
import com.iyzipay.functional.util.RandomGenerator;
import com.iyzipay.model.Card;
import com.iyzipay.model.CardInformation;
import com.iyzipay.model.CardList;
import com.iyzipay.model.Locale;
import com.iyzipay.model.Status;
import com.iyzipay.request.CreateCardRequest;
import com.iyzipay.request.DeleteCardRequest;
import com.iyzipay.request.RetrieveCardListRequest;
import org.junit.Test;
import java.util.Collections;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
public class CardStorageTest extends BaseTest {
@Test
public void should_create_user_and_add_card() {
String externalUserId = RandomGenerator.randomId();
CardInformation cardInformation = CardInformationBuilder.create()
.build();
CreateCardRequest createCardRequest = CreateCardRequestBuilder.create()
.card(cardInformation)
.externalId(externalUserId)
.email("<EMAIL>")
.build();
Card card = Card.create(createCardRequest, options);
System.out.println(card);
assertEquals(Locale.TR.getValue(), card.getLocale());
assertEquals(Status.SUCCESS.getValue(), card.getStatus());
assertNotEquals(0, card.getSystemTime());
assertEquals("123456789", card.getConversationId());
assertEquals("<EMAIL>", card.getEmail());
assertEquals("552879", card.getBinNumber());
assertEquals("card alias", card.getCardAlias());
assertEquals("CREDIT_CARD", card.getCardType());
assertEquals("MASTER_CARD", card.getCardAssociation());
assertEquals("Paraf", card.getCardFamily());
assertEquals("Halk Bankası", card.getCardBankName());
assertEquals(12L, (long) card.getCardBankCode());
}
@Test
public void should_create_user_and_add_card_when_metadata_exist() {
String externalUserId = RandomGenerator.randomId();
Map<String, String> metadata = Collections.singletonMap("CUT_OFF_DAY", "15");
CardInformation cardInformation = CardInformationBuilder.create()
.metadata(metadata)
.build();
CreateCardRequest createCardRequest = CreateCardRequestBuilder.create()
.card(cardInformation)
.externalId(externalUserId)
.email("<EMAIL>")
.build();
System.out.println(createCardRequest);
Card card = Card.create(createCardRequest, options);
System.out.println(card);
assertEquals(Locale.TR.getValue(), card.getLocale());
assertEquals(Status.SUCCESS.getValue(), card.getStatus());
assertNotEquals(0, card.getSystemTime());
assertEquals("123456789", card.getConversationId());
assertEquals("<EMAIL>", card.getEmail());
assertEquals("552879", card.getBinNumber());
assertEquals("card alias", card.getCardAlias());
assertEquals("CREDIT_CARD", card.getCardType());
assertEquals("MASTER_CARD", card.getCardAssociation());
assertEquals("Paraf", card.getCardFamily());
assertEquals("15", card.getMetadata().get("CUT_OFF_DAY"));
assertEquals("Halk Bankası", card.getCardBankName());
assertEquals(12L, (long) card.getCardBankCode());
}
@Test
public void should_create_card_and_add_card_to_existing_user() {
String externalUserId = RandomGenerator.randomId();
CardInformation cardInformation = CardInformationBuilder.create()
.build();
CreateCardRequest cardRequest = CreateCardRequestBuilder.create()
.card(cardInformation)
.externalId(externalUserId)
.email("<EMAIL>")
.build();
Card firstCard = Card.create(cardRequest, options);
String cardUserKey = firstCard.getCardUserKey();
CreateCardRequest request = CreateCardRequestBuilder.create()
.card(cardInformation)
.cardUserKey(cardUserKey)
.externalId(externalUserId)
.build();
Card card = Card.create(request, options);
System.out.println(card);
assertEquals(Locale.TR.getValue(), card.getLocale());
assertEquals(Status.SUCCESS.getValue(), card.getStatus());
assertNotEquals(0, card.getSystemTime());
assertEquals("123456789", card.getConversationId());
assertEquals("552879", card.getBinNumber());
assertEquals("card alias", card.getCardAlias());
assertEquals("CREDIT_CARD", card.getCardType());
assertEquals("MASTER_CARD", card.getCardAssociation());
assertEquals("Paraf", card.getCardFamily());
assertEquals("Halk Bankası", card.getCardBankName());
assertEquals(externalUserId, card.getExternalId());
assertEquals(12L, (long) card.getCardBankCode());
}
@Test
public void should_delete_card() {
Card card = createCard();
DeleteCardRequest deleteCardRequest = new DeleteCardRequest();
deleteCardRequest.setCardToken(card.getCardToken());
deleteCardRequest.setCardUserKey(card.getCardUserKey());
Card deletedCard = Card.delete(deleteCardRequest, options);
System.out.println(deletedCard);
assertEquals(Status.SUCCESS.getValue(), deletedCard.getStatus());
assertEquals(Locale.TR.getValue(), deletedCard.getLocale());
assertNotEquals(0, deletedCard.getSystemTime());
assertNull(deletedCard.getErrorCode());
assertNull(deletedCard.getErrorMessage());
assertNull(deletedCard.getErrorGroup());
assertNull(deletedCard.getBinNumber());
assertNull(deletedCard.getCardAlias());
assertNull(deletedCard.getCardType());
assertNull(deletedCard.getCardAssociation());
assertNull(deletedCard.getCardFamily());
assertNull(deletedCard.getCardBankName());
assertNull(deletedCard.getCardBankCode());
assertNull(deletedCard.getCardUserKey());
assertNull(deletedCard.getCardToken());
assertNull(deletedCard.getEmail());
assertNull(deletedCard.getExternalId());
}
@Test
public void should_retrieve_card() {
Card card = createCard();
RetrieveCardListRequest request = new RetrieveCardListRequest();
request.setLocale(Locale.TR.getValue());
request.setConversationId("123456789");
request.setCardUserKey(card.getCardUserKey());
CardList cardList = CardList.retrieve(request, options);
System.out.println(cardList);
assertEquals(Status.SUCCESS.getValue(), cardList.getStatus());
assertEquals(Locale.TR.getValue(), cardList.getLocale());
assertEquals("123456789", cardList.getConversationId());
assertNotEquals(0, cardList.getSystemTime());
assertNull(cardList.getErrorCode());
assertNull(cardList.getErrorMessage());
assertNull(cardList.getErrorGroup());
assertNotNull(cardList.getCardDetails());
assertFalse(cardList.getCardDetails().isEmpty());
assertNotNull(cardList.getCardUserKey());
}
private Card createCard() {
CardInformation cardInformation = CardInformationBuilder.create()
.build();
CreateCardRequest cardRequest = CreateCardRequestBuilder.create()
.card(cardInformation)
.email("<EMAIL>")
.build();
return Card.create(cardRequest, options);
}
}
|
<filename>common/bintobcd_5digit.c
#include <sys/types.h>
__BEGIN_DECLS
uint32_t bintobcd_5digit (int32_t bin);
__END_DECLS
uint32_t
bintobcd_5digit (int32_t bin)
{
int i, j, k, s;
uint32_t bcd;
if ((s = sign (bin)) < 0)
bcd = 0x80000000;
else
bcd = 0x00000000;
for (i = 10000, k = 16; k >= 0; i /= 10, k -= 4)
{
j = bin / i;
bcd |= ((j * s) << k);
bin -= j * i;
}
return bcd;
}
|
#include "common.h"
#include <set>
#include <map>
#include <string>
#include "bu/log.h"
#include "bu/str.h"
#include "bu/malloc.h"
#include "shape_recognition.h"
// TODO - the topological test by itself is not guaranteed to isolate volumes that
// are uniquely positive or uniquely negative contributions to the overall volume.
// It may be that a candidate subbrep has both positive and
// negative contributions to make to the overall volume. Hopefully (not sure yet)
// this approach will reduce such situations to planar and general surface volumes,
// but we will need to handle them at those levels. For example,
//
// *
// * *
// --------------------- * * ---------------------
// | * * * * |
// | * * * * * * |
// | |
// | |
// -------------------------------------------------------------
//
// The two faces in the middle contribute both positively and negatively to the
// final surface area, and if this area were extruded would also define both
// positive and negative volume. Probably convex/concave testing is what
// will be needed to resolve this.
struct bu_ptbl *
find_subbreps(const ON_Brep *brep)
{
struct bu_ptbl *subbreps;
std::set<std::string> subbrep_keys;
BU_GET(subbreps, struct bu_ptbl);
bu_ptbl_init(subbreps, 8, "subbrep table");
int obj_cnt = 0;
/* For each face, build the topologically connected subset. If that
* subset has not already been seen, add it to the brep's set of
* subbreps */
for (int i = 0; i < brep->m_F.Count(); i++) {
std::string key;
std::set<int> faces;
std::set<int> loops;
std::set<int> edges;
std::set<int> fol; /* Faces with outer loops in object loop network */
std::set<int> fil; /* Faces with only inner loops in object loop network */
std::queue<int> local_loops;
std::set<int> processed_loops;
std::set<int>::iterator s_it;
// TODO - need to watch for an edge that has two general surfaces associated
// with it. That situation is too problematic for us to handle even as a
// breakdown into subbreps, and if we see it we need to bail. Ensuring reliable
// inside/outside testing under those conditions is extremely difficult.
// Maybe even something to do as an initial test.
const ON_BrepFace *face = &(brep->m_F[i]);
faces.insert(i);
fol.insert(i);
local_loops.push(face->OuterLoop()->m_loop_index);
processed_loops.insert(face->OuterLoop()->m_loop_index);
while(!local_loops.empty()) {
const ON_BrepLoop *loop = &(brep->m_L[local_loops.front()]);
loops.insert(local_loops.front());
local_loops.pop();
for (int ti = 0; ti < loop->m_ti.Count(); ti++) {
const ON_BrepTrim *trim = &(face->Brep()->m_T[loop->m_ti[ti]]);
const ON_BrepEdge *edge = &(face->Brep()->m_E[trim->m_ei]);
if (trim->m_ei != -1 && edge->TrimCount() > 1) {
edges.insert(trim->m_ei);
for (int j = 0; j < edge->TrimCount(); j++) {
int fio = edge->Trim(j)->FaceIndexOf();
if (edge->m_ti[j] != ti && fio != -1) {
int li = edge->Trim(j)->Loop()->m_loop_index;
faces.insert(fio);
if (processed_loops.find(li) == processed_loops.end()) {
local_loops.push(li);
processed_loops.insert(li);
}
if (li == brep->m_F[fio].OuterLoop()->m_loop_index) {
fol.insert(fio);
}
}
}
}
}
}
for (s_it = faces.begin(); s_it != faces.end(); s_it++) {
if (fol.find(*s_it) == fol.end()) {
fil.insert(*s_it);
}
}
key = face_set_key(faces);
/* If we haven't seen this particular subset before, add it */
if (subbrep_keys.find(key) == subbrep_keys.end()) {
subbrep_keys.insert(key);
struct subbrep_object_data *new_obj = NULL;
BU_GET(new_obj, struct subbrep_object_data);
subbrep_object_init(new_obj, brep);
new_obj->obj_cnt = &obj_cnt;
obj_cnt++;
if (obj_cnt > CSG_BREP_MAX_OBJS) goto bail;
bu_vls_sprintf(new_obj->key, "%s", key.c_str());
bu_vls_sprintf(new_obj->name_root, "%d", obj_cnt);
set_to_array(&(new_obj->faces), &(new_obj->faces_cnt), &faces);
set_to_array(&(new_obj->loops), &(new_obj->loops_cnt), &loops);
set_to_array(&(new_obj->edges), &(new_obj->edges_cnt), &edges);
set_to_array(&(new_obj->fol), &(new_obj->fol_cnt), &fol);
set_to_array(&(new_obj->fil), &(new_obj->fil_cnt), &fil);
// Here and only here, we are isolating topological "islands"
// Below this level, everything will be connected in some fashion
// by the edge network.
new_obj->is_island = 1;
new_obj->parent = NULL;
surface_t hof = highest_order_face(new_obj);
if (hof >= SURFACE_GENERAL) {
new_obj->type = BREP;
(void)subbrep_make_brep(new_obj);
bu_log("general surface present: %s\n", bu_vls_addr(new_obj->key));
} else {
int split = 0;
volume_t vtype = subbrep_shape_recognize(new_obj);
switch (vtype) {
case BREP:
split = subbrep_split(new_obj);
if (!split) {
if (obj_cnt > CSG_BREP_MAX_OBJS) goto bail;
(void)subbrep_make_brep(new_obj);
bu_log("split unsuccessful: %s\n", bu_vls_addr(new_obj->key));
} else {
// If we did successfully split the brep, do some post-split
// clean-up
new_obj->type = COMB;
if (new_obj->planar_obj) {
subbrep_planar_close_obj(new_obj);
}
}
break;
case PLANAR_VOLUME:
subbrep_planar_init(new_obj);
subbrep_planar_close_obj(new_obj);
new_obj->local_brep = new_obj->planar_obj->local_brep;
break;
default:
break;
}
}
bu_ptbl_ins(subbreps, (long *)new_obj);
}
}
return subbreps;
bail:
bu_log("brep converted to more than %d implicits - not a good CSG candidate\n", CSG_BREP_MAX_OBJS, obj_cnt);
// Free memory
for (unsigned int i = 0; i < BU_PTBL_LEN(subbreps); i++){
struct subbrep_object_data *obj = (struct subbrep_object_data *)BU_PTBL_GET(subbreps, i);
for (unsigned int j = 0; j < BU_PTBL_LEN(obj->children); j++){
struct subbrep_object_data *cdata = (struct subbrep_object_data *)BU_PTBL_GET(obj->children,j);
subbrep_object_free(cdata);
}
subbrep_object_free(obj);
BU_PUT(obj, struct subbrep_object_data);
}
bu_ptbl_free(subbreps);
bu_ptbl_init(subbreps, 8, "subbrep table");
return subbreps;
}
/* This is the critical point at which we take a pile of shapes and actually reconstruct a
* valid boolean tree. The stages are as follows:
*
* 1. Identify the top level union objects (they will have no fil faces in their structure).
* 2. Using the fil faces, build up a queue of subbreps that are topologically connected
* by a loop to the top level union objects.
* 3. Determine the boolean status of the 2nd layer of objects.
* 4. For each sub-object, if that object in turn has fil faces, queue up those objects and goto 3.
* 5. Continue iterating until all objects have a boolean operation assigned.
* 6. For each unioned object, build a set of all subtraction objects (topologically connected or not.)
* 7. add the union pointer to the subbreps_tree, and then add all all topologically connected subtractions
* and remove them from the local set.
* 8. For the remaining (non-topologically linked) subtractions, get a bounding box and see if it overlaps
* with the bounding box of the union object in question. If yes, add the pointer to subbreps_tree, unless
* the union object's bbox is fully contained by the subtraction bbox - the latter implies that the subtraction
* completely eliminates the union object, which is not how B-Reps work.
* If not, no action is needed. Once evaluated, remove the subtraction pointer from the set.
*
* Initially the test will be axis aligned bounding boxes, but ideally we should use oriented bounding boxes
* or even tighter tests. There's a catch here - a positive object overall may be within the bounding box
* of a subtracting object (like a positive cone at the bottom of a negative cylinder). First guess at a rule - subtractions
* may propagate back up the topological tree to unions above the subtraction or in other isolated topological
* trees, but never to unions below the subtraction
* object itself. Which means we'll need an above/below test for union objects relative to a given
* subtraction object, or an "ignore" list for unions which overrides any bbox tests - that list would include the
* parent subtraction, that subtraction's parent if it is a subtraction, and so on up to the top level union. Nested
* unions and subtractions mean we'll have to go all the way up that particular chain...
*/
struct bu_ptbl *
find_top_level_hierarchy(struct bu_ptbl *subbreps)
{
// Now that we have the subbreps (or their substructures) and their boolean status we need to
// construct the top level tree.
std::set<long *> subbrep_set;
std::set<long *> subbrep_seed_set;
std::set<long *> unions;
std::set<long *> subtractions;
std::set<long *>::iterator sb_it, sb_it2;
std::map<long *, std::set<long *> > subbrep_subobjs;
std::map<long *, std::set<long *> > subbrep_ignoreobjs;
struct bu_ptbl *subbreps_tree;
for (unsigned int i = 0; i < BU_PTBL_LEN(subbreps); i++) {
subbrep_set.insert(BU_PTBL_GET(subbreps, i));
}
/* Separate out top level unions */
for (sb_it = subbrep_set.begin(); sb_it != subbrep_set.end(); sb_it++) {
struct subbrep_object_data *obj = (struct subbrep_object_data *)*sb_it;
//std::cout << bu_vls_addr(obj->key) << " bool: " << obj->params->bool_op << "\n";
if (obj->fil_cnt == 0) {
if (!(obj->params->bool_op == '-')) {
//std::cout << "Top union found: " << bu_vls_addr(obj->key) << "\n";
obj->params->bool_op = 'u';
unions.insert((long *)obj);
subbrep_set.erase((long *)obj);
} else {
if (obj->params->bool_op == '-') {
//std::cout << "zero fills, but a negative shape - " << bu_vls_addr(obj->key) << " added to subtractions\n";
subtractions.insert((long *)obj);
}
}
}
}
subbrep_seed_set = unions;
int iterate = 1;
while (subbrep_seed_set.size() > 0) {
//std::cout << "iterate: " << iterate << "\n";
std::set<long *> subbrep_seed_set_2;
std::set<long *> subbrep_set_b;
for (sb_it = subbrep_seed_set.begin(); sb_it != subbrep_seed_set.end(); sb_it++) {
std::set<int> tu_fol;
struct subbrep_object_data *tu = (struct subbrep_object_data *)*sb_it;
array_to_set(&tu_fol, tu->fol, tu->fol_cnt);
subbrep_set_b = subbrep_set;
for (sb_it2 = subbrep_set.begin(); sb_it2 != subbrep_set.end(); sb_it2++) {
struct subbrep_object_data *cobj = (struct subbrep_object_data *)*sb_it2;
for (int i = 0; i < cobj->fil_cnt; i++) {
if (tu_fol.find(cobj->fil[i]) != tu_fol.end()) {
struct subbrep_object_data *up;
//std::cout << "Object " << bu_vls_addr(cobj->key) << " connected to " << bu_vls_addr(tu->key) << "\n";
subbrep_seed_set_2.insert(*sb_it2);
subbrep_set_b.erase(*sb_it2);
// Determine boolean relationship to parent here, and use parent boolean
// to decide this object's (cobj) status. If tu is negative and cobj is unioned
// relative to tu, then cobj is also negative.
// This is a make-or-break step of the algorithm - if we cannot determine whether
// a subbrep is added or subtracted, the whole B-Rep conversion process fails.
//
// TODO - In theory a partial conversion might still be achieved by re-inserting the
// problem subbrep back into the parent B-Rep and proceeding with the rest, but
// we are not currently set up for that - as of right now, a single failure on
// this level of logic results in a completely failed csg conversion.
int bool_test = 0;
int already_flipped = 0;
if (cobj->params->bool_op == '\0') {
/* First, check the boolean relationship to the parent solid */
cobj->parent = tu;
bool_test = subbrep_determine_boolean(cobj);
//std::cout << "Initial boolean test for " << bu_vls_addr(cobj->key) << ": " << bool_test << "\n";
switch (bool_test) {
case -2:
bu_log("Game over - self intersecting shape reported with subbrep %s\n", bu_vls_addr(cobj->key));
bu_log("Until breakdown logic for this situation is available, this is a conversion stopper.\n");
return NULL;
case 2:
/* Test relative to parent inconclusive - fall back on surface test, if available */
if (cobj->negative_shape == -1) bool_test = -1;
if (cobj->negative_shape == 1) bool_test = 1;
break;
default:
break;
}
} else {
//std::cout << "Boolean status of " << bu_vls_addr(cobj->key) << " already determined\n";
bool_test = (cobj->params->bool_op == '-') ? -1 : 1;
already_flipped = 1;
}
switch (bool_test) {
case -1:
cobj->params->bool_op = '-';
subtractions.insert((long *)cobj);
subbrep_subobjs[*sb_it].insert((long *)cobj);
break;
case 1:
cobj->params->bool_op = 'u';
unions.insert((long *)cobj);
/* We've got a union - any subtractions that are parents of this
* object go in its ignore list */
up = cobj->parent;
while (up) {
if (up->params->bool_op == '-') subbrep_ignoreobjs[(long *)cobj].insert((long *)up);
up = up->parent;
}
break;
default:
bu_log("Boolean status of %s could not be determined - conversion failure\n", bu_vls_addr(cobj->key));;
return NULL;
break;
}
// If the parent ended up subtracted, we need to propagate the change down the
// children of this subbrep.
if (bool_test == -1 && !already_flipped) {
for (unsigned int j = 0; j < BU_PTBL_LEN(cobj->children); j++){
struct subbrep_object_data *cdata = (struct subbrep_object_data *)BU_PTBL_GET(cobj->children,j);
if (cdata && cdata->params) {
cdata->params->bool_op = (cdata->params->bool_op == '-') ? 'u' : '-';
} else {
//std::cout << "Child without params??: " << bu_vls_addr(cdata->key) << ", parent: " << bu_vls_addr(cobj->key) << "\n";
}
}
/* If we're a B-Rep and a subtraction, the B-Rep will be inside out */
if (cobj->type == BREP && cobj->params->bool_op == '-') {
for (int l = 0; l < cobj->local_brep->m_F.Count(); l++) {
ON_BrepFace &face = cobj->local_brep->m_F[l];
cobj->local_brep->FlipFace(face);
}
}
}
//std::cout << "Boolean status of " << bu_vls_addr(cobj->key) << ": " << cobj->params->bool_op << "\n";
}
}
}
}
subbrep_seed_set.clear();
subbrep_seed_set = subbrep_seed_set_2;
subbrep_set.clear();
subbrep_set = subbrep_set_b;
iterate++;
}
BU_GET(subbreps_tree, struct bu_ptbl);
bu_ptbl_init(subbreps_tree, 8, "subbrep tree table");
for (sb_it = unions.begin(); sb_it != unions.end(); sb_it++) {
struct subbrep_object_data *pobj = (struct subbrep_object_data *)(*sb_it);
bu_ptbl_ins(subbreps_tree, (long *)pobj);
std::set<long *> topological_subtractions = subbrep_subobjs[(long *)pobj];
std::set<long *> local_subtraction_queue = subtractions;
for (sb_it2 = topological_subtractions.begin(); sb_it2 != topological_subtractions.end(); sb_it2++) {
bu_ptbl_ins(subbreps_tree, *sb_it2);
local_subtraction_queue.erase(*sb_it2);
}
std::set<long *> ignore_queue = subbrep_ignoreobjs[(long *)pobj];
for (sb_it2 = ignore_queue.begin(); sb_it2 != ignore_queue.end(); sb_it2++) {
local_subtraction_queue.erase(*sb_it2);
}
// Now, whatever is left in the local subtraction queue has to be ruled out based on volumetric
// intersection testing.
if (BU_STR_EQUAL(bu_vls_addr(pobj->key), "18_42_46_50")) {
bu_log("handle it!\n");
}
// Construct bounding box for pobj
if (!pobj->bbox_set) subbrep_bbox(pobj);
// Iterate over the queue
for (sb_it2 = local_subtraction_queue.begin(); sb_it2 != local_subtraction_queue.end(); sb_it2++) {
struct subbrep_object_data *sobj = (struct subbrep_object_data *)(*sb_it2);
//std::cout << "Checking subbrep " << bu_vls_addr(sobj->key) << "\n";
// Construct bounding box for sobj
if (!sobj->bbox_set) subbrep_bbox(sobj);
ON_BoundingBox isect;
bool bbi = isect.Intersection(*pobj->bbox, *sobj->bbox);
bool bbc = pobj->bbox->Includes(*sobj->bbox);
bool bcb = sobj->bbox->Includes(*pobj->bbox);
if (!bcb && (bbi || bbc)) {
//std::cout << " Found intersecting subbrep " << bu_vls_addr(sobj->key) << " under " << bu_vls_addr(pobj->key) << "\n";
bu_ptbl_ins(subbreps_tree, *sb_it2);
}
}
}
return subbreps_tree;
}
void
set_filter_obj(const ON_Surface *surface, struct filter_obj *obj)
{
if (!obj) return;
filter_obj_init(obj);
obj->stype = GetSurfaceType(surface, obj);
// If we've got a planar face, we can stop now - planar faces
// are determinative of volume type only when *all* faces are planar,
// and that case is handled elsewhere - anything is "allowed".
if (obj->stype == SURFACE_PLANE) obj->type = BREP;
// If we've got a general surface, anything is allowed
if (obj->stype == SURFACE_GENERAL) obj->type = BREP;
if (obj->stype == SURFACE_CYLINDRICAL_SECTION || obj->stype == SURFACE_CYLINDER) obj->type = CYLINDER;
if (obj->stype == SURFACE_CONE) obj->type = CONE;
if (obj->stype == SURFACE_SPHERICAL_SECTION || obj->stype == SURFACE_SPHERE) obj->type = SPHERE;
if (obj->stype == SURFACE_TORUS) obj->type = TORUS;
}
int
apply_filter_obj(const ON_Surface *surf, int UNUSED(loop_index), struct filter_obj *obj)
{
int ret = 1;
struct filter_obj *local_obj;
BU_GET(local_obj, struct filter_obj);
int surface_type = (int)GetSurfaceType(surf, local_obj);
std::set<int> allowed;
if (obj->type == CYLINDER) {
allowed.insert(SURFACE_CYLINDRICAL_SECTION);
allowed.insert(SURFACE_CYLINDER);
allowed.insert(SURFACE_PLANE);
}
if (obj->type == CONE) {
allowed.insert(SURFACE_CONE);
allowed.insert(SURFACE_PLANE);
}
if (obj->type == SPHERE) {
allowed.insert(SURFACE_SPHERICAL_SECTION);
allowed.insert(SURFACE_SPHERE);
allowed.insert(SURFACE_PLANE);
}
if (obj->type == TORUS) {
allowed.insert(SURFACE_TORUS);
allowed.insert(SURFACE_PLANE);
}
// If the face's surface type is not part of the allowed set for
// this object type, we're done
if (allowed.find(surface_type) == allowed.end()) {
ret = 0;
goto filter_done;
}
if (obj->type == CYLINDER) {
if (surface_type == SURFACE_PLANE) {
int is_parallel = obj->cylinder->Axis().IsParallelTo(local_obj->plane->Normal(), BREP_PLANAR_TOL);
if (is_parallel == 0) {
ret = 0;
goto filter_done;
}
}
if (surface_type == SURFACE_CYLINDER || surface_type == SURFACE_CYLINDRICAL_SECTION ) {
// Make sure the surfaces are on the same cylinder
if (obj->cylinder->circle.Center().DistanceTo(local_obj->cylinder->circle.Center()) > BREP_CYLINDRICAL_TOL) {
ret = 0;
goto filter_done;
}
}
}
if (obj->type == CONE) {
}
if (obj->type == SPHERE) {
}
if (obj->type == TORUS) {
}
filter_done:
filter_obj_free(local_obj);
BU_PUT(local_obj, struct filter_obj);
return ret;
}
void
add_loops_from_face(int f_ind, struct subbrep_object_data *data, std::set<int> *loops, std::queue<int> *local_loops, std::set<int> *processed_loops)
{
for (int j = 0; j < data->brep->m_F[f_ind].m_li.Count(); j++) {
int loop_in_set = 0;
int loop_ind = data->brep->m_F[f_ind].m_li[j];
int k = 0;
while (k < data->loops_cnt) {
if (data->loops[k] == loop_ind) loop_in_set = 1;
k++;
}
if (loop_in_set) loops->insert(loop_ind);
if (loop_in_set && processed_loops->find(loop_ind) == processed_loops->end()) {
local_loops->push(loop_ind);
}
}
}
/* In order to represent complex shapes, it is necessary to identify
* subsets of subbreps that can be represented as primitives. This
* function will identify such subsets, if possible. If a subbrep
* can be successfully decomposed into primitive candidates, the
* type of the subbrep is set to COMB and the children bu_ptbl is
* populated with subbrep_object_data sets. */
int
subbrep_split(struct subbrep_object_data *data)
{
//if (BU_STR_EQUAL(bu_vls_addr(data->key), "325_326_441_527_528")) {
// std::cout << "looking at 325_326_441_527_528\n";
//}
int csg_fail = 0;
std::set<int> processed_faces;
std::set<std::string> subbrep_keys;
/* For each face, identify the candidate solid type. If that
* subset has not already been seen, add it to the brep's set of
* subbreps */
for (int i = 0; i < data->faces_cnt; i++) {
std::string key;
std::set<int> faces;
std::set<int> loops;
std::set<int> edges;
std::queue<int> local_loops;
std::set<int> processed_loops;
std::set<int>::iterator s_it;
struct filter_obj *filters;
BU_GET(filters, struct filter_obj);
std::set<int> locally_processed_faces;
set_filter_obj(data->brep->m_F[data->faces[i]].SurfaceOf(), filters);
if (filters->type == BREP) {
filter_obj_free(filters);
BU_PUT(filters, struct filter_obj);
continue;
}
if (filters->stype == SURFACE_PLANE) {
filter_obj_free(filters);
BU_PUT(filters, struct filter_obj);
continue;
}
faces.insert(data->faces[i]);
//std::cout << "working: " << data->faces[i] << "\n";
locally_processed_faces.insert(data->faces[i]);
add_loops_from_face(data->faces[i], data, &loops, &local_loops, &processed_loops);
while(!local_loops.empty()) {
int curr_loop = local_loops.front();
local_loops.pop();
if (processed_loops.find(curr_loop) == processed_loops.end()) {
loops.insert(curr_loop);
processed_loops.insert(curr_loop);
for (int ti = 0; ti < data->brep->m_L[curr_loop].m_ti.Count(); ti++) {
const ON_BrepTrim *trim = &(data->brep->m_T[data->brep->m_L[curr_loop].m_ti[ti]]);
const ON_BrepEdge *edge = &(data->brep->m_E[trim->m_ei]);
if (trim->m_ei != -1 && edge->TrimCount() > 1) {
edges.insert(trim->m_ei);
for (int j = 0; j < edge->TrimCount(); j++) {
int fio = edge->Trim(j)->FaceIndexOf();
if (fio != -1 && locally_processed_faces.find(fio) == locally_processed_faces.end()) {
surface_t stype = GetSurfaceType(data->brep->m_F[fio].SurfaceOf(), NULL);
// If fio meets the criteria for the candidate shape, add it. Otherwise,
// it's not part of this shape candidate
if (apply_filter_obj(data->brep->m_F[fio].SurfaceOf(), curr_loop, filters)) {
// TODO - more testing needs to be done here... get_allowed_surface_types
// returns the volume_t, use it to do some testing to evaluate
// things like normals and shared axis
//std::cout << "accept: " << fio << "\n";
faces.insert(fio);
locally_processed_faces.insert(fio);
// The planar faces will always share edges with the non-planar
// faces, which drive the primary shape. Also, planar faces are
// more likely to have other edges that relate to other shapes.
if (stype != SURFACE_PLANE)
add_loops_from_face(fio, data, &loops, &local_loops, &processed_loops);
}
}
}
}
}
}
}
key = face_set_key(faces);
/* If we haven't seen this particular subset before, add it */
if (subbrep_keys.find(key) == subbrep_keys.end()) {
subbrep_keys.insert(key);
struct subbrep_object_data *new_obj;
BU_GET(new_obj, struct subbrep_object_data);
subbrep_object_init(new_obj, data->brep);
bu_vls_sprintf(new_obj->key, "%s", key.c_str());
set_to_array(&(new_obj->faces), &(new_obj->faces_cnt), &faces);
set_to_array(&(new_obj->loops), &(new_obj->loops_cnt), &loops);
set_to_array(&(new_obj->edges), &(new_obj->edges_cnt), &edges);
new_obj->fol_cnt = 0;
new_obj->fil_cnt = 0;
new_obj->parent = data;
new_obj->type = filters->type;
switch (new_obj->type) {
case CYLINDER:
if (!cylinder_csg(new_obj, BREP_CYLINDRICAL_TOL)) {
bu_log("cylinder csg failure: %s\n", key.c_str());
csg_fail++;
}
break;
case CONE:
if (!cone_csg(new_obj, BREP_CONIC_TOL)) {
bu_log("cone csg failure: %s\n", key.c_str());
csg_fail++;
}
break;
case SPHERE:
if (!sphere_csg(new_obj, BREP_SPHERICAL_TOL)) {
bu_log("sphere csg failure: %s\n", key.c_str());
csg_fail++;
}
break;
case ELLIPSOID:
bu_log("TODO: process partial ellipsoid\n");
/* TODO - Until we properly handle these shapes, this is a failure case */
csg_fail++;
break;
case TORUS:
if (!torus_csg(new_obj, BREP_TOROIDAL_TOL)) {
bu_log("torus csg failure: %s\n", key.c_str());
csg_fail++;
}
break;
default:
/* Unknown object type - can't convert to csg */
csg_fail++;
break;
}
bu_ptbl_ins(data->children, (long *)new_obj);
}
filter_obj_free(filters);
BU_PUT(filters, struct filter_obj);
if ((*data->obj_cnt) > CSG_BREP_MAX_OBJS) goto csg_abort;
}
if (subbrep_keys.size() == 0 || csg_fail > 0) {
goto csg_abort;
}
data->type = COMB;
return 1;
csg_abort:
/* Clear children - we found something we can't handle, so there will be no
* CSG conversion of this subbrep */
data->type = BREP;
for (unsigned int i = 0; i < BU_PTBL_LEN(data->children); i++) {
struct subbrep_object_data *cdata = (struct subbrep_object_data *)BU_PTBL_GET(data->children,i);
subbrep_object_free(cdata);
}
return 0;
}
int
subbrep_make_brep(struct subbrep_object_data *data)
{
if (data->local_brep) return 0;
data->local_brep = ON_Brep::New();
// For each edge in data, find the corresponding loop in data and construct
// a new face in the brep with the surface from the original face and the
// loop in data as the new outer loop. Trim down the surface for the new
// role. Add the corresponding 3D edges and sync things up.
// Each edge will map to two faces in the original Brep. We only want the
// subset of data that is part of this particular subobject - to do that,
// we need to map elements from their indices in the old Brep to their
// locations in the new.
std::map<int, int> face_map;
std::map<int, int> surface_map;
std::map<int, int> edge_map;
std::map<int, int> vertex_map;
std::map<int, int> loop_map;
std::map<int, int> c3_map;
std::map<int, int> c2_map;
std::map<int, int> trim_map;
//std::map<int, int> subloop_map; // When not all of the trims from an old loop are used, make new loops here so we have somewhere to stash the trims. They'll be useful if we want/need to construct faces closing the new subbreps.
std::set<int> faces;
std::set<int> fil;
std::set<int> loops;
std::set<int> isolated_trims; // collect 2D trims whose parent loops aren't fully included here
array_to_set(&faces, data->faces, data->faces_cnt);
array_to_set(&fil, data->fil, data->fil_cnt);
array_to_set(&loops, data->loops, data->loops_cnt);
// Each edge has a trim array, and the trims will tell us which loops
// are to be included and which faces the trims belong to. There will
// be some trims that belong to a face that is not included in the
// subbrep face list, and those are rejected - those rejections indicate
// a new face needs to be created to close the Brep. The edges will drive
// the population of new_brep initially - for each element pulled in by
// the edge, it is either added or (if it's already in the map) references
// are updated.
for (int i = 0; i < data->edges_cnt; i++) {
int c3i;
const ON_BrepEdge *old_edge = &(data->brep->m_E[data->edges[i]]);
//std::cout << "old edge: " << old_edge->Vertex(0)->m_vertex_index << "," << old_edge->Vertex(1)->m_vertex_index << "\n";
// Get the 3D curves from the edges
if (c3_map.find(old_edge->EdgeCurveIndexOf()) == c3_map.end()) {
ON_Curve *nc = old_edge->EdgeCurveOf()->Duplicate();
c3i = data->local_brep->AddEdgeCurve(nc);
c3_map[old_edge->EdgeCurveIndexOf()] = c3i;
} else {
c3i = c3_map[old_edge->EdgeCurveIndexOf()];
}
// Get the vertices from the edges
int v0i, v1i;
if (vertex_map.find(old_edge->Vertex(0)->m_vertex_index) == vertex_map.end()) {
ON_BrepVertex& newv0 = data->local_brep->NewVertex(old_edge->Vertex(0)->Point(), old_edge->Vertex(0)->m_tolerance);
v0i = newv0.m_vertex_index;
vertex_map[old_edge->Vertex(0)->m_vertex_index] = v0i;
} else {
v0i = vertex_map[old_edge->Vertex(0)->m_vertex_index];
}
if (vertex_map.find(old_edge->Vertex(1)->m_vertex_index) == vertex_map.end()) {
ON_BrepVertex& newv1 = data->local_brep->NewVertex(old_edge->Vertex(1)->Point(), old_edge->Vertex(1)->m_tolerance);
v1i = newv1.m_vertex_index;
vertex_map[old_edge->Vertex(1)->m_vertex_index] = v1i;
} else {
v1i = vertex_map[old_edge->Vertex(1)->m_vertex_index];
}
ON_BrepEdge& new_edge = data->local_brep->NewEdge(data->local_brep->m_V[v0i], data->local_brep->m_V[v1i], c3i, NULL ,0);
edge_map[old_edge->m_edge_index] = new_edge.m_edge_index;
//std::cout << "new edge: " << v0i << "," << v1i << "\n";
// Get the 2D curves from the trims
for (int j = 0; j < old_edge->TrimCount(); j++) {
ON_BrepTrim *old_trim = old_edge->Trim(j);
if (faces.find(old_trim->Face()->m_face_index) != faces.end()) {
if (c2_map.find(old_trim->TrimCurveIndexOf()) == c2_map.end()) {
ON_Curve *nc = old_trim->TrimCurveOf()->Duplicate();
int c2i = data->local_brep->AddTrimCurve(nc);
c2_map[old_trim->TrimCurveIndexOf()] = c2i;
//std::cout << "c2i: " << c2i << "\n";
}
}
}
// Get the faces and surfaces from the trims
for (int j = 0; j < old_edge->TrimCount(); j++) {
ON_BrepTrim *old_trim = old_edge->Trim(j);
if (face_map.find(old_trim->Face()->m_face_index) == face_map.end()) {
if (faces.find(old_trim->Face()->m_face_index) != faces.end()) {
ON_Surface *ns = old_trim->Face()->SurfaceOf()->Duplicate();
int nsid = data->local_brep->AddSurface(ns);
surface_map[old_trim->Face()->SurfaceIndexOf()] = nsid;
ON_BrepFace &new_face = data->local_brep->NewFace(nsid);
face_map[old_trim->Face()->m_face_index] = new_face.m_face_index;
//std::cout << "old_face: " << old_trim->Face()->m_face_index << "\n";
//std::cout << "new_face: " << new_face.m_face_index << "\n";
if (fil.find(old_trim->Face()->m_face_index) != fil.end()) {
data->local_brep->FlipFace(new_face);
}
if (old_trim->Face()->m_bRev) {
data->local_brep->FlipFace(new_face);
}
}
}
}
// Get the loops from the trims
for (int j = 0; j < old_edge->TrimCount(); j++) {
ON_BrepTrim *old_trim = old_edge->Trim(j);
ON_BrepLoop *old_loop = old_trim->Loop();
if (face_map.find(old_trim->Face()->m_face_index) != face_map.end()) {
if (loops.find(old_loop->m_loop_index) != loops.end()) {
if (loop_map.find(old_loop->m_loop_index) == loop_map.end()) {
// After the initial breakout, all loops in any given subbrep are outer loops,
// whatever they were in the original brep.
ON_BrepLoop &nl = data->local_brep->NewLoop(ON_BrepLoop::outer, data->local_brep->m_F[face_map[old_loop->m_fi]]);
loop_map[old_loop->m_loop_index] = nl.m_loop_index;
//std::cout << "adding loop: " << old_loop->m_loop_index << "\n";
}
} //else {
//std::cout << "have isolated trim whose parent loop isn't fully included\n";
/* if (subloop_map.find(old_loop->m_loop_index) == subloop_map.end()) {
ON_BrepLoop &nl = data->local_brep->NewLoop(ON_BrepLoop::outer, data->local_brep->m_F[face_map[old_loop->m_fi]]);
subloop_map[old_loop->m_loop_index] = nl.m_loop_index;
isolated_trims.insert(old_trim->m_trim_index);
}
}*/
}
}
}
// Now, create new trims using the old loop definitions and the maps
std::map<int, int>::iterator loop_it;
for (loop_it = loop_map.begin(); loop_it != loop_map.end(); loop_it++) {
const ON_BrepLoop *old_loop = &(data->brep->m_L[(*loop_it).first]);
ON_BrepLoop &new_loop = data->local_brep->m_L[(*loop_it).second];
for (int j = 0; j < old_loop->TrimCount(); j++) {
const ON_BrepTrim *old_trim = old_loop->Trim(j);
//std::cout << "loop[" << (*loop_it).first << "," << (*loop_it).second << "]: trim " << old_trim->m_trim_index << "\n";
ON_BrepEdge *o_edge = old_trim->Edge();
if (o_edge) {
ON_BrepEdge &n_edge = data->local_brep->m_E[edge_map[o_edge->m_edge_index]];
//std::cout << "edge(" << o_edge->m_edge_index << "," << n_edge.m_edge_index << ")\n";
ON_BrepTrim &nt = data->local_brep->NewTrim(n_edge, old_trim->m_bRev3d, new_loop, c2_map[old_trim->TrimCurveIndexOf()]);
nt.m_tolerance[0] = old_trim->m_tolerance[0];
nt.m_tolerance[1] = old_trim->m_tolerance[1];
nt.m_iso = old_trim->m_iso;
} else {
/* If we didn't have an edge originally, we need to add the 2d curve here */
if (c2_map.find(old_trim->TrimCurveIndexOf()) == c2_map.end()) {
ON_Curve *nc = old_trim->TrimCurveOf()->Duplicate();
int c2i = data->local_brep->AddTrimCurve(nc);
c2_map[old_trim->TrimCurveIndexOf()] = c2i;
//std::cout << "2D only c2i: " << c2i << "\n";
}
if (vertex_map.find(old_trim->Vertex(0)->m_vertex_index) == vertex_map.end()) {
ON_BrepVertex& newvs = data->local_brep->NewVertex(old_trim->Vertex(0)->Point(), old_trim->Vertex(0)->m_tolerance);
vertex_map[old_trim->Vertex(0)->m_vertex_index] = newvs.m_vertex_index;
ON_BrepTrim &nt = data->local_brep->NewSingularTrim(newvs, new_loop, old_trim->m_iso, c2_map[old_trim->TrimCurveIndexOf()]);
nt.m_tolerance[0] = old_trim->m_tolerance[0];
nt.m_tolerance[1] = old_trim->m_tolerance[1];
} else {
ON_BrepTrim &nt = data->local_brep->NewSingularTrim(data->local_brep->m_V[vertex_map[old_trim->Vertex(0)->m_vertex_index]], new_loop, old_trim->m_iso, c2_map[old_trim->TrimCurveIndexOf()]);
nt.m_tolerance[0] = old_trim->m_tolerance[0];
nt.m_tolerance[1] = old_trim->m_tolerance[1];
}
}
}
}
#if 0
std::set<int>::iterator trims_it;
for (trims_it = isolated_trims.begin(); trims_it != isolated_trims.end(); trims_it++) {
const ON_BrepTrim *old_trim = &(data->brep->m_T[*trims_it]);
ON_BrepLoop &new_loop = data->local_brep->m_L[subloop_map[old_trim->Loop()->m_loop_index]];
ON_BrepEdge *o_edge = old_trim->Edge();
if (o_edge) {
ON_BrepEdge &n_edge = data->local_brep->m_E[edge_map[o_edge->m_edge_index]];
//std::cout << "edge(" << o_edge->m_edge_index << "," << n_edge.m_edge_index << ")\n";
ON_BrepTrim &nt = data->local_brep->NewTrim(n_edge, old_trim->m_bRev3d, new_loop, c2_map[old_trim->TrimCurveIndexOf()]);
nt.m_tolerance[0] = old_trim->m_tolerance[0];
nt.m_tolerance[1] = old_trim->m_tolerance[1];
nt.m_iso = old_trim->m_iso;
} else {
/* If we didn't have an edge originally, we need to add the 2d curve here */
if (c2_map.find(old_trim->TrimCurveIndexOf()) == c2_map.end()) {
ON_Curve *nc = old_trim->TrimCurveOf()->Duplicate();
int c2i = data->local_brep->AddTrimCurve(nc);
c2_map[old_trim->TrimCurveIndexOf()] = c2i;
//std::cout << "2D only c2i: " << c2i << "\n";
}
if (vertex_map.find(old_trim->Vertex(0)->m_vertex_index) == vertex_map.end()) {
ON_BrepVertex& newvs = data->local_brep->NewVertex(old_trim->Vertex(0)->Point(), old_trim->Vertex(0)->m_tolerance);
ON_BrepTrim &nt = data->local_brep->NewSingularTrim(newvs, new_loop, old_trim->m_iso, c2_map[old_trim->TrimCurveIndexOf()]);
nt.m_tolerance[0] = old_trim->m_tolerance[0];
nt.m_tolerance[1] = old_trim->m_tolerance[1];
} else {
ON_BrepTrim &nt = data->local_brep->NewSingularTrim(data->local_brep->m_V[vertex_map[old_trim->Vertex(0)->m_vertex_index]], new_loop, old_trim->m_iso, c2_map[old_trim->TrimCurveIndexOf()]);
nt.m_tolerance[0] = old_trim->m_tolerance[0];
nt.m_tolerance[1] = old_trim->m_tolerance[1];
}
}
}
#endif
// Make sure all the loop directions are correct
for (int l = 0; l < data->local_brep->m_L.Count(); l++) {
if (data->local_brep->LoopDirection(data->local_brep->m_L[l]) != 1) {
data->local_brep->FlipLoop(data->local_brep->m_L[l]);
}
}
data->local_brep->ShrinkSurfaces();
data->local_brep->CullUnusedSurfaces();
//std::cout << "new brep done: " << bu_vls_addr(data->key) << "\n";
return 1;
}
// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class A_Eevee {
public static void main(String[] args) throws java.io.IOException {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
input.readLine();
String clue = input.readLine();
for (String s : choices) {
if (s.matches(clue)) {
System.out.println(s);
return;
}
}
}
static final String[] choices = {"vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"};
}
|
/**
* Handle null commands or invalid commands
*/
public class NullCommand implements Command {
@Override
public Position executeCommand(Position position) {
return position;
}
@Override
public CommandTypeEnum getCommandType() {
return CommandTypeEnum.INVALID;
}
}
|
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class TemplateE implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
out = new PrintWriter("output.txt");
} catch (Exception e) {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
}
String readString() throws IOException {
while (!tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(in.readLine(), " :");
} catch (Exception e) {
return null;
}
}
return tok.nextToken();
}
int readInt() throws IOException {
return Integer.parseInt(readString());
}
int[] readIntArray(int size) throws IOException {
int[] res = new int[size];
for (int i = 0; i < size; i++) {
res[i] = readInt();
}
return res;
}
long readLong() throws IOException {
return Long.parseLong(readString());
}
double readDouble() throws IOException {
return Double.parseDouble(readString());
}
<T> List<T>[] createGraphList(int size) {
List<T>[] list = new List[size];
for (int i = 0; i < size; i++) {
list[i] = new ArrayList<>();
}
return list;
}
public static void main(String[] args) {
new Thread(null, new TemplateE(), "", 1l * 200 * 1024 * 1024).start();
}
long timeBegin, timeEnd;
void time() {
timeEnd = System.currentTimeMillis();
System.err.println("Time = " + (timeEnd - timeBegin));
}
long memoryTotal, memoryFree;
void memory() {
memoryFree = Runtime.getRuntime().freeMemory();
System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
+ " KB");
}
public void run() {
try {
timeBegin = System.currentTimeMillis();
memoryTotal = Runtime.getRuntime().freeMemory();
init();
solve();
out.close();
if (System.getProperty("ONLINE_JUDGE") == null) {
time();
memory();
}
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
class Edge {
int to;
int w;
int p;
int index;
boolean inTree;
int diff;
public Edge(int to, int w, int p, int index) {
this.to = to;
this.w = w;
this.p = p;
this.index = index;
}
}
List<Edge>[] graph;
long[] subTreeWeight;
long dfs(int x, int p) {
long bottomW = 0;
for (Edge edge : graph[x]) {
if (edge.to == p) continue;
edge.inTree = true;
long childW = dfs(edge.to, x);
bottomW += childW;
if (childW > edge.p) {
fail();
}
int canDec = (int) Math.min(edge.p - childW, edge.w - 1);
edge.p -= canDec;
edge.w -= canDec;
edge.diff = canDec;
bottomW += edge.w;
}
subTreeWeight[x] = bottomW;
return bottomW;
}
void fail() {
out.println(-1);
out.flush();
out.close();
System.exit(0);
}
void slim(int x, int p, long canAdd) {
for (Edge edge : graph[x]) {
if (edge.to == p) continue;
long inc = Math.min(canAdd, edge.diff);
edge.w += inc;
edge.p += inc;
canAdd -= inc;
subTreeWeight[x] += inc;
long old = subTreeWeight[edge.to];
slim(edge.to, x, Math.min(canAdd, edge.p - subTreeWeight[edge.to]));
long now = subTreeWeight[edge.to];
subTreeWeight[x] += now - old;
canAdd -= now - old;
}
}
void solve() throws IOException {
int n = readInt();
graph = createGraphList(n);
subTreeWeight = new long[n];
for (int i = 0; i < n - 1; i++) {
int x = readInt() - 1;
int y = readInt() - 1;
int w = readInt();
int p = readInt();
graph[x].add(new Edge(y, w, p, i));
graph[y].add(new Edge(x, w, p, i));
}
dfs(0, 0);
slim(0, 0, Long.MAX_VALUE / 100);
out.println(n);
String[] answer = new String[n - 1];
for (int from = 0; from < n; from++) {
for (Edge e : graph[from]) {
if (e.inTree) {
answer[e.index] = (from + 1) + " " + (e.to + 1) + " " + e.w + " " + e.p;
}
}
}
for (String s : answer) {
out.println(s);
}
}
}
|
/*[deutsch]
* <p>Rekonstruiert die Kalenderhistorie von der angegebenen Beschreibung. </p>
*
* @param variant description as defined in {@link #getVariant()}
* @return ChronoHistory
* @throws IllegalArgumentException if the variant cannot be interpreted as calendar history
* @since 3.36/4.31
*/
public static ChronoHistory from(String variant) {
if (!variant.startsWith("historic-")) {
throw new IllegalArgumentException("Variant does not start with \"historic-\": " + variant);
}
String[] parts = variant.substring(9).split(":");
if (parts.length == 0) {
throw new IllegalArgumentException("Invalid variant description.");
}
HistoricVariant hv = HistoricVariant.valueOf(parts[0]);
ChronoHistory history;
int startIndex = 2;
switch (hv) {
case PROLEPTIC_GREGORIAN:
return ChronoHistory.PROLEPTIC_GREGORIAN;
case PROLEPTIC_JULIAN:
return ChronoHistory.PROLEPTIC_JULIAN;
case PROLEPTIC_BYZANTINE:
return ChronoHistory.PROLEPTIC_BYZANTINE;
case SWEDEN:
history = ChronoHistory.ofSweden();
startIndex = 1;
break;
case INTRODUCTION_ON_1582_10_15:
if (!getGregorianCutOverDate(parts, variant).equals(PlainDate.of(1582, 10, 15))) {
throw new IllegalArgumentException("Inconsistent cutover date: " + variant);
}
history = ChronoHistory.ofFirstGregorianReform();
break;
case SINGLE_CUTOVER_DATE:
PlainDate cutover = getGregorianCutOverDate(parts, variant);
history = ChronoHistory.ofGregorianReform(cutover);
break;
default:
throw new UnsupportedOperationException(hv.name());
}
String[] a = parts[startIndex].split("=");
if (a[0].equals("ancient-julian-leap-years")) {
String ajly = a[1].substring(1, a[1].length() - 1);
if (!ajly.isEmpty()) {
String[] nums = ajly.split(",");
int[] bcYears = new int[nums.length];
for (int i = 0; i < nums.length; i++) {
bcYears[i] = 1 - Integer.parseInt(nums[i]);
}
history = history.with(AncientJulianLeapYears.of(bcYears));
}
}
String[] b = parts[startIndex + 1].split("=");
if (b[0].equals("new-year-strategy")) {
String desc = b[1].substring(1, b[1].length() - 1);
String[] rules = desc.split(",");
NewYearStrategy nys = null;
for (int i = 0; i < rules.length; i++) {
String[] rule = rules[i].split("->");
NewYearRule nyr = NewYearRule.valueOf(rule[0]);
int annoDomini = (rule.length == 2 ? Integer.parseInt(rule[1]) : Integer.MAX_VALUE);
if (nys == null) {
if ((nyr == NewYearRule.BEGIN_OF_JANUARY) && (annoDomini == 567)) {
continue;
}
nys = nyr.until(annoDomini);
} else {
nys = nys.and(nyr.until(annoDomini));
}
}
history = history.with(nys);
}
String[] c = parts[startIndex + 2].split("=");
if (c[0].equals("era-preference")) {
String desc = c[1].substring(1, c[1].length() - 1);
if (!desc.equals("default")) {
String[] prefs = desc.split(",");
try {
HistoricEra era = HistoricEra.valueOf(prefs[0].substring(5));
PlainDate start = Iso8601Format.parseDate(prefs[1].substring(7));
PlainDate end = Iso8601Format.parseDate(prefs[2].substring(5));
switch (era) {
case HISPANIC:
history = history.with(EraPreference.hispanicBetween(start, end));
break;
case BYZANTINE:
history = history.with(EraPreference.byzantineBetween(start, end));
break;
case AB_URBE_CONDITA:
history = history.with(EraPreference.abUrbeConditaBetween(start, end));
break;
default:
throw new IllegalArgumentException("BC/AD not allowed as era preference: " + variant);
}
} catch (ParseException pe) {
throw new IllegalArgumentException("Invalid date syntax: " + variant);
}
}
}
return history;
}
|
Evolution of relation P1(P2) describing saturation decompressions after air hyperbaric expositions.
The basic problem in decompression is the limit of maximum tolerable change of pressure after diving. Due to the number of parameters involved in decompression models (bottom time, ambient pressure, exposition profile, content of breathing mixtures, properties of inert gases) the number of possible solutions is theoretically unlimited. Since the beginning of modern decompression models the starting point has been direct saturation decompression using air. The generally accepted form of solution is the linear relation between tolerable pressure P2 after saturation exposition to pressure P1 described by the equation in the form P1 = P2 x A + B, where A and B are parameters obtained by experiments. Since the introduction of this equation values of parameters have been changing in order to decrease the rate of decompression illness. The aim of this study was to analyse and interpret the trend of those changes. Sixteen published models, including the one developed in our center, were compared and gradual change of parameters was identified. This trend should result in safer decompression systems.
|
package br.com.ernanilima.jmercado.service.impl;
import br.com.ernanilima.jmercado.model.Produto;
import br.com.ernanilima.jmercado.repository.ProdutoRepository;
import br.com.ernanilima.jmercado.service.ProdutoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@Service
public class ProdutoServiceImpl implements ProdutoService {
@Autowired private ProdutoRepository rProduto;
@Override
public Produto gravar(Produto produto) {
return rProduto.save(produto);
}
@Override
public Produto getPorId(int codigo) {
Optional<Produto> model = rProduto.findById(codigo);
return model.orElse(null);
}
@Override
public Produto getPorCodigoBarras(long codigoBarras) {
Optional<Produto> model = rProduto.findByCodigoBarras(codigoBarras);
return model.orElse(null);
}
@Override
public void remover(int codigo) {
try {
getPorId(codigo);
rProduto.deleteById(codigo);
} catch (DataIntegrityViolationException e) {
System.out.println("NAO PODE REMOVER");
}
}
@Override
public void remover(Produto produto) {
try {
rProduto.delete(produto);
} catch (DataIntegrityViolationException e) {
System.out.println("NAO PODE REMOVER");
}
}
@Override
public List<Produto> listarTudo() {
return rProduto.findAll();
}
@Async
@Override
public CompletableFuture<List<Produto>> listarTudoAsinc() {
final List<Produto> list = rProduto.findAll();
return CompletableFuture.completedFuture(list);
}
}
|
/**
* @author <a href="mailto:[email protected]">Johannes Donath</a>
*/
public class LaunchClampBlock extends AbstractBlockEntityBlock<LaunchClampBlockEntity> {
private static final PropertyEnum<Part> PART = PropertyEnum.create("part", Part.class);
private static final PropertyInteger FACING = PropertyInteger.create("facing", 0, 3);
public static final LaunchClampBlock INSTANCE = new LaunchClampBlock();
public static final Item ITEM = new ItemBlock(INSTANCE).setRegistryName(INSTANCE.getRegistryName());
private LaunchClampBlock() {
super(LaunchClampBlockEntity.class, Material.ROCK);
this.setRegistryName(new ResourceLocation(ICBMModification.IDENTIFIER, "launch_clamp"));
this.setUnlocalizedName("doticbm.launch_clamp");
this.setDefaultState(this.blockState.getBaseState().withProperty(PART, Part.BLUEPRINT));
this.setCreativeTab(ICBMCreativeTab.INSTANCE);
}
/**
* {@inheritDoc}
*/
@Override
public boolean canPlaceBlockAt(@Nonnull World worldIn, @Nonnull BlockPos pos) {
IBlockState state = worldIn.getBlockState(pos.offset(EnumFacing.DOWN));
if (state.getBlock() == this) {
return worldIn.getBlockState(pos.offset(EnumFacing.DOWN, 2)).getBlock() == LaunchPadBlock.INSTANCE;
}
return state.getBlock() == LaunchPadBlock.INSTANCE;
}
/**
* {@inheritDoc}
*/
@Nonnull
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, PART, FACING);
}
/**
* {@inheritDoc}
*/
@Nonnull
@Override
@SuppressWarnings("deprecation")
public IBlockState getActualState(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
BlockPos origin = BlockPos.ORIGIN;
switch (state.getValue(PART)) {
case FORMED:
if (world.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock() == this) {
origin = new BlockPos(0, -1, 0);
}
break;
case BLUEPRINT:
case TOP_TE:
case BOTTOM_TE:
return state;
}
int facing = 2;
if (LaunchPadBlock.INSTANCE.isMultiblockCenteredAt(world, pos.add(origin).add(1, -1, -1))) {
facing = 1;
} else if (LaunchPadBlock.INSTANCE.isMultiblockCenteredAt(world, pos.add(origin).add(-1, -1, -1))) {
facing = 0;
} else if (LaunchPadBlock.INSTANCE.isMultiblockCenteredAt(world, pos.add(origin).add(-1, -1, 1))) {
facing = 3;
}
return state.withProperty(FACING, facing);
}
/**
* Retrieves the state used to render the bottom state from within a TE.
*/
@Nonnull
public IBlockState getBottomState(@Nonnull IBlockState base) {
return base.withProperty(PART, Part.BOTTOM_TE);
}
/**
* Retrieves the facing direction of a block.
*/
@Nonnegative
@SideOnly(Side.CLIENT)
public int getFacingByState(@Nonnull IBlockState state) {
return state.getValue(FACING);
}
/**
* {@inheritDoc}
*/
@Override
public int getMetaFromState(@Nonnull IBlockState state) {
return state.getValue(PART).ordinal() ^ (state.getValue(FACING) << 2);
}
/**
* Retrieves the origin offset based on its block state.
*/
@Nonnull
@SideOnly(Side.CLIENT)
public BlockPos getOriginOffsetByState(@Nonnull IBlockState state) {
BlockPos pos = new BlockPos(-1, -1, -1);
switch (this.getFacingByState(state)) {
case 1:
pos = new BlockPos(1, -1, -1);
break;
case 2:
pos = new BlockPos(1, -1, 1);
break;
case 3:
pos = new BlockPos(-1, -1, 1);
break;
}
if (this.getPart(state) == Part.TOP_TE) {
return pos.offset(EnumFacing.DOWN);
}
return pos;
}
/**
* Retrieves the part the state represents.
*/
@Nonnull
public Part getPart(@Nonnull IBlockState state) {
return state.getValue(PART);
}
/**
* {@inheritDoc}
*/
@Nonnull
@Override
@SuppressWarnings("deprecation")
public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) {
Part part = state.getValue(PART);
return (part == Part.BLUEPRINT || part == Part.FORMED ? EnumBlockRenderType.INVISIBLE : EnumBlockRenderType.MODEL);
}
/**
* Retrieves the state used to render the top state from within a TE.
*/
@Nonnull
public IBlockState getTopState(@Nonnull IBlockState base) {
return base.withProperty(PART, Part.TOP_TE);
}
/**
* {@inheritDoc}
*/
@Nonnull
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateFromMeta(int meta) {
int part = meta & 0x3;
Part[] parts = Part.values();
if (part >= parts.length) {
return this.getDefaultState();
}
return this.blockState.getBaseState().withProperty(PART, parts[part]);
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("deprecation")
public boolean isOpaqueCube(IBlockState state) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("deprecation")
public boolean isFullCube(IBlockState state) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public boolean isBlockSolid(IBlockAccess worldIn, @Nonnull BlockPos pos, EnumFacing side) {
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void onBlockPlacedBy(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull EntityLivingBase placer, @Nonnull ItemStack stack) {
if (worldIn.getBlockState(pos.offset(EnumFacing.DOWN)).getBlock() == this) {
worldIn.setBlockState(pos, this.blockState.getBaseState().withProperty(PART, Part.FORMED));
worldIn.setBlockState(pos.offset(EnumFacing.DOWN), this.blockState.getBaseState().withProperty(PART, Part.FORMED));
}
}
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("deprecation")
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
super.neighborChanged(state, worldIn, pos, blockIn);
if (!this.canPlaceBlockAt(worldIn, pos)) {
this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockToAir(pos);
}
}
/**
* Provides a list of possible parts a block instance can represent within the world.
*/
public enum Part implements IStringSerializable {
BLUEPRINT,
FORMED,
BOTTOM_TE,
TOP_TE;
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return this.name().toLowerCase();
}
}
}
|
/* Adds widget if place isn't already taken. */
void QSingleItemSquareLayout::addWidget(QWidget* widget) {
if(!hasItem()) {
replaceItem(new QWidgetItem(widget));
}
}
|
def gene_panels(request, parsed_case):
panels = parsed_case["gene_panels"]
return panels
|
import React from 'react';
import { Button, Box, Text, TextProps, BoxProps, ButtonProps } from 'grommet';
export interface ButtonItemProps extends BoxProps {
text?: string;
textSize?: TextProps['size'];
hoverIndicator?: ButtonProps['hoverIndicator'];
href?: ButtonProps['href'];
onClick?(e: React.MouseEvent): void;
fullWidth?: boolean;
disabled?: boolean;
className?: string;
}
export const PrimaryBtn = ({
text,
direction,
justify,
align,
pad,
margin,
round,
onClick,
href,
textSize,
hoverIndicator,
fullWidth,
disabled,
className,
...props
}: ButtonItemProps) => {
return (
<Button
style={{ width: fullWidth ? '100%' : 'auto' }}
href={href}
onClick={onClick}
hoverIndicator={hoverIndicator || 'false'}
disabled={disabled}
>
<Box
background="clrBoxGradient"
justify={justify || 'center'}
align={align || 'center'}
pad={pad || { vertical: 'xsmall' }}
margin={margin || '0'}
round={round || '3px'}
className={className}
{...props}
>
<Text size={textSize || 'xsmall'}>{text}</Text>
</Box>
</Button>
);
};
|
def add_summary_images(self):
size1 = tf.shape(self.rgb_ph)[1]
size_to_be = tf.cast(size1, tf.int32) - 2*self.displacement
slicing = [0, self.displacement, self.displacement, 0]
sliced_axis = [-1, size_to_be, size_to_be, -1]
crop_input_node = tf.slice(self.rgb_ph, slicing, sliced_axis)
input_s = tf.summary.image("input", crop_input_node, max_outputs=3)
label_s = tf.summary.image("label_dist", self.lbl_ph,
max_outputs=3)
lblint_s = tf.summary.image("label_int", tf.cast(self.lbl_int, tf.float32),
max_outputs=3)
pred_dist = tf.clip_by_value(tf.cast(self.last, tf.float32), 0, 255)
pred_dist_s = tf.summary.image("pred_dist", pred_dist, max_outputs=3)
pred_s = tf.summary.image("pred", tf.cast(self.predictions, tf.float32),
max_outputs=3)
list_s = [input_s, label_s, pred_dist_s, lblint_s, pred_s]
for __s in list_s:
self.additionnal_summaries.append(__s)
self.test_summaries.append(__s)
|
/**
* Load only the position of a given FEN string (or even only the position part of it)
* into a game
*
* @param game - a given game
* @param position - a given FEN position
* @return - true iff the position is valid and was loaded to the game
*/
public static boolean loadPositionToGame(Game game, String position) {
Utils.AssertNotNull(game);
String[] tokens = position.split("\\s+");
position = tokens[0];
LOGGER.fine("loading position '" + position + "'");
int gkind = game.getGameKind();
int grules = game.getGameRules();
String rows[] = position.split("[/\\[\\]]");
if (rows.length < 8) {
LOGGER.info("illegal FEN " + position);
return false;
}
int currentRow = 8;
for (String row : rows) {
if (currentRow == 0) {
{
if ((gkind == Common.GAME_KIND_CRAZY_HOUSE) || (gkind == Common.GAME_KIND_BUG_HOUSE) || (gkind == 0))
{
if (gkind == 0)
{
gkind = Common.GAME_KIND_CRAZY_HOUSE;
grules = Common.GAME_RULES_CRAZY_HOUSE;
game.setGameKind(gkind);
game.setGameRules(grules);
}
boolean xfen = (position.indexOf('[') == -1);
List<Piece> capturedOrDroppableWhite = new ArrayList<Piece>();
List<Piece> capturedOrDroppableBlack = new ArrayList<Piece>();
Piece newPiece;
for (byte pieceB : row.getBytes()) {
char pieceCh = (char) pieceB;
if (pieceCh == '-')
{
break;
}
int color = Common.COLOR_WHITE;
if (Character.isLowerCase(pieceCh)) {
color = Common.COLOR_BLACK;
}
if (game.isCrazyHouse() && (!xfen))
{
color = Common.OtherColor(color);
}
pieceCh = Character.toUpperCase(pieceCh);
Integer type = Notation.getPieceType(String.valueOf(pieceCh));
if ((type == null) || (type == Common.PIECE_TYPE_ILLEGAL)) {
LOGGER.warning("illegal FEN '" + position + "' bad piece '" + pieceCh + "'");
return false;
}
newPiece = Piece.create(type, color);
if (newPiece.isWhite())
{
capturedOrDroppableWhite.add(newPiece);
}
else
{
capturedOrDroppableBlack.add(newPiece);
}
}
if (xfen)
{
game.setCapturedPieces(Common.COLOR_WHITE, capturedOrDroppableWhite);
game.setCapturedPieces(Common.COLOR_BLACK, capturedOrDroppableBlack);
}
else {
if (game.isCrazyHouse())
{
game.setDroppablePieces(Common.COLOR_BLACK, capturedOrDroppableWhite);
game.setDroppablePieces(Common.COLOR_WHITE, capturedOrDroppableBlack);
}
else
{
game.setDroppablePieces(Common.COLOR_WHITE, capturedOrDroppableWhite);
game.setDroppablePieces(Common.COLOR_BLACK, capturedOrDroppableBlack);
}
}
LOGGER.fine("FEN set captured piece white " + capturedOrDroppableWhite + " black " + capturedOrDroppableBlack);
break;
}
LOGGER.warning("bad extra row in FEN gkind " + Common.GAME_KIND_TEXT[gkind]);
return false;
}
}
int column = 1;
Piece newPiece = null;
for (byte pieceB : row.getBytes()) {
char pieceCh = (char) pieceB;
if (pieceCh == '~')
{
newPiece.setPromoted();
continue;
}
if (Character.isDigit(pieceCh)) {
column += (pieceCh - 48);
continue;
}
if (column > 8) {
LOGGER.warning("illegal FEN '" + position + "' bad row '" + row + "'");
return false;
}
int color = Common.COLOR_WHITE;
if (Character.isLowerCase(pieceCh)) {
color = Common.COLOR_BLACK;
}
pieceCh = Character.toUpperCase(pieceCh);
int type = Notation.getPieceType(String.valueOf(pieceCh));
if (type == Common.PIECE_TYPE_ILLEGAL) {
LOGGER.warning("illegal FEN '" + position + "' bad piece '" + pieceCh + "'");
return false;
}
newPiece = Piece.create(type, color);
game.setPieceAt(currentRow, column, newPiece);
column++;
}
if (column != 9) {
LOGGER.warning("illegal FEN '" + position + "' bad row '" + row + "'");
return false;
}
currentRow--;
}
if (currentRow != 0) {
LOGGER.warning("illegal FEN '" + position + "' bad number of rows");
return false;
}
return true;
}
|
package datagenerator.transaction;
import datagenerator.common.columngenerator.Address;
import datagenerator.common.columngenerator.ColumnDataGen;
import datagenerator.common.columngenerator.DateTime;
import datagenerator.common.columngenerator.DateYYYYMMDD;
import datagenerator.common.columngenerator.EnumValue;
import datagenerator.common.columngenerator.IdentityCard;
import datagenerator.common.columngenerator.Name;
import datagenerator.common.columngenerator.PhoneNumber;
import datagenerator.common.columngenerator.RandomInt;
import datagenerator.common.columngenerator.RandomNumber;
import datagenerator.common.tablegenerator.AbstractTableDataGen;
import java.io.IOException;
public class PUB_CUST_BASE_INFO extends AbstractTableDataGen {
StringBuffer sb = new StringBuffer();
private ColumnDataGen cust_isn;
private ColumnDataGen cust_id;
private ColumnDataGen cust_files_id;
private ColumnDataGen cust_nam;
private ColumnDataGen cust_cate;
private ColumnDataGen ctc_tel;
private ColumnDataGen address;
private ColumnDataGen zip;
private ColumnDataGen crd_grd;
private ColumnDataGen cust_sts;
private ColumnDataGen cust_flg;
private ColumnDataGen ltc_cust_update_flg;
private ColumnDataGen buopstaf;
private ColumnDataGen budidate;
private DateTime butsstam;
private ColumnDataGen boidbrno;
private ColumnDataGen addr_adm_district;
private ColumnDataGen work;
private ColumnDataGen bel_to_idy;
private ColumnDataGen reg_cap;
public void init() {
super.init();
String[] reg_cap1 = { "", "0" };
String[] crd_grd1 = { "1", "2", "3", "4" };
String[] cust_sts1 = { "", "1" };
String[] cust_flg1 = { "1", "2" };
String[] ltc_cust_update_flg1 = { "0", "1" };
this.cust_isn = (ColumnDataGen)new RandomNumber("cust_isn", 8);
this.cust_id = (ColumnDataGen)new IdentityCard("cust_id", "19700101", "19800101");
this.cust_nam = (ColumnDataGen)new Name("cust_nam");
this.ctc_tel = (ColumnDataGen)new PhoneNumber("ctc_tel");
this.address = (ColumnDataGen)new Address("address");
this.zip = (ColumnDataGen)new RandomNumber("zip", 6);
this.crd_grd = (ColumnDataGen)new EnumValue("crd_grd", crd_grd1);
this.cust_sts = (ColumnDataGen)new EnumValue("cust_sts", cust_sts1);
this.cust_flg = (ColumnDataGen)new EnumValue("cust_flg", cust_flg1);
this.ltc_cust_update_flg = (ColumnDataGen)new EnumValue("ltc_cust_update_flg", ltc_cust_update_flg1);
this.buopstaf = (ColumnDataGen)new RandomNumber("buopstaf", 4);
this.budidate = (ColumnDataGen)new DateYYYYMMDD("budidate");
this.butsstam = new DateTime("butsstam");
this.boidbrno = (ColumnDataGen)new RandomNumber("boidbrno", 6);
this.addr_adm_district = (ColumnDataGen)new RandomNumber("addr_adm_district", 9);
this.work = (ColumnDataGen)new RandomInt("work", 10, 1000);
this.bel_to_idy = (ColumnDataGen)new RandomInt("bel_to_idy", 10, 100);
this.reg_cap = (ColumnDataGen)new EnumValue("reg_cap", reg_cap1);
}
public String nextRecord() {
String date1 = this.budidate.getColumnData();
int date2 = Integer.parseInt(date1) + (int)(Math.random() * 2.0D + 1.0D) * 10000;
int date3 = date2 + (int)(Math.random() * 2.0D + 1.0D) * 10000;
String no1 = this.boidbrno.getColumnData();
String bm1 = no1.substring(0, 3);
String no2 = this.boidbrno.getColumnData();
String bm2 = no2.substring(0, 3);
String id = this.cust_id.getColumnData();
String phone = this.ctc_tel.getColumnData();
this.sb.setLength(0);
this.sb.append("810" + this.cust_isn.getColumnData() + ",");
this.sb.append(id + ",");
this.sb.append(id + ",");
this.sb.append(this.cust_nam.getColumnData() + ",");
this.sb.append(",");
this.sb.append(",");
this.sb.append("1,");
this.sb.append("156,");
this.sb.append(this.cust_nam.getColumnData() + ",");
this.sb.append(phone + ",");
this.sb.append("1,");
this.sb.append(phone + ",");
this.sb.append("2,");
this.sb.append(this.address.getColumnData() + ",");
this.sb.append("1,");
this.sb.append(this.zip.getColumnData() + ",");
this.sb.append(this.crd_grd.getColumnData() + ",");
this.sb.append(this.cust_sts.getColumnData() + ",");
this.sb.append(this.cust_flg.getColumnData() + ",");
this.sb.append(this.ltc_cust_update_flg.getColumnData() + ",");
this.sb.append(",");
this.sb.append(",");
this.sb.append(",");
this.sb.append(",");
this.sb.append(this.butsstam.getDateTimefromYYYYMMDD(date1) + ",");
this.sb.append(bm1 + this.buopstaf.getColumnData() + ",");
this.sb.append(bm1 + this.buopstaf.getColumnData() + ",");
this.sb.append(no1 + ",");
this.sb.append(this.butsstam.getDateTimefromYYYYMMDD(date2 + "") + ",");
this.sb.append(bm2 + this.buopstaf.getColumnData() + ",");
this.sb.append(no2 + ",");
this.sb.append("0,");
this.sb.append(",");
this.sb.append(",");
this.sb.append(this.cust_flg.getColumnData() + ",");
this.sb.append(this.work.getColumnData() + ",");
this.sb.append(",");
this.sb.append(this.reg_cap.getColumnData() + ",");
this.sb.append(this.bel_to_idy.getColumnData() + ",");
this.sb.append(",");
this.sb.append(date3 + ",");
this.sb.append("0");
return this.sb.toString();
}
public String getTableName() {
return super.getTableName();
}
public PUB_CUST_BASE_INFO(String tableName) {
super(tableName);
}
public void generateData(String path, int nums) throws IOException {
int recordNums = Integer.valueOf(nums).intValue();
HDFS_Out o = new HDFS_Out(String.valueOf("/tmp/data/XDZX/PUB_CUST_BASE_INFO/PUB_CUST_BASE_INFO.txt"));
PUB_CUST_BASE_INFO report = new PUB_CUST_BASE_INFO("transaction");
report.init();
int nBacthCount = 200000;
StringBuffer records = new StringBuffer();
records.append(report.nextRecord());
for (int i = 1; i < recordNums; i++) {
if (i % nBacthCount == 0) {
o.writeToHdfs(records);
records.setLength(0);
records.append(report.nextRecord());
} else {
records.append("\n" + report.nextRecord());
}
}
o.writeToHdfs(records);
o.close();
}
}
|
<reponame>natemoo-re/bundle<gh_stars>0
import { CDN_NAMESPACE } from './cdn';
import path from 'path';
import type { Plugin } from 'esbuild';
export const HOST = 'https://cdn.skypack.dev/';
export const BARE = (): Plugin => {
return {
name: 'bare',
setup(build) {
build.onResolve({ filter: /.*/ }, (args) => {
if (/^(?!\.).*/.test(args.path) && !path.isAbsolute(args.path)) {
let argPath = args.path.replace(/^(skypack|esm|esm\.sh|unpkg|jsdelivr|esm\.run)\:/, "");
let host = HOST;
if (/^skypack\:/.test(args.path)) {
host = `https://cdn.skypack.dev/`;
} else if (/^(esm\.sh|esm)\:/.test(args.path)) {
host = `https://cdn.esm.sh/`;
} else if (/^unpkg\:/.test(args.path)) {
host = `https://unpkg.com/`;
} else if (/^(jsdelivr|esm\.run)\:/.test(args.path)) {
host = `https://cdn.jsdelivr.net/npm/`;
}
// typescript will only work on esm.sh
else if (/^typecript/.test(args.path)) {
host = `https://cdn.esm.sh/`;
}
return {
path: argPath,
namespace: CDN_NAMESPACE,
pluginData: {
parentUrl: host,
},
};
}
});
},
};
};
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
public class Main {
public static void main(String[] args) throws IOException {
//??????
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str;
while ((str = br.readLine()) != null){
String[] num = str.split(" ", 0);
//?????°?¨????
BigDecimal d = new BigDecimal(num[3]);
BigDecimal e = new BigDecimal(num[4]);
BigDecimal f = new BigDecimal(num[5]);
//?¨????
BigDecimal ce = new BigDecimal(num[2]);
ce = ce.multiply(e);
BigDecimal bf = new BigDecimal(num[1]);
bf = bf.multiply(f);
BigDecimal ae = new BigDecimal(num[0]);
ae = ae.multiply(e);
BigDecimal bd = new BigDecimal(num[1]);
bd = bd.multiply(d);
BigDecimal cd = new BigDecimal(num[2]);
cd = cd.multiply(d);
BigDecimal af = new BigDecimal(num[0]);
af = af.multiply(f);
BigDecimal x_numer = new BigDecimal(ce.toPlainString());
x_numer = x_numer.subtract(bf);
BigDecimal x_denom = new BigDecimal(ae.toPlainString());
x_denom = x_denom.subtract(bd);
BigDecimal x = new BigDecimal("0.000");
x = x.add(x_numer);
x = x.divide(x_denom, 3, BigDecimal.ROUND_HALF_UP);
BigDecimal y_numer = new BigDecimal(cd.toPlainString());
y_numer = y_numer.subtract(af);
BigDecimal y_denom = new BigDecimal(bd.toPlainString());
y_denom = y_denom.subtract(ae);
BigDecimal y = new BigDecimal("0.000");
y = y.add(y_numer);
y = y.divide(y_denom, 3, BigDecimal.ROUND_HALF_UP);
//??????
System.out.println(x + " " + y);
}
}
}
|
/**
* Created by jainpj on 18/02/17.
*/
public class Elevator {
private double position; //
public String elevatorID;
private int direction;
private int waitingFor; //
public int capacity; //input
private List<Passenger> onboardedPassengerList;
private List<Floor> floorsGoToList;
public List<Floor> getFloorsGoToList() {
return floorsGoToList;
}
public void setFloorsGoToList(final List<Floor> floorsGoToList) {
this.floorsGoToList = floorsGoToList;
}
public String getElevatorID() {
return elevatorID;
}
public void setElevatorID(String elevatorID) {
this.elevatorID = elevatorID;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public Elevator(double position) {
onboardedPassengerList = new ArrayList<>();
floorsGoToList = new ArrayList<>() ; // TODO: Not sure right place
this.position = position;
this.waitingFor = -1;
}
public List<Passenger> getOnboardedPassengerList() {
return this.onboardedPassengerList;
}
public void setOnboardedPassengerList(final List<Passenger> onboardedPassengerList) {
this.onboardedPassengerList = onboardedPassengerList;
}
public double getPosition() {
return position;
}
public void setPosition(final double position) {
this.position = position;
}
public int getDirection() {
return direction;
}
public void setDirection(final int direction) {
this.direction = direction;
}
public int getWaitingFor() {
return waitingFor;
}
public void setWaitingFor(final int waitingFor) {
this.waitingFor = waitingFor;
}
@Override
public String toString() {
return elevatorID;
}
}
|
/**
* Called when the underlying continuation is closed. Gives operations a chance to cleanup whatever
* resources may be on the other end of an open stream. Also invoked when an underlying ServerConnection
* is closed associated with the stream/continuation
*/
@Override
protected void onStreamClosed() {
LOGGER.info(String.format("%s operation onStreamClosed()",
operationModelContext.getOperationName()));
}
|
def preprocess_halo_catalog(self, halocat):
try:
assert "halo_upid" in list(halocat.halo_table.keys())
except AssertionError:
raise HalotoolsError(missing_halo_upid_msg)
halo_table, subhalo_table = SampleSelector.host_halo_selection(
table=halocat.halo_table, return_subhalos=True
)
cutoff_mvir = self.Num_ptcl_requirement * self.particle_mass
mass_cut = halo_table[self.halo_mass_column_key] > cutoff_mvir
max_column_value = np.max(halo_table[self.halo_mass_column_key])
halo_table = halo_table[mass_cut]
if len(halo_table) == 0:
msg = (
"During the pre-processing phase of HOD mock-making \n"
"controlled by the `preprocess_halo_catalog` method of the HodMockFactory,\n"
"a cut on halo completeness is made. The column used in this cut\n"
"is determined by the value of the halo_mass_column_key string \n"
"passed to the HodMockFactory constructor, which in this case was ``%s``.\n"
"The largest value of this column in the uncut catalog is %.2e.\n"
"Your mass cut of M > %.2e resulted in zero halos in the halo catalog;\n"
"for reference, your halo catalog has a particle mass of m_p = %.2e.\n"
"Such a cut is not permissible. \nThis could indicate a problem in "
"the processing of the halo catalog,\n"
"for example, an incorrect column number and/or dtype.\n"
"Alternatively, the value of Num_ptcl_requirement = %.2e \n"
"that was passed to the HodMockFactory constructor could be the problem.\n"
)
raise HalotoolsError(
msg
% (
self.halo_mass_column_key,
max_column_value,
cutoff_mvir,
self.particle_mass,
self.Num_ptcl_requirement,
)
)
for component_model in self.model.model_dictionary.values():
try:
f = getattr(component_model, "preprocess_subhalo_table")
halo_table, self.subhalo_table = f(halo_table, subhalo_table)
except AttributeError:
pass
try:
d = self.model.new_haloprop_func_dict
for new_haloprop_key, new_haloprop_func in d.items():
halo_table[new_haloprop_key] = new_haloprop_func(table=halo_table)
self.additional_haloprops.append(new_haloprop_key)
except AttributeError:
pass
self._orig_halo_table = Table()
for key in self.additional_haloprops:
try:
self._orig_halo_table[key] = halo_table[key][:]
except KeyError:
raise HalotoolsError(unavailable_haloprop_msg % key)
self.model.build_lookup_tables()
|
<filename>bugsnag-android-core/src/test/java/com/bugsnag/android/LastRunInfoApiTest.java
package com.bugsnag.android;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class LastRunInfoApiTest {
/**
* Verifies the LastRunInfo class contains the expected methods and hasn't broken
* its API contract.
*/
@Test
public void testLastRunInfo() {
LastRunInfo lastRunInfo = new LastRunInfo(5, true, false);
assertEquals(5, lastRunInfo.getConsecutiveLaunchCrashes());
assertTrue(lastRunInfo.getCrashed());
assertFalse(lastRunInfo.getCrashedDuringLaunch());
}
}
|
import { DbxButtonDirective, DbxButtonInterceptor } from '@dereekb/dbx-core';
import { Directive, Host, OnInit } from '@angular/core';
import { Observable, map } from 'rxjs';
import { DbxPromptConfirm } from './prompt.confirm';
/**
* Directive that binds together a confirm dialog with the button.
*/
@Directive({
selector: '[dbxPromptConfirmButton]'
})
export class DbxPromptConfirmButtonDirective implements OnInit, DbxButtonInterceptor {
readonly interceptButtonClick: () => Observable<boolean> = () => {
return this.prompt.showDialog().pipe(map((x) => Boolean(x)));
};
constructor(@Host() readonly appButton: DbxButtonDirective, @Host() readonly prompt: DbxPromptConfirm) {}
ngOnInit(): void {
this.appButton.setButtonInterceptor(this);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.