code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
---|---|
public static <T extends Date>String dateTimeFrom(T dateTime){
checkNotNull(dateTime);
return dateTimeFrom(new DateTime(dateTime));
}
| -->2014-9-2 03:00:00 |
public StringBuilder format(final StringBuilder sb,final float w){
final int initPosition=sb.length();
if (Float.isNaN(w)) {
sb.append("NaN");
}
else if (Float.isInfinite(w)) {
sb.append(w < 0.0 ? "-Infinity" : "Infinity");
}
else {
sb.append(mLocalFormat.format(w));
}
final int currLength=sb.length() - initPosition;
if (currLength == mLength) {
return sb;
}
if (currLength > mLength) {
sb.insert(initPosition,'#');
sb.append('#');
}
else {
sb.insert(initPosition,mPadding,0,mLength - currLength);
assert sb.length() - initPosition == mLength;
}
return sb;
}
| Format float into StringBuilder |
private void writeQName(javax.xml.namespace.QName qname,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI=qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix=xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix=generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix,namespaceURI);
xmlWriter.setPrefix(prefix,namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
| method to handle Qnames |
private void openCategorySelection(){
CategorySelectionDialogFragment categorySelectionDialogFragment=CategorySelectionDialogFragment.newInstance(categories);
categorySelectionDialogFragment.show(getChildFragmentManager(),"CategorySelectionDialogFragment");
}
| Creates and shows the category selection dialog fragment. |
private TaskList pauseMirrors(URI id,String sync,URI copyID){
Volume sourceVolume=queryVolumeResource(id);
ArgValidator.checkEntity(sourceVolume,id,true);
StringSet mirrors=sourceVolume.getMirrors();
if (mirrors == null || mirrors.isEmpty()) {
throw APIException.badRequests.invalidParameterVolumeHasNoContinuousCopies(sourceVolume.getId());
}
ArrayList<BlockMirror> mirrorList=null;
if (copyID != null) {
BlockMirror mirror=queryMirror(copyID);
ArgValidator.checkEntity(mirror,copyID,true);
if (!mirror.getSource().getURI().equals(id)) {
throw APIException.badRequests.invalidParameterBlockCopyDoesNotBelongToVolume(copyID,id);
}
else {
mirrorList=new ArrayList();
mirrorList.add(mirror);
}
}
if (sync != null) {
ArgValidator.checkFieldValueFromArrayIgnoreCase(sync,ProtectionOp.SYNC.getRestOp(),TRUE_STR,FALSE_STR);
}
Boolean syncParam=Boolean.parseBoolean(sync);
String task=UUID.randomUUID().toString();
StorageSystem device=_dbClient.queryObject(StorageSystem.class,sourceVolume.getStorageController());
BlockServiceApi blockServiceApi=getBlockServiceImpl("mirror");
auditOp(OperationTypeEnum.FRACTURE_VOLUME_MIRROR,true,AuditLogManager.AUDITOP_BEGIN,mirrorList == null ? mirrors : mirrorList,sync);
return blockServiceApi.pauseNativeContinuousCopies(device,sourceVolume,mirrorList,syncParam,task);
}
| Pause the specified mirror(s) for the source volume |
public static int indexOf(boolean[] array,boolean[] sub){
return indexOf(array,sub,0,array.length);
}
| Finds the first occurrence in an array. |
public static void addCmdDirToPathEnv(Path cmdExePath,ProcessBuilder pb){
Location cmdLoc=Location.createValidOrNull(cmdExePath);
if (cmdLoc == null) {
return;
}
cmdLoc=cmdLoc.getParent();
if (cmdLoc == null) {
return;
}
addLocationToPathEnv(cmdLoc,pb);
}
| Add the parent directory of given cmdExePath to the PATH. This helps workaround certain tool issues on some OSes like OS X. See for example: https://github.com/GoClipse/goclipse/issues/91#issuecomment-82555504 or: https://github.com/RustDT/RustDT/issues/31 |
public boolean replaceIn(final StringBuffer source){
if (source == null) {
return false;
}
return replaceIn(source,0,source.length());
}
| Replaces all the occurrences of variables within the given source buffer with their matching values from the resolver. The buffer is updated with the result. |
ClientResponse put(URI uri,String body){
return setResourceHeaders(_client.resource(uri)).type(MediaType.TEXT_XML).put(ClientResponse.class,body);
}
| PUT to the resource at the passed URI. |
public static String inflate(String name){
return inflate(name,gPrefix);
}
| Inflate a short name into a full GData URI using gPrefix (ending in "#"). Names that already look like URIs are left alone. For example, "foo" becomes "http://schemas.google.com/g/2005#foo". |
public CProjectViewGenerator(final SQLProvider provider,final INaviProject project){
m_provider=Preconditions.checkNotNull(provider,"IE00272: provider argument can not be null");
m_project=Preconditions.checkNotNull(project,"IE00452: project argument can not be null");
}
| Creates a new generator object. |
public Vset checkAssignOp(Environment env,Context ctx,Vset vset,Hashtable exp,Expression outside){
vset=right.checkAssignOp(env,ctx,vset,exp,outside);
type=right.type;
return vset;
}
| Check the expression if it appears as an lvalue. We just pass it on to our unparenthesized subexpression. (Part of fix for 4090372) |
private void initializeInDir(int x,int y,int dir){
initializeHex(Coords.xInDir(x,y,dir),Coords.yInDir(x,y,dir));
}
| Initializes a hex in a specific direction from an origin hex |
private PhysicalNAS findPhysicalNasByNativeId(final StorageSystem system,DbClient dbClient,String nativeId){
URIQueryResultList results=new URIQueryResultList();
PhysicalNAS physicalNas=null;
String nasNativeGuid=NativeGUIDGenerator.generateNativeGuid(system,nativeId,NativeGUIDGenerator.PHYSICAL_NAS);
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getPhysicalNasByNativeGuidConstraint(nasNativeGuid),results);
Iterator<URI> iter=results.iterator();
while (iter.hasNext()) {
PhysicalNAS tmpNas=dbClient.queryObject(PhysicalNAS.class,iter.next());
if (tmpNas != null && !tmpNas.getInactive()) {
physicalNas=tmpNas;
_logger.info("found physical NAS {}",physicalNas.getNativeGuid() + ":" + physicalNas.getNasName());
break;
}
}
return physicalNas;
}
| find DM or NAS from db using native id |
@Override public void scan(InH3Amp in,PathH3Amp path,Object[] values){
int ch=read();
switch (ch) {
case 0xd0:
readDefinition(in);
scan(in,path,values);
return;
case 0xd1:
case 0xd2:
case 0xd3:
case 0xd4:
case 0xd5:
case 0xd6:
case 0xd7:
case 0xd8:
case 0xd9:
case 0xda:
case 0xdb:
case 0xdc:
case 0xdd:
case 0xde:
case 0xdf:
{
int id=ch - 0xd0;
in.serializer(id).scan(this,path,in,values);
return;
}
case 0xe0:
case 0xe1:
case 0xe2:
case 0xe3:
case 0xe4:
case 0xe5:
case 0xe6:
case 0xe7:
case 0xe8:
case 0xe9:
case 0xea:
case 0xeb:
case 0xec:
case 0xed:
case 0xee:
case 0xef:
{
int id=(int)readLong(ch - 0xe0,4);
in.serializer(id).scan(this,path,in,values);
return;
}
default :
throw error(L.l("Unexpected opcode 0x{0} while scanning for {1}",Integer.toHexString(ch),path));
}
}
| Scan for a query. |
private ServerUpdateInfo readServerUpdateInfoFromFile(Context context){
String uniqueServerId=getServerUniqueId();
Object serializedServerInfoObject=SerializableManager.readSerializedObject(context,SERIALIZE_UPDATE_FILE_PREFIX + uniqueServerId + SERIALIZE_CONFIG_FILE_EXTENSION);
if (serializedServerInfoObject != null && serializedServerInfoObject instanceof ServerUpdateInfo) {
return (ServerUpdateInfo)serializedServerInfoObject;
}
else return null;
}
| Reads this server update info from a file |
@Override public long skip(long byteCount){
Preconditions.checkArgument(byteCount >= 0);
int skipped=Math.min((int)byteCount,available());
mOffset+=skipped;
return skipped;
}
| Skips byteCount (or however many bytes are available) bytes in the stream |
public static String unescapeMySQLString(String s) throws IllegalArgumentException {
char chars[]=s.toCharArray();
if (chars.length < 2 || chars[0] != chars[chars.length - 1] || (chars[0] != '\'' && chars[0] != '"')) {
throw new IllegalArgumentException("not a valid MySQL string: " + s);
}
int j=1;
int f=0;
for (int i=1; i < chars.length - 1; i++) {
if (f == 0) {
if (chars[i] == '\\') {
f=1;
}
else if (chars[i] == chars[0]) {
f=2;
}
else {
chars[j++]=chars[i];
}
}
else if (f == 1) {
switch (chars[i]) {
case '0':
chars[j++]='\0';
break;
case '\'':
chars[j++]='\'';
break;
case '"':
chars[j++]='"';
break;
case 'b':
chars[j++]='\b';
break;
case 'n':
chars[j++]='\n';
break;
case 'r':
chars[j++]='\r';
break;
case 't':
chars[j++]='\t';
break;
case 'z':
chars[j++]='\032';
break;
case '\\':
chars[j++]='\\';
break;
default :
chars[j++]=chars[i];
break;
}
f=0;
}
else {
if (chars[i] != chars[0]) {
throw new IllegalArgumentException("not a valid MySQL string: " + s);
}
chars[j++]=chars[0];
f=0;
}
}
if (f != 0) {
throw new IllegalArgumentException("not a valid MySQL string: " + s);
}
return new String(chars,1,j - 1);
}
| Unescape any MySQL escape sequences. See MySQL language reference Chapter 6 at <a href="http://www.mysql.com/doc/">http://www.mysql.com/doc/</a>. This function will <strong>not</strong> work for other SQL-like dialects. |
@Override public void execute(StepInstance stepInstance,String temporaryFileDirectory){
delayForNfs();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Running Parser HMMER2 Output Step for proteins " + stepInstance.getBottomProtein() + " to "+ stepInstance.getTopProtein());
}
InputStream is=null;
try {
final String hmmerOutputFilePath=stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory,hmmerOutputFilePathTemplate);
is=new FileInputStream(hmmerOutputFilePath);
final Set<RawProtein<T>> parsedResults=parser.parse(is);
rawMatchDAO.insertProteinMatches(parsedResults);
}
catch ( IOException e) {
throw new IllegalStateException("IOException thrown when attempting to read " + hmmerOutputFilePathTemplate,e);
}
finally {
if (is != null) {
try {
is.close();
}
catch ( IOException e) {
LOGGER.error("Duh - parsed OK, but can't close the input stream?",e);
}
}
}
}
| This method is called to execute the action that the StepInstance must perform. |
public static ImmutableList<Statement> siteLink(String entityId,String link,String language,boolean outOfOrder){
if (outOfOrder) {
return ImmutableList.of(statement(link,SchemaDotOrg.IN_LANGUAGE,new LiteralImpl(language)),statement(link,SchemaDotOrg.ABOUT,entityId),statement(link,RDF.TYPE,SchemaDotOrg.ARTICLE));
}
return ImmutableList.of(statement(link,RDF.TYPE,SchemaDotOrg.ARTICLE),statement(link,SchemaDotOrg.ABOUT,entityId),statement(link,SchemaDotOrg.IN_LANGUAGE,new LiteralImpl(language)));
}
| Build the statements describing a sitelink. |
private IDocument acquireDocument(final IProgressMonitor monitor) throws CoreException {
if (fCount > 0) return fBuffer.getDocument();
final ITextFileBufferManager manager=FileBuffers.getTextFileBufferManager();
final IPath path=fFile.getFullPath();
manager.connect(path,LocationKind.IFILE,monitor);
fCount++;
fBuffer=manager.getTextFileBuffer(path,LocationKind.IFILE);
final IDocument document=fBuffer.getDocument();
fContentStamp=ContentStamps.get(fFile,document);
return document;
}
| Acquires a document from the file buffer manager. |
public BOSHPacketReader(BOSHConnection connection){
this.connection=connection;
}
| Create a packet reader which listen on a BOSHConnection for received HTTP responses, parse the packets and notifies the connection. |
private double[] calculateValues(Function function,double[][] points){
double values[]=new double[points.length];
for (int i=0; i < points.length; i++) {
values[i]=function.valueAt(points[i]);
}
return values;
}
| Calculate the values of function at points |
public boolean equalsStatusCode(StatusCode statusCode){
return isStatusCode(statusCode.getValue());
}
| Check if the status codes equal to severity and subcode, ignoring the lowest bits of the code. |
protected int dismissPermissionRationale(){
if (rationaleView != null && rationaleView.getVisibility() == View.VISIBLE) {
rationaleView.setVisibility(View.GONE);
return (int)rationaleView.getTag();
}
return 0;
}
| Dismiss and returns the action associated to the rationale |
private static String toFieldName(String node){
return node.toUpperCase().replaceAll("-","_");
}
| Translate a node to a java field name |
public void ensureStartedAndUpdateRegisteredTypes(){
mStarted=true;
ensureGcmIsInitialized();
mEnableSessionInvalidationsTimer.resume();
HashSet<Integer> typesToRegister=new HashSet<Integer>();
typesToRegister.addAll(ProfileSyncService.get().getPreferredDataTypes());
if (!mSessionInvalidationsEnabled) {
typesToRegister.remove(ModelType.SESSIONS);
typesToRegister.remove(ModelType.FAVICON_TRACKING);
typesToRegister.remove(ModelType.FAVICON_IMAGES);
}
Intent registerIntent=InvalidationIntentProtocol.createRegisterIntent(ChromeSigninController.get(mContext).getSignedInUser(),typesToRegister);
registerIntent.setClass(mContext,InvalidationClientService.class);
mContext.startService(registerIntent);
}
| Updates the sync invalidation types that the client is registered for based on the preferred sync types. Starts the client if needed. |
public void testMovePointRightException(){
String a="12312124789874829887348723648726347429808779810457634781384756794987";
int aScale=Integer.MAX_VALUE;
int shift=-18;
BigDecimal aNumber=new BigDecimal(new BigInteger(a),aScale);
try {
aNumber.movePointRight(shift);
fail("ArithmeticException has not been caught");
}
catch ( ArithmeticException e) {
}
}
| Move the decimal point to the right when the scale overflows |
private void validate(){
if (values != null) return;
values=new Values();
final AppContext ctx=AppContext.getAppContext();
Map<String,TreeMap<String,Object>> compiledDefaults=(Map<String,TreeMap<String,Object>>)ctx.get("SeaGlassStyle.defaults");
if (compiledDefaults == null) {
compiledDefaults=new HashMap<String,TreeMap<String,Object>>();
compileDefaults(compiledDefaults,UIManager.getDefaults());
UIDefaults lafDefaults=UIManager.getLookAndFeelDefaults();
compileDefaults(compiledDefaults,lafDefaults);
PropertyChangeListener pcl=(PropertyChangeListener)ctx.get("SeaGlassStyle.defaults.pcl");
if (pcl == null) {
pcl=new DefaultsListener();
UIManager.getDefaults().addPropertyChangeListener(pcl);
UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl);
ctx.put("SeaGlassStyle.defaults.pcl",pcl);
}
ctx.put("SeaGlassStyle.defaults",compiledDefaults);
}
TreeMap<String,Object> defaults=compiledDefaults.get(prefix);
if (defaults == null) {
defaults=new TreeMap<String,Object>();
}
if (component != null) {
Object o=component.getClientProperty("SeaGlass.Overrides");
if (o instanceof UIDefaults) {
Object i=component.getClientProperty("SeaGlass.Overrides.InheritDefaults");
boolean inherit=i instanceof Boolean ? (Boolean)i : true;
UIDefaults d=(UIDefaults)o;
TreeMap<String,Object> map=new TreeMap<String,Object>();
for ( Object obj : d.keySet()) {
if (obj instanceof String) {
String key=(String)obj;
if (key.startsWith(prefix)) {
map.put(key,d.get(key));
}
}
}
if (inherit) {
defaults.putAll(map);
}
else {
defaults=map;
}
}
}
init(values,defaults);
}
| Pulls data out of UIDefaults, if it has not done so already, and sets up the internal state. |
public static double[][] randomUniform(int m,int n,double min,double max){
double[][] A=new double[m][n];
for (int i=0; i < A.length; i++) for (int j=0; j < A[i].length; j++) A[i][j]=Random.uniform(min,max);
return A;
}
| Create an m x n matrix of uniformly distributed random numbers between two bounds. |
@Override public int hashCode(){
final int prime=31;
int result=1;
result=prime * result + count;
result=prime * result + offsetValue;
result=prime * result + tag;
result=prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
| Returns the calculated hash code for this object. |
protected String doIt() throws java.lang.Exception {
StringBuffer sql=null;
int no=0;
String clientCheck=getWhereClause();
if (m_deleteOldImported) {
sql=new StringBuffer("DELETE I_BPartner " + "WHERE I_IsImported='Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Delete Old Impored =" + no);
}
sql=new StringBuffer("UPDATE I_BPartner " + "SET AD_Client_ID = COALESCE (AD_Client_ID, ").append(m_AD_Client_ID).append(")," + " AD_Org_ID = COALESCE (AD_Org_ID, 0)," + " IsActive = COALESCE (IsActive, 'Y'),"+ " Created = COALESCE (Created, SysDate),"+ " CreatedBy = COALESCE (CreatedBy, 0),"+ " Updated = COALESCE (Updated, SysDate),"+ " UpdatedBy = COALESCE (UpdatedBy, 0),"+ " I_ErrorMsg = ' ',"+ " I_IsImported = 'N' "+ "WHERE I_IsImported<>'Y' OR I_IsImported IS NULL");
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Reset=" + no);
ModelValidationEngine.get().fireImportValidate(this,null,null,ImportValidator.TIMING_BEFORE_VALIDATE);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'" + " AND g.AD_Client_ID=i.AD_Client_ID) ");
sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL" + " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Group Default=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET C_BP_Group_ID=(SELECT C_BP_Group_ID FROM C_BP_Group g" + " WHERE i.GroupValue=g.Value AND g.AD_Client_ID=i.AD_Client_ID) "+ "WHERE C_BP_Group_ID IS NULL"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Group=" + no);
sql=new StringBuffer("UPDATE I_BPartner " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Group, ' " + "WHERE C_BP_Group_ID IS NULL"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.config("Invalid Group=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET C_Country_ID=(SELECT C_Country_ID FROM C_Country c" + " WHERE i.CountryCode=c.CountryCode AND c.AD_Client_ID IN (0, i.AD_Client_ID)) "+ "WHERE C_Country_ID IS NULL"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Country=" + no);
sql=new StringBuffer("UPDATE I_BPartner " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Country, ' " + "WHERE C_Country_ID IS NULL AND (City IS NOT NULL OR Address1 IS NOT NULL)"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.config("Invalid Country=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "Set RegionName=(SELECT MAX(Name) FROM C_Region r" + " WHERE r.IsDefault='Y' AND r.C_Country_ID=i.C_Country_ID"+ " AND r.AD_Client_ID IN (0, i.AD_Client_ID)) ");
sql.append("WHERE RegionName IS NULL AND C_Region_ID IS NULL" + " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Region Default=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "Set C_Region_ID=(SELECT C_Region_ID FROM C_Region r" + " WHERE r.Name=i.RegionName AND r.C_Country_ID=i.C_Country_ID"+ " AND r.AD_Client_ID IN (0, i.AD_Client_ID)) "+ "WHERE C_Region_ID IS NULL"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Region=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Region, ' " + "WHERE C_Region_ID IS NULL "+ " AND EXISTS (SELECT * FROM C_Country c"+ " WHERE c.C_Country_ID=i.C_Country_ID AND c.HasRegion='Y')"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.config("Invalid Region=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET C_Greeting_ID=(SELECT C_Greeting_ID FROM C_Greeting g" + " WHERE i.BPContactGreeting=g.Name AND g.AD_Client_ID IN (0, i.AD_Client_ID)) "+ "WHERE C_Greeting_ID IS NULL AND BPContactGreeting IS NOT NULL"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Greeting=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid Greeting, ' " + "WHERE C_Greeting_ID IS NULL AND BPContactGreeting IS NOT NULL"+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.config("Invalid Greeting=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET C_BPartner_ID=" + "(SELECT C_BPartner_ID FROM AD_User u "+ "WHERE i.EMail=u.EMail AND u.AD_Client_ID=i.AD_Client_ID) "+ "WHERE i.EMail IS NOT NULL AND I_IsImported='N'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Found EMail User=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET AD_User_ID=" + "(SELECT AD_User_ID FROM AD_User u "+ "WHERE i.EMail=u.EMail AND u.AD_Client_ID=i.AD_Client_ID) "+ "WHERE i.EMail IS NOT NULL AND I_IsImported='N'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Found EMail User=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET C_BPartner_ID=(SELECT C_BPartner_ID FROM C_BPartner p" + " WHERE i.Value=p.Value AND p.AD_Client_ID=i.AD_Client_ID) "+ "WHERE C_BPartner_ID IS NULL AND Value IS NOT NULL"+ " AND I_IsImported='N'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Found BPartner=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET AD_User_ID=(SELECT AD_User_ID FROM AD_User c" + " WHERE i.ContactName=c.Name AND i.C_BPartner_ID=c.C_BPartner_ID AND c.AD_Client_ID=i.AD_Client_ID) "+ "WHERE C_BPartner_ID IS NOT NULL AND AD_User_ID IS NULL AND ContactName IS NOT NULL"+ " AND I_IsImported='N'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Found Contact=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET C_BPartner_Location_ID=(SELECT C_BPartner_Location_ID" + " FROM C_BPartner_Location bpl INNER JOIN C_Location l ON (bpl.C_Location_ID=l.C_Location_ID)"+ " WHERE i.C_BPartner_ID=bpl.C_BPartner_ID AND bpl.AD_Client_ID=i.AD_Client_ID"+ " AND (i.Address1=l.Address1 OR (i.Address1 IS NULL AND l.Address1 IS NULL))"+ " AND (i.Address2=l.Address2 OR (i.Address2 IS NULL AND l.Address2 IS NULL))"+ " AND (i.City=l.City OR (i.City IS NULL AND l.City IS NULL))"+ " AND (i.Postal=l.Postal OR (i.Postal IS NULL AND l.Postal IS NULL))"+ " AND (i.Postal_Add=l.Postal_Add OR (l.Postal_Add IS NULL AND l.Postal_Add IS NULL))"+ " AND i.C_Region_ID=l.C_Region_ID AND i.C_Country_ID=l.C_Country_ID) "+ "WHERE C_BPartner_ID IS NOT NULL AND C_BPartner_Location_ID IS NULL"+ " AND I_IsImported='N'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Found Location=" + no);
sql=new StringBuffer("UPDATE I_BPartner i " + "SET R_InterestArea_ID=(SELECT R_InterestArea_ID FROM R_InterestArea ia " + "WHERE i.InterestAreaName=ia.Name AND ia.AD_Client_ID=i.AD_Client_ID) "+ "WHERE R_InterestArea_ID IS NULL AND InterestAreaName IS NOT NULL"+ " AND I_IsImported='N'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.fine("Set Interest Area=" + no);
sql=new StringBuffer("UPDATE I_BPartner " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Value is mandatory, ' " + "WHERE Value IS NULL "+ " AND I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
log.config("Value is mandatory=" + no);
ModelValidationEngine.get().fireImportValidate(this,null,null,ImportValidator.TIMING_AFTER_VALIDATE);
commitEx();
if (p_IsValidateOnly) {
return "Validated";
}
int noInsert=0;
int noUpdate=0;
sql=new StringBuffer("SELECT * FROM I_BPartner " + "WHERE I_IsImported='N'").append(clientCheck);
sql.append(" ORDER BY Value, I_BPartner_ID");
PreparedStatement pstmt=null;
ResultSet rs=null;
try {
pstmt=DB.prepareStatement(sql.toString(),get_TrxName());
rs=pstmt.executeQuery();
String Old_BPValue="";
MBPartner bp=null;
MBPartnerLocation bpl=null;
while (rs.next()) {
String New_BPValue=rs.getString("Value");
X_I_BPartner impBP=new X_I_BPartner(getCtx(),rs,get_TrxName());
log.fine("I_BPartner_ID=" + impBP.getI_BPartner_ID() + ", C_BPartner_ID="+ impBP.getC_BPartner_ID()+ ", C_BPartner_Location_ID="+ impBP.getC_BPartner_Location_ID()+ ", AD_User_ID="+ impBP.getAD_User_ID());
if (!New_BPValue.equals(Old_BPValue)) {
bp=null;
if (impBP.getC_BPartner_ID() == 0) {
bp=new MBPartner(impBP);
ModelValidationEngine.get().fireImportValidate(this,impBP,bp,ImportValidator.TIMING_AFTER_IMPORT);
setTypeOfBPartner(impBP,bp);
if (bp.save()) {
impBP.setC_BPartner_ID(bp.getC_BPartner_ID());
log.finest("Insert BPartner - " + bp.getC_BPartner_ID());
noInsert++;
}
else {
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'Cannot Insert BPartner, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
}
else {
bp=new MBPartner(getCtx(),impBP.getC_BPartner_ID(),get_TrxName());
if (impBP.getName() != null) {
bp.setName(impBP.getName());
bp.setName2(impBP.getName2());
}
if (impBP.getDUNS() != null) bp.setDUNS(impBP.getDUNS());
if (impBP.getTaxID() != null) bp.setTaxID(impBP.getTaxID());
if (impBP.getNAICS() != null) bp.setNAICS(impBP.getNAICS());
if (impBP.getDescription() != null) bp.setDescription(impBP.getDescription());
if (impBP.getC_BP_Group_ID() != 0) bp.setC_BP_Group_ID(impBP.getC_BP_Group_ID());
ModelValidationEngine.get().fireImportValidate(this,impBP,bp,ImportValidator.TIMING_AFTER_IMPORT);
setTypeOfBPartner(impBP,bp);
if (bp.save()) {
log.finest("Update BPartner - " + bp.getC_BPartner_ID());
noUpdate++;
}
else {
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'Cannot Update BPartner, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
}
bpl=null;
if (impBP.getC_BPartner_Location_ID() != 0) {
bpl=new MBPartnerLocation(getCtx(),impBP.getC_BPartner_Location_ID(),get_TrxName());
MLocation location=new MLocation(getCtx(),bpl.getC_Location_ID(),get_TrxName());
location.setC_Country_ID(impBP.getC_Country_ID());
location.setC_Region_ID(impBP.getC_Region_ID());
location.setCity(impBP.getCity());
location.setAddress1(impBP.getAddress1());
location.setAddress2(impBP.getAddress2());
location.setPostal(impBP.getPostal());
location.setPostal_Add(impBP.getPostal_Add());
if (!location.save()) log.warning("Location not updated");
else bpl.setC_Location_ID(location.getC_Location_ID());
if (impBP.getPhone() != null) bpl.setPhone(impBP.getPhone());
if (impBP.getPhone2() != null) bpl.setPhone2(impBP.getPhone2());
if (impBP.getFax() != null) bpl.setFax(impBP.getFax());
ModelValidationEngine.get().fireImportValidate(this,impBP,bpl,ImportValidator.TIMING_AFTER_IMPORT);
bpl.saveEx();
}
else if (impBP.getC_Country_ID() != 0 && impBP.getAddress1() != null && impBP.getCity() != null) {
MLocation location=new MLocation(getCtx(),impBP.getC_Country_ID(),impBP.getC_Region_ID(),impBP.getCity(),get_TrxName());
location.setAddress1(impBP.getAddress1());
location.setAddress2(impBP.getAddress2());
location.setPostal(impBP.getPostal());
location.setPostal_Add(impBP.getPostal_Add());
if (location.save()) log.finest("Insert Location - " + location.getC_Location_ID());
else {
rollback();
noInsert--;
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'Cannot Insert Location, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
bpl=new MBPartnerLocation(bp);
bpl.setC_Location_ID(location.getC_Location_ID());
bpl.setPhone(impBP.getPhone());
bpl.setPhone2(impBP.getPhone2());
bpl.setFax(impBP.getFax());
ModelValidationEngine.get().fireImportValidate(this,impBP,bpl,ImportValidator.TIMING_AFTER_IMPORT);
if (bpl.save()) {
log.finest("Insert BP Location - " + bpl.getC_BPartner_Location_ID());
impBP.setC_BPartner_Location_ID(bpl.getC_BPartner_Location_ID());
}
else {
rollback();
noInsert--;
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'Cannot Insert BPLocation, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
}
}
Old_BPValue=New_BPValue;
MUser user=null;
if (impBP.getAD_User_ID() != 0) {
user=new MUser(getCtx(),impBP.getAD_User_ID(),get_TrxName());
if (user.getC_BPartner_ID() == 0) user.setC_BPartner_ID(bp.getC_BPartner_ID());
else if (user.getC_BPartner_ID() != bp.getC_BPartner_ID()) {
rollback();
noInsert--;
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'BP of User <> BP, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
if (impBP.getC_Greeting_ID() != 0) user.setC_Greeting_ID(impBP.getC_Greeting_ID());
String name=impBP.getContactName();
if (name == null || name.length() == 0) name=impBP.getEMail();
user.setName(name);
if (impBP.getTitle() != null) user.setTitle(impBP.getTitle());
if (impBP.getContactDescription() != null) user.setDescription(impBP.getContactDescription());
if (impBP.getComments() != null) user.setComments(impBP.getComments());
if (impBP.getPhone() != null) user.setPhone(impBP.getPhone());
if (impBP.getPhone2() != null) user.setPhone2(impBP.getPhone2());
if (impBP.getFax() != null) user.setFax(impBP.getFax());
if (impBP.getEMail() != null) user.setEMail(impBP.getEMail());
if (impBP.getBirthday() != null) user.setBirthday(impBP.getBirthday());
if (bpl != null) user.setC_BPartner_Location_ID(bpl.getC_BPartner_Location_ID());
ModelValidationEngine.get().fireImportValidate(this,impBP,user,ImportValidator.TIMING_AFTER_IMPORT);
if (user.save()) {
log.finest("Update BP Contact - " + user.getAD_User_ID());
}
else {
rollback();
noInsert--;
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'Cannot Update BP Contact, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
}
else if (impBP.getContactName() != null || impBP.getEMail() != null) {
user=new MUser(bp);
if (impBP.getC_Greeting_ID() != 0) user.setC_Greeting_ID(impBP.getC_Greeting_ID());
String name=impBP.getContactName();
if (name == null || name.length() == 0) name=impBP.getEMail();
user.setName(name);
user.setTitle(impBP.getTitle());
user.setDescription(impBP.getContactDescription());
user.setComments(impBP.getComments());
user.setPhone(impBP.getPhone());
user.setPhone2(impBP.getPhone2());
user.setFax(impBP.getFax());
user.setEMail(impBP.getEMail());
user.setBirthday(impBP.getBirthday());
if (bpl != null) user.setC_BPartner_Location_ID(bpl.getC_BPartner_Location_ID());
ModelValidationEngine.get().fireImportValidate(this,impBP,user,ImportValidator.TIMING_AFTER_IMPORT);
if (user.save()) {
log.finest("Insert BP Contact - " + user.getAD_User_ID());
impBP.setAD_User_ID(user.getAD_User_ID());
}
else {
rollback();
noInsert--;
sql=new StringBuffer("UPDATE I_BPartner i " + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||").append("'Cannot Insert BPContact, ' ").append("WHERE I_BPartner_ID=").append(impBP.getI_BPartner_ID());
DB.executeUpdateEx(sql.toString(),get_TrxName());
continue;
}
}
if (impBP.getR_InterestArea_ID() != 0 && user != null) {
MContactInterest ci=MContactInterest.get(getCtx(),impBP.getR_InterestArea_ID(),user.getAD_User_ID(),true,get_TrxName());
ci.saveEx();
}
impBP.setI_IsImported(true);
impBP.setProcessed(true);
impBP.setProcessing(false);
impBP.saveEx();
commitEx();
}
DB.close(rs,pstmt);
}
catch ( SQLException e) {
rollback();
throw new DBException(e,sql.toString());
}
finally {
DB.close(rs,pstmt);
rs=null;
pstmt=null;
sql=new StringBuffer("UPDATE I_BPartner " + "SET I_IsImported='N', Updated=SysDate " + "WHERE I_IsImported<>'Y'").append(clientCheck);
no=DB.executeUpdateEx(sql.toString(),get_TrxName());
addLog(0,null,new BigDecimal(no),"@Errors@");
addLog(0,null,new BigDecimal(noInsert),"@C_BPartner_ID@: @Inserted@");
addLog(0,null,new BigDecimal(noUpdate),"@C_BPartner_ID@: @Updated@");
}
return "";
}
| Perform process. |
public CertificateParsingException(){
super();
}
| Constructs a CertificateParsingException with no detail message. A detail message is a String that describes this particular exception. |
protected Resources fetchResourceFile(){
try {
if (resourceFile != null) {
return resourceFile;
}
String p=getResourceFilePath();
if (p.indexOf('.') > -1) {
return Resources.open(p);
}
Resources res=Resources.openLayered(p);
if (isKeepResourcesInRam()) {
resourceFile=res;
}
return res;
}
catch ( IOException ex) {
ex.printStackTrace();
return null;
}
}
| This method may be overriden by subclasses to provide a way to dynamically load a resource file. Normally the navigation feature of the UIBuilder requires the resource file present in RAM. However, that might be expensive to maintain. By implementing this method and replacing the storeResourceFile() with an empty implementation the resource file storage can be done strictly in RAM. |
public boolean add(Solution solution){
return data.add(solution);
}
| Adds the specified solution to this population. |
protected void parse(String url){
dbType=null;
host=null;
port=null;
dbName=null;
if (url.startsWith(MYSQL_PREFIX)) {
dbType="mysql";
host="localhost";
port="3306";
Matcher matcher=mysqlPattern.matcher(url);
if (matcher.matches()) {
if (matcher.group(1) != null && matcher.group(1).length() > 0) host=matcher.group(1);
if (matcher.group(4) != null && matcher.group(4).length() > 0) port=matcher.group(4);
dbName=matcher.group(5);
}
}
else if (url.startsWith(POSTGRESQL_PREFIX)) {
dbType="postgresql";
host="localhost";
port="5432";
Matcher matcher=postgresqlPattern.matcher(url);
if (matcher.matches()) {
if (matcher.group(3) != null) host=matcher.group(3);
if (matcher.group(6) != null) port=matcher.group(6);
dbName=matcher.group(7);
}
}
else {
}
}
| Parses the URL using available patterns. |
public void testSetBitPositiveInside4(){
byte aBytes[]={1,-128,56,100,-2,-76,89,45,91,3,-15,35,26};
int aSign=1;
int number=50;
byte rBytes[]={1,-128,56,100,-2,-76,93,45,91,3,-15,35,26};
BigInteger aNumber=new BigInteger(aSign,aBytes);
BigInteger result=aNumber.setBit(number);
byte resBytes[]=new byte[rBytes.length];
resBytes=result.toByteArray();
for (int i=0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign",1,result.signum());
}
| setBit(int n) inside a positive number |
public DDFFieldDefinition findFieldDefn(String pszFieldName){
for (Iterator it=paoFieldDefns.iterator(); it.hasNext(); ) {
DDFFieldDefinition ddffd=(DDFFieldDefinition)it.next();
String pszThisName=ddffd.getName();
if (Debug.debugging("iso8211detail")) {
Debug.output("DDFModule.findFieldDefn(" + pszFieldName + ":"+ pszFieldName.length()+ ") checking against ["+ pszThisName+ ":"+ pszThisName.length()+ "]");
}
if (pszFieldName.equalsIgnoreCase(pszThisName)) {
return ddffd;
}
}
return null;
}
| Fetch the definition of the named field. This function will scan the DDFFieldDefn's on this module, to find one with the indicated field name. |
public void show(StackablePath path){
dispatcher.dispatch(add(History.NAV_TYPE_MODAL,path));
}
| Show one path as modal |
public static Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy> determineIndexing(QueryGraph queryGraph,EventType polledViewType,EventType streamViewType,int polledViewStreamNum,int streamViewStreamNum){
QueryGraphValue queryGraphValue=queryGraph.getGraphValue(streamViewStreamNum,polledViewStreamNum);
QueryGraphValuePairHashKeyIndex hashKeysAndIndes=queryGraphValue.getHashKeyProps();
QueryGraphValuePairRangeIndex rangeKeysAndIndex=queryGraphValue.getRangeProps();
List<QueryGraphValueEntryHashKeyed> hashKeys=hashKeysAndIndes.getKeys();
String[] hashIndexes=hashKeysAndIndes.getIndexed();
List<QueryGraphValueEntryRange> rangeKeys=rangeKeysAndIndex.getKeys();
String[] rangeIndexes=rangeKeysAndIndex.getIndexed();
if (hashKeys.isEmpty() && rangeKeys.isEmpty()) {
QueryGraphValuePairInKWSingleIdx inKeywordSingles=queryGraphValue.getInKeywordSingles();
if (inKeywordSingles != null && inKeywordSingles.getIndexed().length != 0) {
String indexed=inKeywordSingles.getIndexed()[0];
QueryGraphValueEntryInKeywordSingleIdx lookup=inKeywordSingles.getKey().get(0);
HistoricalIndexLookupStrategyInKeywordSingle strategy=new HistoricalIndexLookupStrategyInKeywordSingle(streamViewStreamNum,lookup.getKeyExprs());
PollResultIndexingStrategyIndexSingle indexing=new PollResultIndexingStrategyIndexSingle(polledViewStreamNum,polledViewType,indexed);
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
List<QueryGraphValuePairInKWMultiIdx> multis=queryGraphValue.getInKeywordMulti();
if (!multis.isEmpty()) {
QueryGraphValuePairInKWMultiIdx multi=multis.get(0);
HistoricalIndexLookupStrategyInKeywordMulti strategy=new HistoricalIndexLookupStrategyInKeywordMulti(streamViewStreamNum,multi.getKey().getKeyExpr());
PollResultIndexingStrategyIndexSingleArray indexing=new PollResultIndexingStrategyIndexSingleArray(polledViewStreamNum,polledViewType,ExprNodeUtility.getIdentResolvedPropertyNames(multi.getIndexed()));
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(new HistoricalIndexLookupStrategyNoIndex(),new PollResultIndexingStrategyNoIndex());
}
CoercionDesc keyCoercionTypes=CoercionUtil.getCoercionTypesHash(new EventType[]{streamViewType,polledViewType},0,1,hashKeys,hashIndexes);
if (rangeKeys.isEmpty()) {
if (!keyCoercionTypes.isCoerce()) {
if (hashIndexes.length == 1) {
PollResultIndexingStrategyIndexSingle indexing=new PollResultIndexingStrategyIndexSingle(polledViewStreamNum,polledViewType,hashIndexes[0]);
HistoricalIndexLookupStrategy strategy=new HistoricalIndexLookupStrategyIndexSingle(streamViewStreamNum,hashKeys.get(0));
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
else {
PollResultIndexingStrategyIndex indexing=new PollResultIndexingStrategyIndex(polledViewStreamNum,polledViewType,hashIndexes);
HistoricalIndexLookupStrategy strategy=new HistoricalIndexLookupStrategyIndex(streamViewType,streamViewStreamNum,hashKeys);
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
}
if (hashIndexes.length == 1) {
PollResultIndexingStrategy indexing=new PollResultIndexingStrategyIndexCoerceSingle(polledViewStreamNum,polledViewType,hashIndexes[0],keyCoercionTypes.getCoercionTypes()[0]);
HistoricalIndexLookupStrategy strategy=new HistoricalIndexLookupStrategyIndexSingle(streamViewStreamNum,hashKeys.get(0));
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
else {
PollResultIndexingStrategy indexing=new PollResultIndexingStrategyIndexCoerce(polledViewStreamNum,polledViewType,hashIndexes,keyCoercionTypes.getCoercionTypes());
HistoricalIndexLookupStrategy strategy=new HistoricalIndexLookupStrategyIndex(streamViewType,streamViewStreamNum,hashKeys);
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
}
else {
CoercionDesc rangeCoercionTypes=CoercionUtil.getCoercionTypesRange(new EventType[]{streamViewType,polledViewType},1,rangeIndexes,rangeKeys);
if (rangeKeys.size() == 1 && hashKeys.size() == 0) {
Class rangeCoercionType=rangeCoercionTypes.isCoerce() ? rangeCoercionTypes.getCoercionTypes()[0] : null;
PollResultIndexingStrategySorted indexing=new PollResultIndexingStrategySorted(polledViewStreamNum,polledViewType,rangeIndexes[0],rangeCoercionType);
HistoricalIndexLookupStrategy strategy=new HistoricalIndexLookupStrategySorted(streamViewStreamNum,rangeKeys.get(0));
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
else {
PollResultIndexingStrategyComposite indexing=new PollResultIndexingStrategyComposite(polledViewStreamNum,polledViewType,hashIndexes,keyCoercionTypes.getCoercionTypes(),rangeIndexes,rangeCoercionTypes.getCoercionTypes());
HistoricalIndexLookupStrategy strategy=new HistoricalIndexLookupStrategyComposite(streamViewStreamNum,hashKeys,keyCoercionTypes.getCoercionTypes(),rangeKeys,rangeCoercionTypes.getCoercionTypes());
return new Pair<HistoricalIndexLookupStrategy,PollResultIndexingStrategy>(strategy,indexing);
}
}
}
| Constructs indexing and lookup strategy for a given relationship that a historical stream may have with another stream (historical or not) that looks up into results of a poll of a historical stream. <p> The term "polled" refers to the assumed-historical stream. |
public String download(String siteUrl) throws IOException {
URL url=new URL(siteUrl);
HttpsURLConnection con=(HttpsURLConnection)url.openConnection();
return dl(con);
}
| Download (via HTTP) the text file located at the supplied URL, and return its contents. Primarily intended for downloading web pages. |
public void testJustDate() throws Exception {
Path file=getWorkDir().resolve("one-line");
PerfRunData runData=createPerfRunData(file,false,JustDateDocMaker.class.getName());
WriteLineDocTask wldt=new WriteLineDocTask(runData);
wldt.doLogic();
wldt.close();
try (BufferedReader br=Files.newBufferedReader(file,StandardCharsets.UTF_8)){
String line=br.readLine();
assertHeaderLine(line);
line=br.readLine();
assertNull(line);
}
}
| Fail by default when there's only date |
public static byte[] flattenBitmap(Bitmap bitmap){
int size=bitmap.getWidth() * bitmap.getHeight() * 4;
ByteArrayOutputStream out=new ByteArrayOutputStream(size);
try {
bitmap.compress(Bitmap.CompressFormat.PNG,100,out);
out.flush();
out.close();
return out.toByteArray();
}
catch ( IOException e) {
Log.w(TAG,"Could not write bitmap");
return null;
}
}
| Compresses the bitmap to a byte array for serialization. |
public boolean execute(String sql) throws SQLException {
return executeInternal(sql,false);
}
| Execute a SQL statement that may return multiple results. We don't have to worry about this since we do not support multiple ResultSets. You can use getResultSet or getUpdateCount to retrieve the result. |
@Deprecated public void compactValueNumbers(Dataflow<ValueNumberFrame,ValueNumberAnalysis> dataflow){
if (true) {
throw new UnsupportedOperationException();
}
}
| Compact the value numbers assigned. This should be done only after the dataflow algorithm has executed. This works by modifying the actual ValueNumber objects assigned. After this method is called, the getNumValuesAllocated() method of this object will return a value less than or equal to the value it would have returned before the call to this method. <p/> <p> <em>This method should be called at most once</em>. |
@Override public void addStatement(final Resource s,final URI p,final Value o,final Resource... contexts) throws SailException {
if (log.isDebugEnabled()) log.debug("s=" + s + ", p="+ p+ ", o="+ o+ ", contexts="+ Arrays.toString(contexts));
OpenRDFUtil.verifyContextNotNull(contexts);
if (contexts.length == 0) {
addStatement(s,p,o,(Resource)null);
}
if (contexts.length == 1 && contexts[0] == null) {
addStatement(s,p,o,(Resource)null);
}
for ( Resource c : contexts) {
addStatement(s,p,o,c);
}
}
| Sesame has a concept of a "null" graph. Any statement inserted whose context position is NOT bound will be inserted into the "null" graph. Statements inserted into the "null" graph are visible from the SPARQL default graph, when no data set is specified (in this case all statements in all contexts are visible). |
synchronized void receive(char oneChar) throws IOException {
if (buffer == null) {
throw new IOException("Pipe is closed");
}
if (lastReader != null && !lastReader.isAlive()) {
throw new IOException("Pipe broken");
}
lastWriter=Thread.currentThread();
try {
while (buffer != null && out == in) {
notifyAll();
wait(1000);
if (lastReader != null && !lastReader.isAlive()) {
throw new IOException("Pipe broken");
}
}
}
catch ( InterruptedException e) {
IoUtils.throwInterruptedIoException();
}
if (buffer == null) {
throw new IOException("Pipe is closed");
}
if (in == -1) {
in=0;
}
buffer[in++]=oneChar;
if (in == buffer.length) {
in=0;
}
}
| Receives a char and stores it into the PipedReader. This called by PipedWriter.write() when writes occur. <P> If the buffer is full and the thread sending #receive is interrupted, the InterruptedIOException will be thrown. |
public ASN1InputStream(InputStream input,int limit,boolean lazyEvaluate){
super(input);
this.limit=limit;
this.lazyEvaluate=lazyEvaluate;
this.tmpBuffers=new byte[11][];
}
| Create an ASN1InputStream where no DER object will be longer than limit, and constructed objects such as sequences will be parsed lazily. |
public static AvedevProjectionExpression avedevDistinct(Expression expression){
return new AvedevProjectionExpression(expression,false);
}
| Mean deviation function considering distinct values only. |
private static Box createLabel(String text){
Box box=Box.createHorizontalBox();
box.add(new JLabel(text));
box.add(Box.createHorizontalGlue());
return box;
}
| Creates a left-aligned label. |
private void enrichMapWithProducts(final Map<String,Object> map){
final Map<String,ProductSku> products=new HashMap<String,ProductSku>();
for ( final CustomerOrderDet orderDet : ((CustomerOrder)map.get(ROOT)).getOrderDetail()) {
final ProductSku sku=productSkuService.getProductSkuBySkuCode(orderDet.getProductSkuCode());
if (sku != null) {
products.put(sku.getCode(),sku);
}
}
map.put(PRODUCTS,products);
}
| Enrich given map with product date. |
public static double max(double[] array){
if (array == null) {
throw new IllegalArgumentException("The Array must not be null");
}
else if (array.length == 0) {
throw new IllegalArgumentException("Array cannot be empty.");
}
double max=array[0];
for (int j=1; j < array.length; j++) {
if (Double.isNaN(array[j])) {
return Double.NaN;
}
if (array[j] > max) {
max=array[j];
}
}
return max;
}
| <p>Returns the maximum value in an array.</p> |
@Override public void run(){
amIActive=true;
String inputFilesString=null;
String fileName=null;
String inputDataFile=null;
String whiteboxHeaderFile=null;
String whiteboxDataFile=null;
WhiteboxRaster output=null;
int i=0;
int row, col, rows, cols;
String[] imageFiles;
int numImages=0;
double noData=-32768;
InputStream inStream=null;
OutputStream outStream=null;
String dataType="float";
String dataScale="rgb";
DataInputStream in=null;
BufferedReader br=null;
String str1=null;
FileWriter fw=null;
BufferedWriter bw=null;
PrintWriter out=null;
if (args.length <= 0) {
showFeedback("Plugin parameters have not been set.");
return;
}
inputFilesString=args[0];
if ((inputFilesString == null)) {
showFeedback("One or more of the input parameters have not been set properly.");
return;
}
imageFiles=inputFilesString.split(";");
numImages=imageFiles.length;
try {
for (i=0; i < numImages; i++) {
int progress=(int)(100f * i / (numImages - 1));
if (numImages > 1) {
updateProgress("Loop " + (i + 1) + " of "+ numImages+ ":",progress);
}
fileName=imageFiles[i];
if (!((new File(fileName)).exists())) {
showFeedback("Image file does not exist.");
break;
}
File file=new File(fileName);
String fileExtension=whitebox.utilities.FileUtilities.getFileExtension(fileName).toLowerCase();
String[] formatNames=ImageIO.getReaderFormatNames();
boolean checkForSupportedFormat=false;
for ( String str : formatNames) {
if (str.toLowerCase().equals(fileExtension)) {
checkForSupportedFormat=true;
break;
}
}
if (!checkForSupportedFormat) {
showFeedback("This image file format is not currently supported by this tool.");
return;
}
BufferedImage image=ImageIO.read(new File(fileName));
rows=image.getHeight();
cols=image.getWidth();
if (image.getColorModel().getPixelSize() == 24) {
dataType="float";
dataScale="rgb";
}
int dot=imageFiles[i].lastIndexOf(".");
String imageExtension=imageFiles[i].substring(dot + 1);
whiteboxHeaderFile=imageFiles[i].replace(imageExtension,"dep");
whiteboxDataFile=imageFiles[i].replace(imageExtension,"tas");
char[] extChars=imageExtension.toCharArray();
boolean worldFileFound=false;
String wfExtension=Character.toString(extChars[0]) + Character.toString(extChars[2]) + "w";
String worldFile=imageFiles[i].replace(imageExtension,wfExtension);
if ((new File(worldFile)).exists()) {
worldFileFound=true;
}
else {
wfExtension=imageExtension + "w";
worldFile=imageFiles[i].replace(imageExtension,wfExtension);
if ((new File(worldFile)).exists()) {
worldFileFound=true;
}
else {
wfExtension=".wld";
worldFile=imageFiles[i].replace(imageExtension,wfExtension);
if ((new File(worldFile)).exists()) {
worldFileFound=true;
}
}
}
if (worldFileFound) {
double A=0, B=0, C=0, D=0, E=0, F=0;
FileInputStream fstream=new FileInputStream(worldFile);
in=new DataInputStream(fstream);
br=new BufferedReader(new InputStreamReader(in));
String line;
int n=0;
while ((line=br.readLine()) != null) {
switch (n) {
case 0:
A=Double.parseDouble(line);
break;
case 1:
D=Double.parseDouble(line);
break;
case 2:
B=Double.parseDouble(line);
break;
case 3:
E=Double.parseDouble(line);
break;
case 4:
C=Double.parseDouble(line);
break;
case 5:
F=Double.parseDouble(line);
break;
}
n++;
}
if (B == 0 && D == 0) {
double west=A * 0 + B * 0 + C;
double north=D * 0 + E * 0 + F;
double east=A * (cols - 1) + B * (rows - 1) + C;
double south=D * (cols - 1) + E * (rows - 1) + F;
(new File(whiteboxHeaderFile)).delete();
(new File(whiteboxDataFile)).delete();
fw=new FileWriter(whiteboxHeaderFile,false);
bw=new BufferedWriter(fw);
out=new PrintWriter(bw,true);
String byteOrder=java.nio.ByteOrder.nativeOrder().toString();
str1="Min:\t" + Double.toString(Integer.MAX_VALUE);
out.println(str1);
str1="Max:\t" + Double.toString(Integer.MIN_VALUE);
out.println(str1);
str1="North:\t" + Double.toString(north);
out.println(str1);
str1="South:\t" + Double.toString(south);
out.println(str1);
str1="East:\t" + Double.toString(east);
out.println(str1);
str1="West:\t" + Double.toString(west);
out.println(str1);
str1="Cols:\t" + Integer.toString(cols);
out.println(str1);
str1="Rows:\t" + Integer.toString(rows);
out.println(str1);
str1="Data Type:\t" + dataType;
out.println(str1);
str1="Z Units:\t" + "not specified";
out.println(str1);
str1="XY Units:\t" + "not specified";
out.println(str1);
str1="Projection:\t" + "not specified";
out.println(str1);
str1="Data Scale:\t" + dataScale;
out.println(str1);
str1="Preferred Palette:\t" + "greyscale.pal";
out.println(str1);
str1="NoData:\t-32768";
out.println(str1);
if (byteOrder.toLowerCase().contains("lsb") || byteOrder.toLowerCase().contains("little")) {
str1="Byte Order:\t" + "LITTLE_ENDIAN";
}
else {
str1="Byte Order:\t" + "BIG_ENDIAN";
}
out.println(str1);
output=new WhiteboxRaster(whiteboxHeaderFile,"rw");
int z, r, g, b;
for (row=0; row < rows; row++) {
for (col=0; col < cols; col++) {
z=image.getRGB(col,row);
r=(int)z & 0xFF;
g=((int)z >> 8) & 0xFF;
b=((int)z >> 16) & 0xFF;
output.setValue(row,col,(double)((255 << 24) | (b << 16) | (g << 8)| r));
}
}
output.findMinAndMaxVals();
output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
output.addMetadataEntry("Created on " + new Date());
output.writeHeaderFile();
output.close();
}
else {
showFeedback("We're sorry but Whitebox cannot currently handle the import of rotated images.");
break;
}
}
else {
double west=0;
double north=rows - 1;
double east=cols - 1;
double south=0;
(new File(whiteboxHeaderFile)).delete();
(new File(whiteboxDataFile)).delete();
fw=new FileWriter(whiteboxHeaderFile,false);
bw=new BufferedWriter(fw);
out=new PrintWriter(bw,true);
String byteOrder=java.nio.ByteOrder.nativeOrder().toString();
str1="Min:\t" + Double.toString(Integer.MAX_VALUE);
out.println(str1);
str1="Max:\t" + Double.toString(Integer.MIN_VALUE);
out.println(str1);
str1="North:\t" + Double.toString(north);
out.println(str1);
str1="South:\t" + Double.toString(south);
out.println(str1);
str1="East:\t" + Double.toString(east);
out.println(str1);
str1="West:\t" + Double.toString(west);
out.println(str1);
str1="Cols:\t" + Integer.toString(cols);
out.println(str1);
str1="Rows:\t" + Integer.toString(rows);
out.println(str1);
str1="Data Type:\t" + dataType;
out.println(str1);
str1="Z Units:\t" + "not specified";
out.println(str1);
str1="XY Units:\t" + "not specified";
out.println(str1);
str1="Projection:\t" + "not specified";
out.println(str1);
str1="Data Scale:\t" + dataScale;
out.println(str1);
str1="Preferred Palette:\t" + "greyscale.pal";
out.println(str1);
str1="NoData:\t-32768";
out.println(str1);
if (byteOrder.toLowerCase().contains("lsb") || byteOrder.toLowerCase().contains("little")) {
str1="Byte Order:\t" + "LITTLE_ENDIAN";
}
else {
str1="Byte Order:\t" + "BIG_ENDIAN";
}
out.println(str1);
output=new WhiteboxRaster(whiteboxHeaderFile,"rw");
int z, r, g, b;
for (row=0; row < rows; row++) {
for (col=0; col < cols; col++) {
z=image.getRGB(col,row);
r=(int)z & 0xFF;
g=((int)z >> 8) & 0xFF;
b=((int)z >> 16) & 0xFF;
output.setValue(row,col,(double)((255 << 24) | (b << 16) | (g << 8)| r));
}
}
output.findMinAndMaxVals();
output.addMetadataEntry("Created by the " + getDescriptiveName() + " tool.");
output.addMetadataEntry("Created on " + new Date());
output.writeHeaderFile();
output.close();
returnData(whiteboxHeaderFile);
}
}
}
catch (OutOfMemoryError oe) {
myHost.showFeedback("An out-of-memory error has occurred during operation.");
}
catch (Exception e) {
myHost.showFeedback("An error has occurred during operation. See log file for details.");
myHost.logException("Error in " + getDescriptiveName(),e);
}
finally {
updateProgress("Progress: ",0);
amIActive=false;
myHost.pluginComplete();
}
}
| Used to execute this plugin tool. |
@Override public void createUntamperedRequest(){
CollisionDJBX33X DJBX33X=new CollisionDJBX33X();
String untampered=UtilHashDoS.generateUntampered(DJBX33X,optionNumberAttributes.getValue(),optionUseNamespaces.isOn());
String soapMessage=this.getOptionTextAreaSoapMessage().getValue();
String soapMessageFinal=this.getOptionTextAreaSoapMessage().replacePlaceholderWithPayload(soapMessage,untampered);
Map<String,String> httpHeaderMap=new HashMap<String,String>();
for ( Map.Entry<String,String> entry : getOriginalRequestHeaderFields().entrySet()) {
httpHeaderMap.put(entry.getKey(),entry.getValue());
}
this.setUntamperedRequestObject(httpHeaderMap,getOriginalRequest().getEndpoint(),soapMessageFinal);
}
| custom untampered request needed for prevention of false positives based on effect of XML Attribute Count Attack |
public String demodulize(String className){
int period=className.lastIndexOf('.');
if (period >= 0) {
return className.substring(period + 1);
}
else {
return className;
}
}
| <p> Remove any package name from a fully qualified class name, returning only the simple classname.</p> <table border="1" width="100%"> <tr> <th>Input</th> <th>Output</th> </tr> <tr> <td>"java.util.Map"</td> <td>"Map"</td> </tr> <tr> <td>"String"</td> <td>"String"</td> </tr> </table> |
void sendRoleRequest(OFControllerRole role){
try {
roleChanger.sendRoleRequest(role,0);
}
catch ( IOException e) {
log.error("Disconnecting switch {} due to IO Error: {}",getSwitchInfoString(),e.getMessage());
mainConnection.disconnect();
}
}
| Forwards to RoleChanger. See there. |
private void add(){
list.addLast(Integer.parseInt(textField.getText()));
displayText();
}
| Add an integer to the end of the list |
public void addAnewarray(String classname){
addOpcode(ANEWARRAY);
addIndex(constPool.addClassInfo(classname));
}
| Appends ANEWARRAY. |
private void updateMultiEdges(){
if (m_multiEdgeUpdatingEnabled) {
if (m_graph.getSettings().getEdgeSettings().getDisplayMultipleEdgesAsOne()) {
MultiEdgeHider.hideMultipleEdgesInternal(m_graph);
}
else {
MultiEdgeHider.unhideMultipleEdgesInternal(m_graph);
}
}
}
| Depending on the state of the multi edge settings option, this function either hides or shows multiple edges between the same nodes. |
private boolean allVolumesInSameBackendCG(List<Volume> volumes){
boolean result=true;
String replicationGroup=null;
int count=0;
URI storageUri=null;
for ( Volume volume : volumes) {
URI cgURI=volume.getConsistencyGroup();
if (NullColumnValueGetter.isNullURI(cgURI)) {
result=false;
break;
}
Volume srcVol=VPlexUtil.getVPLEXBackendVolume(volume,true,_dbClient,false);
if (srcVol == null) {
result=false;
break;
}
URI storage=volume.getStorageController();
String rgName=srcVol.getReplicationGroupInstance();
if (count == 0) {
replicationGroup=rgName;
storageUri=storage;
}
if (replicationGroup == null || replicationGroup.isEmpty()) {
result=false;
break;
}
if (rgName == null || !replicationGroup.equals(rgName)) {
result=false;
break;
}
if (!storageUri.equals(storage)) {
result=false;
break;
}
count++;
}
return result;
}
| Check if the volumes are in a CG and in the same backend CG |
public static AsciiImgCache create(final Font font,final char[] characters){
Dimension maxCharacterImageSize=calculateCharacterRectangle(font,characters);
Map<Character,GrayscaleMatrix> imageCache=createCharacterImages(font,maxCharacterImageSize,characters);
return new AsciiImgCache(maxCharacterImageSize,imageCache,characters);
}
| Initialize a new character cache with supplied font. |
public Spring addListener(SpringListener newListener){
if (newListener == null) {
throw new IllegalArgumentException("newListener is required");
}
mListeners.add(newListener);
return this;
}
| add a listener |
public void vibrateWithPattern(long[] pattern,int repeat){
AudioManager manager=(AudioManager)this.cordova.getActivity().getSystemService(Context.AUDIO_SERVICE);
if (manager.getRingerMode() != AudioManager.RINGER_MODE_SILENT) {
Vibrator vibrator=(Vibrator)this.cordova.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(pattern,repeat);
}
}
| Vibrates the device with a given pattern. |
public Object runSafely(Catbert.FastStack stack) throws Exception {
return new Long(stack.getUIMgrSafe().getVideoFrame().getVideoHShiftFreq());
}
| Gets the video orbiting duration in milliseconds. This is used to shift the video left-to-right very slowly over time. It is used on widescreen displays to prevent screen burn when watching 4:3 content. |
private void duplicateRow(int yDest,int ySrc){
for (int i=0; i < width; i++) {
setPixel(i,yDest,getPixel(i,ySrc,line,newData));
}
}
| get a byte of pixels |
@Override public void onGetUserIdResponse(final GetUserIdResponse getUserIdResponse){
Log.v(TAG,"onGetUserIdResponse recieved: Response -" + getUserIdResponse);
Log.v(TAG,"RequestId:" + getUserIdResponse.getRequestId());
Log.v(TAG,"IdRequestStatus:" + getUserIdResponse.getUserIdRequestStatus());
new GetUserIdAsyncTask().execute(getUserIdResponse);
}
| Invoked once the call from initiateGetUserIdRequest is completed. On a successful response, a response object is passed which contains the request id, request status, and the userid generated for your application. |
private void onMembershipGossip(Message message){
MembershipRecord record=message.data();
LOGGER.debug("Received membership gossip: {}",record);
updateMembership(record,false);
}
| Merges received membership gossip (not spreading gossip further). |
public XmlHandler addClass(Class<?> clazz,String... attributes){
Attribute[] listAttributes=new Attribute[attributes.length];
for (int i=attributes.length; i-- > 0; ) listAttributes[i]=new Attribute(attributes[i]);
return addClass(clazz,listAttributes);
}
| This method adds a specific Class to Xml Configuration File.<br> At least one field name must be configured. |
public ColumnMap<String> acquireLockAndReadRow() throws Exception {
withDataColumns(true);
acquire();
return getDataColumns();
}
| Take the lock and return the row data columns. Use this, instead of acquire, when you want to implement a read-modify-write scenario and want to reduce the number of calls to Cassandra. |
public static Map<String,Object> performFindItem(DispatchContext dctx,Map<String,Object> context){
context.put("viewSize",1);
context.put("viewIndex",0);
Map<String,Object> result=org.ofbiz.common.FindServices.performFind(dctx,context);
List<GenericValue> list=null;
GenericValue item=null;
try {
EntityListIterator it=(EntityListIterator)result.get("listIt");
list=it.getPartialList(1,1);
if (UtilValidate.isNotEmpty(list)) {
item=list.get(0);
}
it.close();
}
catch ( Exception e) {
Debug.logInfo("Problem getting list Item" + e,module);
}
if (!UtilValidate.isEmpty(item)) {
result.put("item",item);
}
result.remove("listIt");
if (result.containsKey("listSize")) {
result.remove("listSize");
}
return result;
}
| Returns the first generic item of the service 'performFind' Same parameters as performFind service but returns a single GenericValue |
public void test_ticket_1105_quads_update5() throws Exception {
new UpdateTestHelper("ticket_1105_quads_update5","ticket_1105_update5.rq","ticket_1105.trig");
}
| Query: <code> DELETE { <http://example/s> <http://example/p> <http://example/o> } WHERE { GRAPH ?g { <http://example/s1> <http://example/p1> <http://example/o1> } } </code> is parsed successfully in quads mode. |
public String parseHandle(String linkUri){
Matcher m=parseRegex.matcher(linkUri);
return m.find() ? m.group(handleGroup) : null;
}
| Parses the IM handle out of a link. |
public _DeleteOptions(){
super();
}
| Constructs a _DeleteOptions with no flags initially set. |
public void enableChildAttach(boolean enable,int isolateId){
getIsolateState(isolateId).m_attachChildren=enable;
}
| If this feature is enabled then we do not attempt to attach child variables to parents. |
public void closeButtonActionPerformed(java.awt.event.ActionEvent ae){
dispose();
}
| Close button action |
public T caseArrayBindingPattern(ArrayBindingPattern object){
return null;
}
| Returns the result of interpreting the object as an instance of '<em>Array Binding Pattern</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> |
private boolean zzRefill() throws java.io.IOException {
return true;
}
| Refills the input buffer. |
public boolean isSelected(){
return isChecked();
}
| alias for isChecked, to ease porting of swing form |
@Override protected Key<PollMessage> doBackward(String externalKey){
List<String> idComponents=Splitter.on('-').splitToList(externalKey);
if (idComponents.size() != 5) {
throw new PollMessageExternalKeyParseException();
}
try {
Class<?> resourceClazz=EXTERNAL_KEY_CLASS_ID_MAP.inverse().get(Long.parseLong(idComponents.get(0)));
if (resourceClazz == null) {
throw new PollMessageExternalKeyParseException();
}
return Key.create(Key.create(Key.create(null,resourceClazz,String.format("%s-%s",idComponents.get(1),idComponents.get(2))),HistoryEntry.class,Long.parseLong(idComponents.get(3))),PollMessage.class,Long.parseLong(idComponents.get(4)));
}
catch ( NumberFormatException e) {
throw new PollMessageExternalKeyParseException();
}
}
| Returns an Objectify Key to a PollMessage corresponding with the external key string. |
@Override protected void sendFunctionGroup5(){
int new_fn=((getF21() ? CbusConstants.CBUS_F21 : 0) | (getF22() ? CbusConstants.CBUS_F22 : 0) | (getF23() ? CbusConstants.CBUS_F23 : 0)| (getF24() ? CbusConstants.CBUS_F24 : 0)| (getF25() ? CbusConstants.CBUS_F25 : 0)| (getF26() ? CbusConstants.CBUS_F26 : 0)| (getF27() ? CbusConstants.CBUS_F27 : 0)| (getF28() ? CbusConstants.CBUS_F28 : 0));
cs.setFunctions(5,_handle,new_fn);
}
| Send the CBUS message to set the state of functions F21, F22, F23, F24, F25, F26, F27, F28 |
private void showFeedback(String message){
if (myHost != null) {
myHost.showFeedback(message);
}
else {
System.out.println(message);
}
}
| Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface. |
public void columnSelectionChanged(ListSelectionEvent e){
}
| From a column's selection changing. Does nothing. |
public void sendEndEvaluationInstance(Stream inputStream){
InstanceContentEvent instanceContentEvent=new InstanceContentEvent(-1,firstInstance,false,true);
inputStream.put(instanceContentEvent);
}
| Send end evaluation instance. |
@Override public int eDerivedStructuralFeatureID(int baseFeatureID,Class<?> baseClass){
if (baseClass == TypedElement.class) {
switch (baseFeatureID) {
case N4JSPackage.TYPED_ELEMENT__DECLARED_TYPE_REF:
return N4JSPackage.N4_FIELD_DECLARATION__DECLARED_TYPE_REF;
case N4JSPackage.TYPED_ELEMENT__BOGUS_TYPE_REF:
return N4JSPackage.N4_FIELD_DECLARATION__BOGUS_TYPE_REF;
default :
return -1;
}
}
if (baseClass == ThisArgProvider.class) {
switch (baseFeatureID) {
default :
return -1;
}
}
if (baseClass == PropertyNameOwner.class) {
switch (baseFeatureID) {
case N4JSPackage.PROPERTY_NAME_OWNER__DECLARED_NAME:
return N4JSPackage.N4_FIELD_DECLARATION__DECLARED_NAME;
default :
return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID,baseClass);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public static ImageSource uri(Uri uri){
if (uri == null) {
throw new NullPointerException("Uri must not be null");
}
return new ImageSource(uri);
}
| Create an instance from a URI. |
public static Schema createSchema(final String schemaLocation) throws XMLException {
Schema schema=null;
final SchemaFactory schemaFactory=SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
try {
final File file=new File(schemaLocation);
if (file.exists()) {
schema=schemaFactory.newSchema(file);
}
else {
final InputStream resourceAsStream=XMLParser.class.getResourceAsStream(schemaLocation);
if (resourceAsStream == null) {
throw new XMLException("Cannot load the schema from file or classpath - fix the schema or amend the location: " + schemaLocation);
}
schema=schemaFactory.newSchema(new StreamSource(resourceAsStream));
}
return schema;
}
catch ( SAXException e) {
throw new XMLException("Cannot set the schema - please fix the schema or the location",e);
}
}
| Creates the schema object. |
public org.smpte_ra.schemas.st2067_2_2013.CompositionTimecodeType buildCompositionTimeCode(BigInteger compositionEditRate){
org.smpte_ra.schemas.st2067_2_2013.CompositionTimecodeType compositionTimecodeType=new CompositionTimecodeType();
compositionTimecodeType.setTimecodeDropFrame(false);
compositionTimecodeType.setTimecodeRate(compositionEditRate);
compositionTimecodeType.setTimecodeStartAddress(IMFUtils.generateTimecodeStartAddress());
return compositionTimecodeType;
}
| A method to construct a CompositionTimecodeType conforming to the 2013 schema |
public KeyPair generateKeyPair(){
KeyPairGenerator keyGen=null;
SecureRandom random=null;
try {
random=SecureRandom.getInstance(SecurityUtil.getSecuredRandomAlgorithm());
keyGen=KeyPairGenerator.getInstance(KeyCertificateAlgorithmValuesHolder.DEFAULT_KEY_ALGORITHM);
keyGen.initialize(valuesHolder.getKeySize(),random);
return keyGen.generateKeyPair();
}
catch ( Exception e) {
throw SecurityException.fatals.noSuchAlgorithmException(SecurityUtil.getSecuredRandomAlgorithm(),e);
}
finally {
if (keyGen != null) {
SecurityUtil.clearSensitiveData(keyGen);
}
if (random != null) {
SecurityUtil.clearSensitiveData(random);
}
}
}
| Generates a key pair |
public List<V> values(){
List<V> list=new ArrayList<V>();
for ( List<V> value : map.values()) {
list.addAll(value);
}
return Collections.unmodifiableList(list);
}
| Gets all the values in the multimap. |
public QuantiserIndex(SpatialClusters<?> quantiser){
this.quantiser=quantiser;
}
| Construct a QuantiserIndex from an existing quantiser |
@Override public Object eGet(int featureID,boolean resolve,boolean coreType){
switch (featureID) {
case GamlPackage.PARAMETER__BUILT_IN_FACET_KEY:
return getBuiltInFacetKey();
}
return super.eGet(featureID,resolve,coreType);
}
| <!-- begin-user-doc --> <!-- end-user-doc --> |
public MiniDrawer withDrawer(@NonNull Drawer drawer){
this.mDrawer=drawer;
return this;
}
| Provide the Drawer which will be used as dataSource for the drawerItems |
public DefaultRetryPolicy(int initialTimeoutMs,int maxNumRetries,float backoffMultiplier){
mCurrentTimeoutMs=initialTimeoutMs;
mMaxNumRetries=maxNumRetries;
mBackoffMultiplier=backoffMultiplier;
}
| Constructs a new retry policy. |
public TransitionItemProvider(AdapterFactory adapterFactory){
super(adapterFactory);
}
| This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> |
public void mark(int limit){
}
| <i>This operation is not supported</i>. |
private void addDbMetaDataEntry(List<Map<String,String>> list,String name,String value){
Map<String,String> entry=new LinkedHashMap<>();
entry.put("propertyName",getMessageSourceAccessor().getMessage(name));
entry.put("propertyValue",value);
list.add(entry);
}
| Adds the db meta data entry. |
public static boolean isStandardLanguage(Locale locale){
if (Locale.ENGLISH.equals(locale) || Locale.GERMAN.equals(locale) || Locale.JAPANESE.equals(locale)) {
return true;
}
return false;
}
| check if the locale is standard language |
protected boolean isCursorPositionCycle(){
return true;
}
| Returns true if the cursor should cycle to the beginning of the text when the user navigates beyond the edge of the text and visa versa. |
public void testBogusArguments() throws Exception {
IllegalArgumentException expected=expectThrows(IllegalArgumentException.class,null);
assertTrue(expected.getMessage().contains("Unknown parameters"));
}
| Test that bogus arguments result in exception |
@Benchmark public long test1_UsingWhileAndMapEntry() throws IOException {
long i=0;
Iterator<Map.Entry<Integer,Integer>> it=map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Integer,Integer> pair=it.next();
i+=pair.getKey() + pair.getValue();
}
return i;
}
| 1. Using iterator and Map.Entry |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.