code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
@DSComment("URL matching utility") @DSSafe(DSCat.UTIL_FUNCTION) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:34:39.371 -0500",hash_original_method="2E3898492678127443A40FFAA44913F1",hash_generated_method="A56B1FF934AE2286266D1A896140FC75") public void addURI(String authority,String path,int code){
if (code < 0) {
throw new IllegalArgumentException("code " + code + " is invalid: it must be positive");
}
String[] tokens=path != null ? PATH_SPLIT_PATTERN.split(path) : null;
int numTokens=tokens != null ? tokens.length : 0;
UriMatcher node=this;
for (int i=-1; i < numTokens; i++) {
String token=i < 0 ? authority : tokens[i];
ArrayList<UriMatcher> children=node.mChildren;
int numChildren=children.size();
UriMatcher child;
int j;
for (j=0; j < numChildren; j++) {
child=children.get(j);
if (token.equals(child.mText)) {
node=child;
break;
}
}
if (j == numChildren) {
child=new UriMatcher();
if (token.equals("#")) {
child.mWhich=NUMBER;
}
else if (token.equals("*")) {
child.mWhich=TEXT;
}
else {
child.mWhich=EXACT;
}
child.mText=token;
node.mChildren.add(child);
node=child;
}
}
node.mCode=code;
}
|
Add a URI to match, and the code to return when this URI is matched. URI nodes may be exact match string, the token "*" that matches any text, or the token "#" that matches only numbers.
|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
ValueAxis rangeAxis=getRangeAxis();
if (rangeAxis != null) {
rangeAxis.configure();
}
}
|
Provides serialization support.
|
@Override public boolean ownInsertsAreVisible(int type){
debugCodeCall("ownInsertsAreVisible",type);
return false;
}
|
Returns whether own inserts are visible.
|
public Result run(Class<?> testClass){
return run(Request.aClass(testClass));
}
|
Run all the tests in <code>class</code>.
|
private void processResponseHeaders(State state,InnerState innerState,HttpResponse response) throws StopRequest {
if (innerState.mContinuingDownload) {
return;
}
readResponseHeaders(state,innerState,response);
try {
state.mFilename=mService.generateSaveFile(mInfo.mFileName,mInfo.mTotalBytes);
}
catch ( DownloaderService.GenerateSaveFileError exc) {
throw new StopRequest(exc.mStatus,exc.mMessage);
}
try {
state.mStream=new FileOutputStream(state.mFilename);
}
catch ( FileNotFoundException exc) {
File pathFile=new File(Helpers.getSaveFilePath(mService));
try {
if (pathFile.mkdirs()) {
state.mStream=new FileOutputStream(state.mFilename);
}
}
catch ( Exception ex) {
throw new StopRequest(DownloaderService.STATUS_FILE_ERROR,"while opening destination file: " + exc.toString(),exc);
}
}
if (Constants.LOGV) {
Log.v(Constants.TAG,"writing " + mInfo.mUri + " to "+ state.mFilename);
}
updateDatabaseFromHeaders(state,innerState);
checkConnectivity(state);
}
|
Read HTTP response headers and take appropriate action, including setting up the destination file and updating the database.
|
public void calculateChainWaveBuffer(float maxAngle,int bufferTime,float angleDecrement,EntityLivingBase entity){
this.calculateChainWaveBuffer(maxAngle,bufferTime,angleDecrement,1.0F,entity);
}
|
Calculates the wave amounts for the given entity (X axis)
|
public static int dehexchar(char c){
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
}
|
Get the hex value of a character (base16).
|
public void nextStep(){
m_nToDo=NEXT;
go();
}
|
Executes next step
|
public Builder deleteEntitlements(){
deleteFields.add("entitlements");
return this;
}
|
deletes all entitlements of a existing user
|
public List<Entry> filter(List<Entry> points,double tolerance){
if (tolerance <= 0) return points;
keep=new boolean[points.size()];
switch (mType) {
case DOUGLAS_PEUCKER:
return reduceWithDouglasPeuker(points,tolerance);
case NONE:
return points;
default :
return points;
}
}
|
Filters according to type.
|
public static Request createCreatePermissionRequest(TransportAddress peerAddress,byte[] transactionID){
Request createPermissionRequest=new Request();
try {
createPermissionRequest.setMessageType(Message.CREATEPERMISSION_REQUEST);
}
catch ( IllegalArgumentException iaex) {
logger.log(Level.FINE,"Failed to set message type.",iaex);
}
createPermissionRequest.putAttribute(AttributeFactory.createXorPeerAddressAttribute(peerAddress,transactionID));
return createPermissionRequest;
}
|
Creates a new TURN CreatePermission <tt>Request</tt> with a specific value for its XOR-PEER-ADDRESS attribute.
|
public Long convertCIMStatisticTime(String statisticTime){
if (statisticTime == null || statisticTime.equals("") || statisticTime.equals(DEFAULT_PROVIDER_TIME)) {
return 0L;
}
String[] parts=statisticTime.split("[\\.\\+\\-]");
Integer year=Integer.parseInt(parts[0].substring(0,4),10) - 1900;
Integer month=Integer.parseInt(parts[0].substring(4,6),10) - 1;
Integer day=Integer.parseInt(parts[0].substring(6,8),10);
Integer hour=Integer.parseInt(parts[0].substring(8,10),10);
Integer min=Integer.parseInt(parts[0].substring(10,12),10);
Integer sec=Integer.parseInt(parts[0].substring(12,14),10);
Integer msec=Integer.parseInt(parts[1].substring(0,3),10);
@SuppressWarnings("deprecation") Date date=new Date(year,month,day,hour,min,sec);
Long millis=date.getTime() + msec;
date=new Date(millis);
return millis;
}
|
Converts the CIM property StatisticTime to msec since the epoch.
|
public void error(String msg,Object arg0){
innerLog(Level.ERROR,null,msg,arg0,UNKNOWN_ARG,UNKNOWN_ARG,null);
}
|
Log a error message.
|
protected ExtendedStandardJavaFileManager(JavaFileManager fileManager,CompiledCode compiledCode,DynamicClassLoader cl){
super(fileManager);
this.compiledCode=compiledCode;
this.cl=cl;
this.cl.setCode(compiledCode);
}
|
Creates a new instance of ForwardingJavaFileManager.
|
UpdateDefArrayOperator(int v1,int v2){
v=new ValueNumberPair(v1,v2);
}
|
Create an operator with a given value number pair
|
public static Float stringToFloat(String s,Float defaultValue){
try {
return Float.parseFloat(s);
}
catch ( NumberFormatException nfe) {
return defaultValue;
}
}
|
Convert a String to a Float, falling back to a defaultValue if the String cannot be parsed. This is useful because there are issues passing an float directly through UimaFIT to a component, and currently we need to pass it as a String and convert it.
|
public static int crossPath(PathIterator p,double x,double y){
int cross=0;
double mx, my, cx, cy;
mx=my=cx=cy=0.0;
double coords[]=new double[6];
while (!p.isDone()) {
switch (p.currentSegment(coords)) {
case PathIterator.SEG_MOVETO:
if (cx != mx || cy != my) {
cross+=crossLine(cx,cy,mx,my,x,y);
}
mx=cx=coords[0];
my=cy=coords[1];
break;
case PathIterator.SEG_LINETO:
cross+=crossLine(cx,cy,cx=coords[0],cy=coords[1],x,y);
break;
case PathIterator.SEG_QUADTO:
cross+=crossQuad(cx,cy,coords[0],coords[1],cx=coords[2],cy=coords[3],x,y);
break;
case PathIterator.SEG_CUBICTO:
cross+=crossCubic(cx,cy,coords[0],coords[1],coords[2],coords[3],cx=coords[4],cy=coords[5],x,y);
break;
case PathIterator.SEG_CLOSE:
if (cy != my || cx != mx) {
cross+=crossLine(cx,cy,cx=mx,cy=my,x,y);
}
break;
}
if (x == cx && y == cy) {
cross=0;
cy=my;
break;
}
p.next();
}
if (cy != my) {
cross+=crossLine(cx,cy,mx,my,x,y);
}
return cross;
}
|
Returns how many times ray from point (x,y) cross path
|
public static String createRangedAttribute(final int actualValue,final int[] steps){
if (null == steps) {
throw new IllegalArgumentException("steps cannot be null");
}
if (steps.length == 0) {
throw new IllegalArgumentException("steps length must be greater than 0");
}
String bucket;
if (actualValue < steps[0]) {
bucket="less than " + steps[0];
}
else if (actualValue >= steps[steps.length - 1]) {
bucket=steps[steps.length - 1] + " and above";
}
else {
int bucketIndex=Arrays.binarySearch(steps,actualValue);
if (bucketIndex < 0) {
bucketIndex=(-bucketIndex) - 2;
}
if (steps[bucketIndex] == (steps[bucketIndex + 1] - 1)) {
bucket=Integer.toString(steps[bucketIndex]);
}
else {
bucket=steps[bucketIndex] + "-" + (steps[bucketIndex + 1] - 1);
}
}
return bucket;
}
|
This part (the method createRangedAttribute) of the Wire software uses source code from the beats2 project. (https://code.google.com/p/beats2/source/browse/trunk/beats/src/com/localytics/android/LocalyticsSession.java#810) Copyright (c) 2009, Char Software, Inc. d/b/a Localytics All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Neither the name of Char Software, Inc., Localytics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY CHAR SOFTWARE, INC. D/B/A LOCALYTICS ''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 CHAR SOFTWARE, INC. D/B/A LOCALYTICS 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. Sorts an int value into a predefined, pre-sorted set of intervals, returning a string representing the new expected value. The array must be sorted in ascending order, with the first element representing the inclusive lower bound and the last element representing the exclusive upper bound. For instance, the array [0,1,3,10] will provide the following buckets: less than 0, 0, 1-2, 3-9, 10 or greater.
|
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
this.knnDistance=in.readDouble();
}
|
Calls the super method and reads the knn distance of this entry from the specified input stream.
|
protected Object readResolve() throws InvalidObjectException {
if (this.getClass() != MessageFormat.Field.class) {
throw new InvalidObjectException("subclass didn't correctly implement readResolve");
}
return ARGUMENT;
}
|
Resolves instances being deserialized to the predefined constants.
|
public void testEventWatcherCancellation() throws Exception {
WatchManager<String> em=new WatchManager<String>();
List<Watch<String>> watches=new LinkedList<Watch<String>>();
watches.add(em.watch(new StringWatchPredicate("hello"),1));
watches.add(em.watch(new StringWatchPredicate("goodbye"),1));
watches.add(em.watch(new StringWatchPredicate("hello again"),1));
em.cancelAll();
for ( Watch<String> w : watches) {
assertTrue("Should be done",w.isDone());
assertTrue("Should be cancelled",w.isCancelled());
try {
w.get();
throw new Exception("Did not get cancellation exception from cancelled watch");
}
catch ( CancellationException e) {
}
}
}
|
Prove that we can cancel all watches by canceling the EventWatcher.
|
QuitDialog(){
quitDialog=buildQuitDialog();
quitDialog.setVisible(false);
quitDialog.addHierarchyBoundsListener(new ParentResizeListener());
}
|
Create a new QuitDialog.
|
private <T>T mu(T obj) throws IgniteCheckedException {
return marshaller.unmarshal(marshaller.marshal(obj),null);
}
|
Marshal/unmarshal object.
|
public String executeCommand(String[] shellCommand){
Process shellProcess=null;
String response=null;
BufferedReader shellInput=null;
try {
if (shellCommand != null) {
shellProcess=Runtime.getRuntime().exec(shellCommand);
}
}
catch ( IOException e) {
Log.e(LOG_TAG,"Shell command processing failed." + e);
}
if (shellProcess != null) {
shellInput=new BufferedReader(new InputStreamReader(shellProcess.getInputStream()));
}
try {
while (shellInput != null && (response=shellInput.readLine()) != null) {
if (Constants.DEBUG_MODE_ENABLED) {
Log.d(LOG_TAG,"Shell Executor Result." + response);
}
}
}
catch ( IOException e) {
Log.e(LOG_TAG,"Shell input processing failed." + e);
}
finally {
StreamHandler.closeBufferedReader(shellInput,LOG_TAG);
}
return response;
}
|
Executes shell commands on the device.
|
public button addElement(String hashcode,String element){
addElementToRegistry(hashcode,element);
return (this);
}
|
Adds an Element to the element.
|
public long position(Clob searchStr,long start) throws SerialException, SQLException {
isValid();
return position(searchStr.getSubString(1,(int)searchStr.length()),start);
}
|
Returns the position in this <code>SerialClob</code> object where the given <code>Clob</code> signature begins, starting the search at the specified position. This method returns <code>-1</code> if the pattern is not found.
|
protected final void deflate() throws IOException {
int len=def.deflate(buf,0,buf.length);
if (len > 0) {
writeOut(buf,0,len);
}
}
|
Writes next block of compressed data to the output stream.
|
public void attributeReplaced(HttpSessionBindingEvent event){
if (event.getName().equals(EVENT_KEY) && !isAnonymous()) {
SecurityContext securityContext=(SecurityContext)event.getValue();
if (securityContext.getAuthentication() != null) {
if (securityContext.getAuthentication().getPrincipal() instanceof User) {
User user=(User)securityContext.getAuthentication().getPrincipal();
addUsername(user);
}
}
}
}
|
Needed for Acegi Security 1.0, as it adds an anonymous user to the session and then replaces it after authentication. http://forum.springframework.org/showthread.php?p=63593
|
@Override public int gotoDest(PdfObject aData,final int eventType,int command){
final boolean debugDest=false;
int page=-1;
if (showMethods) {
System.out.println("DefaultActionHandler.gotoDest()");
}
PdfArrayIterator Dest=DestHandler.getDestFromObject(aData,currentPdfFile);
if (Dest != null && Dest.hasMoreTokens()) {
if (eventType == MOUSECLICKED) {
String filename=aData.getTextStreamValue(PdfDictionary.F);
if (filename == null) {
final PdfObject fDic=aData.getDictionary(PdfDictionary.F);
if (fDic != null) {
filename=fDic.getTextStreamValue(PdfDictionary.F);
}
}
if (filename != null && filename.indexOf('/') == -1 && filename.indexOf('\\') == -1) {
filename=decode_pdf.getObjectStore().getCurrentFilepath() + filename;
}
if (filename != null) {
int index=filename.indexOf('\\');
while (index != -1) {
filename=filename.substring(0,index) + '/' + filename.substring(index + ("\\".length()),filename.length());
index=filename.indexOf('\\');
}
final int slashIndex=filename.indexOf(":/");
if ((slashIndex == -1 || slashIndex > 1) && !filename.startsWith("/")) {
final File fileStart=new File(decode_pdf.getFileName());
filename=fileStart.getParent() + '/' + filename;
}
index=filename.indexOf("/../");
if (index != -1) {
int start=index - 1;
while (start > 0) {
if ((filename.charAt(start) == '/') || start == 0) {
break;
}
start--;
}
if (start > 0) {
filename=filename.substring(0,start) + filename.substring(index + 3,filename.length());
}
}
}
String pageRef="";
if (Dest.getTokenCount() > 0) {
if (Dest.isNextValueNull()) {
return -1;
}
final int possiblePage=Dest.getNextValueAsInteger(false) + 1;
pageRef=Dest.getNextValueAsString(true);
if (pageRef.endsWith(" R")) {
page=decode_pdf.getPageFromObjectRef(pageRef);
}
else if (possiblePage > 0 && possiblePage != PdfDictionary.Null) {
page=possiblePage;
}
if (debugDest) {
System.out.println("pageRef=" + pageRef + " page="+ page+ ' '+ aData.getObjectRefAsString());
}
if (page == -1) {
final String newRef=currentPdfFile.convertNameToRef(pageRef);
if (newRef != null && newRef.endsWith(" R")) {
page=decode_pdf.getPageFromObjectRef(newRef);
}
}
}
if (Dest.getTokenCount() == 0 && aData.getNameAsConstant(PdfDictionary.S) == PdfDictionary.GoToR) {
command=PdfDictionary.GoToR;
}
if (debugDest) {
System.out.println("Command=" + PdfDictionary.showAsConstant(command));
}
switch (command) {
case PdfDictionary.Dest:
if (Dest.getTokenCount() > 1) {
final int type=Dest.getNextValueAsConstant(true);
if (debugDest) {
System.out.println("Type=" + PdfDictionary.showAsConstant(type));
}
Integer scale=null;
Rectangle position=null;
switch (type) {
case PdfDictionary.XYZ:
final float x=Dest.getNextValueAsFloat();
final float y=Dest.getNextValueAsFloat();
position=new Rectangle((int)x,(int)y,10,10);
break;
case PdfDictionary.Fit:
scale=-3;
break;
case PdfDictionary.FitB:
scale=-3;
break;
case PdfDictionary.FitH:
scale=-1;
if (Dest.hasMoreTokens()) {
final float top=Dest.getNextValueAsFloat();
position=new Rectangle(10,(int)top,10,10);
}
break;
case PdfDictionary.FitR:
final float fitR_left=Dest.getNextValueAsFloat();
final float fitR_bottom=Dest.getNextValueAsFloat();
final float fitR_right=Dest.getNextValueAsFloat();
final float fitR_top=Dest.getNextValueAsFloat();
final org.jpedal.gui.GUIFactory gui=((GUIFactory)decode_pdf.getExternalHandler(Options.GUIContainer));
if (gui != null) {
final float scaling=gui.scaleToVisible(fitR_left,fitR_right,fitR_top,fitR_bottom);
scale=(int)(100f / scaling);
}
break;
}
changeTo(filename,page,position,scale,true);
}
break;
case PdfDictionary.GoTo:
if (page != -1) {
changeTo(null,page,null,null,true);
}
break;
case PdfDictionary.GoToR:
final int index=pageRef.indexOf("P.");
if (index != -1) {
pageRef=pageRef.substring(index + 2,pageRef.length());
page=Integer.parseInt(pageRef);
}
else if (pageRef.equals("F")) {
page=1;
}
else {
page=1;
}
if (new File(filename).exists()) {
if (page != -1) {
changeTo(filename,page,null,null,true);
}
LogWriter.writeFormLog("{DefaultActionHamdler.A} Form has GoToR command, needs methods for opening new file on page specified",FormStream.debugUnimplemented);
}
else {
showMessageDialog("The file specified " + filename + " Does Not Exist!");
}
break;
}
}
else {
setCursor(eventType);
}
}
else {
if (eventType == MOUSECLICKED) {
PdfObject data=aData.getDictionary(PdfDictionary.A);
if (data != null) {
String filename=data.getTextStreamValue(PdfDictionary.F);
if (filename == null) {
final PdfObject fDic=data.getDictionary(PdfDictionary.F);
if (fDic != null) {
filename=fDic.getTextStreamValue(PdfDictionary.F);
}
}
if (filename != null && filename.indexOf('/') == -1 && filename.indexOf('\\') == -1) {
filename=decode_pdf.getObjectStore().getCurrentFilepath() + filename;
}
if (filename != null) {
int index=filename.indexOf('\\');
while (index != -1) {
filename=filename.substring(0,index) + '/' + filename.substring(index + ("\\".length()),filename.length());
index=filename.indexOf('\\');
}
final int slashIndex=filename.indexOf(":/");
if ((slashIndex == -1 || slashIndex > 1) && !filename.startsWith("/")) {
final File fileStart=new File(decode_pdf.getFileName());
filename=fileStart.getParent() + '/' + filename;
}
index=filename.indexOf("/../");
if (index != -1) {
int start=index - 1;
while (start > 0) {
if ((filename.charAt(start) == '/') || start == 0) {
break;
}
start--;
}
if (start > 0) {
filename=filename.substring(0,start) + filename.substring(index + 3,filename.length());
}
}
}
changeTo(filename,1,null,null,true);
}
}
else {
setCursor(eventType);
}
}
return page;
}
|
public as also called from Viewer to reset new page or -1 returned
|
private void writeQNameAttribute(java.lang.String namespace,java.lang.String attName,javax.xml.namespace.QName qname,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace=qname.getNamespaceURI();
java.lang.String attributePrefix=xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix=registerPrefix(xmlWriter,attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue=attributePrefix + ":" + qname.getLocalPart();
}
else {
attributeValue=qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attributeValue);
}
else {
registerPrefix(xmlWriter,namespace);
xmlWriter.writeAttribute(namespace,attName,attributeValue);
}
}
|
Util method to write an attribute without the ns prefix
|
public void visitAttribute(Attribute attr){
if (fv != null) {
fv.visitAttribute(attr);
}
}
|
Visits a non standard attribute of the field.
|
@DSSafe(DSCat.SAFE_LIST) @DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:55.270 -0500",hash_original_method="3F7D901C5D2A92F81B8BE7A716DA67AE",hash_generated_method="FED4FBCEA05778094376463F7BBF91F1") public int compare(Object obj1,Object obj2){
if (obj1 == obj2) {
return 0;
}
AttributeTypeAndValue atav1=(AttributeTypeAndValue)obj1;
AttributeTypeAndValue atav2=(AttributeTypeAndValue)obj2;
String kw1=atav1.getType().getName();
String kw2=atav2.getType().getName();
if (kw1 != null && kw2 == null) {
return -1;
}
if (kw1 == null && kw2 != null) {
return 1;
}
if (kw1 != null && kw2 != null) {
return kw1.compareTo(kw2);
}
return compateOids(atav1.getType(),atav2.getType());
}
|
compares two AttributeTypeAndValues
|
public static String parseCharset(Map<String,String> headers,String defaultCharset){
String contentType=headers.get(HTTP.CONTENT_TYPE);
if (contentType != null) {
String[] params=contentType.split(";");
for (int i=1; i < params.length; i++) {
String[] pair=params[i].trim().split("=");
if (pair.length == 2) {
if (pair[0].equals("charset")) {
return pair[1];
}
}
}
}
return defaultCharset;
}
|
Retrieve a charset from headers
|
public ConstantSize(int value,Unit unit){
this.value=value;
this.unit=unit;
}
|
Constructs a ConstantSize for the given size and unit.
|
public void cancelAnimations(){
mAnimationManager.cancelAnimations();
}
|
Cancels on-going animations
|
protected void updateFromColumnModelChange(TableColumnModel oldModel){
if (oldModel != null && columnModelListener != null) {
oldModel.removeColumnModelListener(columnModelListener);
}
populatePopup();
table.getColumnModel().addColumnModelListener(getColumnModelListener());
}
|
Adjusts internal state after table's column model property has changed. Handles cleanup of listeners to the old/new columnModel (Note, that it listens to the column model only if it can control column visibility). Updates content of popup.
|
public boolean forEachEntry(TLongObjectProcedure<V> procedure){
long[] keys=_set;
V[] values=_values;
for (int i=keys.length; i-- > 0; ) {
if (isFull(values,i) && !procedure.execute(keys[i],unwrapNull(values[i]))) {
return false;
}
}
return true;
}
|
Executes <tt>procedure</tt> for each key/value entry in the map.
|
protected String defaultClassifierString(){
return "weka.classifiers.trees.DecisionStump";
}
|
String describing default classifier.
|
private int calculatedWeightedValue(mxGraphAbstractHierarchyCell currentCell,Collection<mxGraphAbstractHierarchyCell> collection){
int totalWeight=0;
Iterator<mxGraphAbstractHierarchyCell> iter=collection.iterator();
while (iter.hasNext()) {
mxGraphAbstractHierarchyCell cell=iter.next();
if (currentCell.isVertex() && cell.isVertex()) {
totalWeight++;
}
else if (currentCell.isEdge() && cell.isEdge()) {
totalWeight+=8;
}
else {
totalWeight+=2;
}
}
return totalWeight;
}
|
Calculates the priority the specified cell has based on the type of its cell and the cells it is connected to on the next layer
|
public void stopPlaying(){
mProcessButtonClick=true;
unregisterReceiver(mPingReceiver);
mPingReceiver=null;
mStartOrStopFab.setImageResource(android.R.drawable.ic_media_play);
}
|
Called by the PingReceiver when "ping/pong" is done.
|
private String commandRemoveCategory(String[] parameters){
if (parameters.length != 1) {
return "Remove category: Invalid number of parameters.";
}
int result=removeCategory(parameters[0]);
return "Removed category '" + parameters[0] + "' from "+ result+ " entries.";
}
|
Removes the given categories from all entries.
|
protected GeneralPath updateShape(GeneralPath currentShape,OMGeometry geometry,Projection p,boolean forceProject){
GeneralPath newShapePart=null;
if (geometry != null && geometry.isVisible()) {
if (forceProject) {
geometry.generate(p);
}
else {
geometry.regenerate(p);
}
newShapePart=geometry.getShape();
}
return appendShapeEdge(currentShape,newShapePart,connectParts);
}
|
Given an OMGeometry, check its visibility and if visible, generate it if required and add the result to the provided current shape. Does not call setShape().
|
@SuppressWarnings("unchecked") private T[] combinedBufferToItemsArray(boolean ordered){
T[] outArr=null;
final int extra=2;
final int outArrCap=getRetainedItems();
outArr=(T[])Array.newInstance(minValue_.getClass(),outArrCap + extra);
outArr[0]=minValue_;
outArr[1]=maxValue_;
System.arraycopy(combinedBuffer_,0,outArr,extra,baseBufferCount_);
long bits=bitPattern_;
if (bits > 0) {
int index=extra + baseBufferCount_;
for (int level=0; bits != 0L; level++, bits>>>=1) {
if ((bits & 1L) > 0L) {
System.arraycopy(combinedBuffer_,(2 + level) * k_,outArr,index,k_);
index+=k_;
}
}
}
if (ordered) {
Arrays.sort(outArr,extra,baseBufferCount_ + extra,comparator_);
}
return outArr;
}
|
Returns an array of items in compact form, including min and max extracted from the Combined Buffer.
|
public static List<Class<?>> findAllImplementations(Class<?> c,boolean everything,boolean parameterizable){
if (c == null) {
return Collections.emptyList();
}
if (!everything && parameterizable) {
return findAllImplementations(c);
}
if (!contains(c)) {
ELKIServiceLoader.load(c);
ELKIServiceScanner.load(c);
}
List<Class<?>> known=findAllImplementations(c);
HashSet<Class<?>> dupes=new HashSet<>(known);
for (Iterator<Class<?>> iter=ELKIServiceScanner.nonindexedClasses(); iter.hasNext(); ) {
Class<?> cls=iter.next();
if (dupes.contains(cls)) {
continue;
}
if (!everything && (Modifier.isInterface(cls.getModifiers()) || Modifier.isAbstract(cls.getModifiers()) || Modifier.isPrivate(cls.getModifiers()))) {
continue;
}
if (!c.isAssignableFrom(cls)) {
continue;
}
if (parameterizable) {
boolean instantiable=false;
try {
instantiable=cls.getConstructor() != null;
}
catch ( Exception|Error e) {
}
try {
instantiable=instantiable || ClassGenericsUtil.getParameterizer(cls) != null;
}
catch ( Exception|Error e) {
}
if (!instantiable) {
continue;
}
}
known.add(cls);
dupes.add(cls);
}
return known;
}
|
Find all implementations of a given class in the classpath. Note: returned classes may be abstract.
|
public static ICheckpointProtocol create(final IRawStore store,final IndexMetadata metadata){
final ICheckpointProtocol ndx;
switch (metadata.getIndexType()) {
case BTree:
ndx=BTree.create(store,metadata);
break;
case HTree:
ndx=HTree.create(store,(HTreeIndexMetadata)metadata);
break;
case Stream:
ndx=Stream.create(store,(StreamIndexMetadata)metadata);
break;
default :
throw new AssertionError("Unknown: " + metadata.getIndexType());
}
return ndx;
}
|
Generic method to create a persistence capable data structure (GIST compatible, core implementation).
|
protected void configDelta(Parameterization config){
Flag absoluteF=new Flag(LimitEigenPairFilter.Parameterizer.EIGENPAIR_FILTER_ABSOLUTE);
if (config.grab(absoluteF)) {
settings.absolute=absoluteF.isTrue();
}
DoubleParameter deltaP=new DoubleParameter(LimitEigenPairFilter.Parameterizer.EIGENPAIR_FILTER_DELTA).addConstraint(CommonConstraints.GREATER_EQUAL_ZERO_DOUBLE);
if (!settings.absolute) {
deltaP.setDefaultValue(DEFAULT_DELTA);
}
else {
deltaP.addConstraint(CommonConstraints.LESS_EQUAL_ONE_DOUBLE);
}
if (config.grab(deltaP)) {
settings.delta=deltaP.doubleValue();
}
}
|
Configure the delta parameter.
|
public void testRun(){
System.out.println("run");
Page mockPage=EasyMock.createMock(Page.class);
EasyMock.expect(mockPage.getURL()).andReturn("http://my.testUrl.org").times(2);
ContentDataService mockContentDataService=EasyMock.createMock(ContentDataService.class);
SSP mockSSP=EasyMock.createMock(SSP.class);
Date date=new Date();
DateFactory mockDateFactory=EasyMock.createMock(DateFactory.class);
EasyMock.expect(mockDateFactory.createDate()).andReturn(date).once();
EasyMock.expect(mockContentDataService.getSSP(date,"http://my.testUrl.org","My Page Content",mockPage,HttpStatus.SC_OK)).andReturn(mockSSP).once();
Map<String,String> fileMap=new HashMap<>();
fileMap.put("http://my.testUrl.org","My Page Content");
EasyMock.replay(mockPage);
EasyMock.replay(mockSSP);
EasyMock.replay(mockContentDataService);
EasyMock.replay(mockDateFactory);
FileContentLoaderImpl instance=new FileContentLoaderImpl(mockContentDataService,fileMap,mockDateFactory);
instance.setWebResource(mockPage);
instance.run();
assertTrue(instance.getResult().contains(mockSSP));
EasyMock.verify(mockPage);
EasyMock.verify(mockSSP);
EasyMock.verify(mockContentDataService);
EasyMock.verify(mockDateFactory);
}
|
Test of run method, of class FileContentLoaderImpl.
|
public void ensureNavigationProperties(StructuredType entityType) throws ODataException {
List<String> missingNavigationPropertyNames=new ArrayList<>();
for ( StructuralProperty property : entityType.getStructuralProperties()) {
if ((property instanceof NavigationProperty) && !property.isNullable()) {
LOG.debug("Validating non-nullable NavigationProperty property : {}",property.getName());
if (!links.containsKey(property.getName())) {
missingNavigationPropertyNames.add(property.getName());
}
}
}
if (missingNavigationPropertyNames.size() != 0) {
StringJoiner joiner=new StringJoiner(",");
missingNavigationPropertyNames.forEach(null);
throw new ODataUnmarshallingException("The request does not specify the navigation links for '" + joiner.toString() + ".");
}
}
|
Ensure that non nullable navigation properties are present.
|
public static void buildList(Map<String,Object> nd,List<Map<String,Object>> lst,int depth){
String id=(String)nd.get("id");
String nm=(String)nd.get("name");
String spc="";
for (int i=0; i < depth; i++) spc+=" ";
Map<String,Object> map=FastMap.newInstance();
map.put("dataCategoryId",id);
map.put("categoryName",spc + nm);
if (id != null && !id.equals("ROOT") && !id.equals("")) {
lst.add(map);
}
List<Map<String,Object>> kids=UtilGenerics.checkList(nd.get("kids"));
for ( Map<String,Object> kidNode : kids) {
buildList(kidNode,lst,depth + 1);
}
}
|
Takes a DataCategory structure and builds a list of maps, one value (id) is the dataCategoryId value and the other is an indented string suitable for use in a drop-down pick list.
|
void repaintIfShowing(){
if (isContainerShowing()) {
container.postPaintEvent();
}
}
|
Repaints item if it is showing
|
public static RegressionDataSet usingDPPList(List<DataPointPair<Double>> list){
RegressionDataSet rds=new RegressionDataSet();
rds.dataPoints=list;
rds.numNumerVals=list.get(0).getDataPoint().numNumericalValues();
rds.numericalVariableNames=new ArrayList<String>(rds.getNumNumericalVars());
for (int i=0; i < rds.getNumNumericalVars(); i++) rds.numericalVariableNames.add("Numeric Input " + (i + 1));
rds.categories=CategoricalData.copyOf(list.get(0).getDataPoint().getCategoricalData());
return rds;
}
|
Creates a new data set that uses the given list as its backing list. No copying is done, and changes to this list will be reflected in this data set, and the other way.
|
public boolean provides(Class<?> type){
if (adapterMemo.getDisabled()) {
return false;
}
if (type.equals(jmri.ThrottleManager.class)) {
return true;
}
if (type.equals(jmri.SensorManager.class)) {
return true;
}
if (type.equals(jmri.TurnoutManager.class)) {
return true;
}
if (type.equals(AliasMap.class)) {
return true;
}
if (type.equals(MessageBuilder.class)) {
return true;
}
if (type.equals(MimicNodeStore.class)) {
return true;
}
if (type.equals(Connection.class)) {
return true;
}
if (type.equals(MemoryConfigurationService.class)) {
return true;
}
if (type.equals(DatagramService.class)) {
return true;
}
if (type.equals(NodeID.class)) {
return true;
}
return false;
}
|
Tells which managers this provides by class
|
public void delete() throws IOException {
close();
deleteContents(directory);
}
|
Closes the cache and deletes all of its stored values. This will delete all files in the cache directory including files that weren't created by the cache.
|
protected static JSONNode toJSON(Instance inst){
JSONNode result;
JSONNode values;
int i;
boolean sparse;
result=new JSONNode();
sparse=(inst instanceof SparseInstance);
result.addPrimitive(SPARSE,sparse);
result.addPrimitive(WEIGHT,inst.weight());
values=result.addArray(VALUES);
if (sparse) {
for (i=0; i < inst.numValues(); i++) {
if (inst.isMissing(inst.index(i))) values.addArrayElement(inst.index(i) + SPARSE_SEPARATOR + MISSING_VALUE);
else if (inst.toString(inst.index(i)).equals("'" + MISSING_VALUE + "'")) values.addArrayElement(inst.index(i) + SPARSE_SEPARATOR + "'"+ MISSING_VALUE+ "'");
else values.addArrayElement(inst.index(i) + SPARSE_SEPARATOR + inst.toString(inst.index(i)));
}
}
else {
for (i=0; i < inst.numAttributes(); i++) {
if (inst.isMissing(i)) values.addArrayElement(MISSING_VALUE);
else if (inst.toString(i).equals("'" + MISSING_VALUE + "'")) values.addArrayElement("'" + MISSING_VALUE + "'");
else values.addArrayElement(inst.toString(i));
}
}
return result;
}
|
Turns the Instance into a JSON object.
|
@Override public int compare(T a,T b) throws ClassCastException {
Double cla=Double.valueOf(a.getCloudletTotalLength());
Double clb=Double.valueOf(b.getCloudletTotalLength());
return cla.compareTo(clb);
}
|
Compares two Cloudlets.
|
protected void createButtons(Composite sectionArea,FormToolkit toolkit,boolean add,boolean edit,boolean remove){
doCreateButtons(sectionArea,toolkit,false,true,false);
}
|
Only create the edit button
|
public boolean isInView(){
return inView;
}
|
Returns true if the member is in the current group view.
|
public MenuItemAdapter(Context context,Integer[] itemIds){
mContext=context;
mItems=itemIds;
mPadding=mContext.getResources().getDimensionPixelSize(R.dimen.afc_5dp);
mItemPaddingLeft=mContext.getResources().getDimensionPixelSize(R.dimen.afc_context_menu_item_padding_left);
}
|
Creates new instance.<br>
|
public EgDemandDetails insertDemandDetails(final String demandReason,final BigDecimal amount,final Installment inst){
EgDemandDetails demandDetail=null;
Module ptModule=null;
if (amount != null && amount.compareTo(BigDecimal.ZERO) > 0) {
ptModule=module();
final EgDemandReasonMaster egDemandReasonMaster=demandGenericDAO.getDemandReasonMasterByCode(demandReason,ptModule);
if (egDemandReasonMaster == null) throw new ApplicationRuntimeException(demandReason + " Demand reason Master is null in method insertDemandDetails");
final EgDemandReason egDemandReason=demandGenericDAO.getDmdReasonByDmdReasonMsterInstallAndMod(egDemandReasonMaster,inst,ptModule);
if (egDemandReason == null) throw new ApplicationRuntimeException(demandReason + " Demand reason is null in method insertDemandDetails ");
if (DEMANDRSN_CODE_ADVANCE.equals(egDemandReason.getEgDemandReasonMaster().getCode())) {
demandDetail=createDemandDetails(egDemandReason,amount,BigDecimal.ZERO);
}
else {
demandDetail=createDemandDetails(egDemandReason,BigDecimal.ZERO,amount);
}
}
return demandDetail;
}
|
Method used to insert demand details in EgDemandDetail table.
|
public static String encodeBytes(byte[] source,int off,int len){
String encoded=null;
try {
encoded=encodeBytes(source,off,len,NO_OPTIONS);
}
catch ( java.io.IOException ex) {
assert false : ex.getMessage();
}
assert encoded != null;
return encoded;
}
|
Encodes a byte array into Base64 notation. Does not GZip-compress data. <p>As of v 2.3, if there is an error, the method will throw an java.io.IOException. <b>This is new to v2.3!</b> In earlier versions, it just returned a null value, but in retrospect that's a pretty poor way to handle it.</p>
|
public static byte[] serialize(Object obj){
try {
if (serializer != null) {
return serializer.serialize(obj);
}
ByteArrayOutputStream out=new ByteArrayOutputStream();
ObjectOutputStream os=new ObjectOutputStream(out);
os.writeObject(obj);
return out.toByteArray();
}
catch ( Throwable e) {
throw DbException.get(ErrorCode.SERIALIZATION_FAILED_1,e,e.toString());
}
}
|
Serialize the object to a byte array, using the serializer specified by the connection info if set, or the default serializer.
|
public static void permute(Object[] list,int[] indexes){
Object[] copy=(Object[])list.clone();
for (int i=list.length; --i >= 0; ) list[i]=copy[indexes[i]];
}
|
A non-generic variant of reordering, specialized for <tt>Object[]</tt>, same semantics. Quicker than generic reordering. Also for convenience (forget about the Swapper object).
|
public static <K,V>HashMap<K,V> hashMap(int initialCapacity,float loadFactor){
return new HashMap<K,V>(initialCapacity,loadFactor);
}
|
Create a new HashMap.
|
public void clear(){
sortedSet.clear();
}
|
Clears the queue.
|
@Override protected void processKeyEvent(KeyEvent e){
curPanel.dispatchEvent(e);
if (!e.isConsumed()) {
super.processKeyEvent(e);
}
}
|
In addition to the default Dialog processKeyEvent, this method dispatches a KeyEvent to the client gui. This enables all of the gui hotkeys.
|
@RequestMapping(value="/files/{id}",method=RequestMethod.DELETE,produces=MediaType.APPLICATION_JSON_VALUE) @Timed public void delete(@PathVariable Long id){
log.debug("REST request to delete file : {}",id);
dataFileRepository.delete(id);
}
|
DELETE /files/:id delete the "id" file.
|
public void printMessage(Diagnostic.Kind kind,CharSequence msg,Element e,AnnotationMirror a,AnnotationValue v){
JavaFileObject oldSource=null;
JavaFileObject newSource=null;
JCDiagnostic.DiagnosticPosition pos=null;
JavacElements elemUtils=processingEnv.getElementUtils();
Pair<JCTree,JCCompilationUnit> treeTop=elemUtils.getTreeAndTopLevel(e,a,v);
if (treeTop != null) {
newSource=treeTop.snd.sourcefile;
if (newSource != null) {
oldSource=log.useSource(newSource);
pos=treeTop.fst.pos();
}
}
try {
switch (kind) {
case ERROR:
errorCount++;
boolean prev=log.multipleErrors;
log.multipleErrors=true;
try {
log.error(pos,"proc.messager",msg.toString());
}
finally {
log.multipleErrors=prev;
}
break;
case WARNING:
warningCount++;
log.warning(pos,"proc.messager",msg.toString());
break;
case MANDATORY_WARNING:
warningCount++;
log.mandatoryWarning(pos,"proc.messager",msg.toString());
break;
default :
log.note(pos,"proc.messager",msg.toString());
break;
}
}
finally {
if (newSource != null) log.useSource(oldSource);
}
}
|
Prints a message of the specified kind at the location of the annotation value inside the annotation mirror of the annotated element.
|
private int height(Node x){
if (x == null) return -1;
return x.height;
}
|
Returns the height of the subtree.
|
public static void write(byte[] from,File to) throws IOException {
asByteSink(to).write(from);
}
|
Overwrites a file with the contents of a byte array.
|
private void writeAttribute(java.lang.String namespace,java.lang.String attName,java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName,attValue);
}
else {
registerPrefix(xmlWriter,namespace);
xmlWriter.writeAttribute(namespace,attName,attValue);
}
}
|
Util method to write an attribute without the ns prefix
|
protected void validateOnStatus(){
if (Command.STATUS.equals(getCommand())) {
}
}
|
Validates the arguments passed to the Builder when the 'status' command has been issued.
|
private boolean verifyReservedBit1ForPMCE(WebSocketFrame frame) throws WebSocketException {
if (frame.isTextFrame() || frame.isBinaryFrame()) {
return true;
}
return false;
}
|
Verify the RSV1 bit of a frame using the rule described in RFC 7692. See <a href="https://tools.ietf.org/html/rfc7692#section-6">6. Framing</a> in <a href="https://tools.ietf.org/html/rfc7692">RFC 7692</a> for details.
|
int encryptFinal(byte[] in,int inOfs,int len,byte[] out,int outOfs) throws IllegalBlockSizeException, ShortBufferException {
if (out.length - outOfs < (len + tagLenBytes)) {
throw new ShortBufferException("Output buffer too small");
}
processAAD();
if (len > 0) {
doLastBlock(in,inOfs,len,out,outOfs,true);
}
byte[] lengthBlock=getLengthBlock(sizeOfAAD * 8,processed * 8);
ghashAllToS.update(lengthBlock);
byte[] s=ghashAllToS.digest();
byte[] sOut=new byte[s.length];
GCTR gctrForSToTag=new GCTR(embeddedCipher,this.preCounterBlock);
gctrForSToTag.doFinal(s,0,s.length,sOut,0);
System.arraycopy(sOut,0,out,(outOfs + len),tagLenBytes);
return (len + tagLenBytes);
}
|
Performs encryption operation for the last time.
|
public void storeOriginals(){
mStartingStartTrim=mStartTrim;
mStartingEndTrim=mEndTrim;
mStartingRotation=mRotation;
}
|
If the start / end trim are offset to begin with, store them so that animation starts from that offset.
|
public static short toShort(byte[] bytes,int offset,final int length){
if (length != SIZEOF_SHORT || offset + length > bytes.length) {
throw explainWrongLengthOrOffset(bytes,offset,length,SIZEOF_SHORT);
}
short n=0;
n^=bytes[offset] & 0xFF;
n<<=8;
n^=bytes[offset + 1] & 0xFF;
return n;
}
|
Converts a byte array to a short value
|
private Promise<PeerSession> pickCachedSession(int uid,final int keyGroupId){
return ManagedList.of(peerSessions.getValue(uid)).flatMap(PeerSessionsStorage.SESSIONS).filter(PeerSession.BY_THEIR_GROUP(keyGroupId)).sorted(PeerSession.COMPARATOR).firstPromise();
}
|
Picking cached session
|
public Vector subtract(Vector... others){
double newX=x, newY=y, newZ=z;
for ( Vector other : others) {
newX-=other.x;
newY-=other.y;
newZ-=other.z;
}
return new Vector(newX,newY,newZ);
}
|
Subtract a list of vectors from this vector and return the result as a new vector.
|
@Override public boolean eIsSet(int featureID){
switch (featureID) {
case N4JSPackage.PARAMETERIZED_ACCESS__TYPE_ARGS:
return typeArgs != null && !typeArgs.isEmpty();
}
return super.eIsSet(featureID);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public HardDiskIcon(){
this.width=getOrigWidth();
this.height=getOrigHeight();
}
|
Creates a new transcoded SVG image.
|
public LocalRepository(String name) throws RepositoryException {
this(name,getDefaultRepositoryFolder(name));
}
|
Creates a file-based repository in a default location.
|
public static void enableOverScroll(AbsListView listView,int distance){
try {
Field overscrollDistance=AbsListView.class.getDeclaredField("mOverscrollDistance");
overscrollDistance.setAccessible(true);
overscrollDistance.setInt(listView,distance);
}
catch ( NoSuchFieldException e) {
e.printStackTrace();
}
catch ( IllegalAccessException e) {
e.printStackTrace();
}
}
|
set specific distance for AbsListView to enable the over scroll effect
|
public static Spannable filterFromResource(Context context,Spannable spannable,int fontSize){
return spannable == null ? null : filterFromResource(context,spannable,fontSize,HEAD_NAME,null);
}
|
load emoji from resource
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 13:00:44.812 -0500",hash_original_method="D6339CFBAEA862E2360C9454B8ED0BC8",hash_generated_method="75DBB3A9402117CEFF362A3890042B39") public boolean isPreclosed(){
return preclosed;
}
|
Return true if this element has been preclosed.
|
public static Font createBitmapFont(Image bitmap,int[] cutOffsets,int[] charWidth,String charsets){
return new CustomFont(bitmap,cutOffsets,charWidth,charsets);
}
|
Creates a bitmap font with the given arguments
|
public void testDifferentOrdering(){
h1.connect(h2);
Message m1=new Message(h1,h2,msgId1,1);
h1.createNewMessage(m1);
assertTrue(mc.next());
assertEquals(mc.TYPE_CREATE,mc.getLastType());
updateAllNodes();
assertTrue(mc.next());
assertEquals(mc.TYPE_START,mc.getLastType());
assertEquals(mc.getLastFrom(),h1);
assertEquals(mc.getLastTo(),h2);
clock.advance(10);
Message m2=new Message(h2,h1,msgId2,1);
h2.createNewMessage(m2);
h2.update(true);
assertTrue(mc.next());
assertEquals(mc.TYPE_CREATE,mc.getLastType());
assertFalse(mc.next());
h1.update(true);
assertTrue(mc.next());
assertEquals(mc.TYPE_RELAY,mc.getLastType());
assertEquals(h2,mc.getLastTo());
assertTrue(mc.next());
assertEquals(mc.TYPE_START,mc.getLastType());
assertEquals(h1,mc.getLastTo());
assertEquals(msgId2,mc.getLastMsg().getId());
assertFalse(mc.next());
}
|
Test unexpected ordering of finalizations and message transfers.
|
void sendWriteCommand(int locoIOAddress,int locoIOSubAddress,int cv,int data){
reading=false;
tc.sendLocoNetMessage(LocoIO.writeCV(locoIOAddress,locoIOSubAddress,cv,data));
startTimer();
}
|
Write an SV to a given LocoIO device
|
public void remove(final long address,final int length){
Preconditions.checkArgument(address >= 0,"Error: Address can't be less than 0");
Preconditions.checkArgument(length > 0,"Error: Length must be positive");
try {
m_writeLock.lock();
final MemoryChunk chunk=findChunk(address);
if (chunk == null) {
final MemoryChunk nextChunk=findNextChunk(address);
if (nextChunk == null) {
return;
}
else if (nextChunk.getAddress() < (address + length)) {
final int toRemove=(int)((address + length) - nextChunk.getAddress());
remove(nextChunk.getAddress(),toRemove);
}
else {
return;
}
}
else if (chunk.getAddress() == address) {
if (chunk.getLength() <= length) {
removeChunk(chunk);
final int toDelete=length - chunk.getLength();
if (toDelete > 0) {
remove(address + chunk.getLength(),toDelete);
}
}
else {
splitChunk(chunk,address + length);
removeChunk(findChunk(address));
}
}
else {
if ((chunk.getAddress() + chunk.getLength()) <= (address + length)) {
splitChunk(chunk,address);
final MemoryChunk deleteChunk=findChunk(address);
removeChunk(deleteChunk);
final int toRemove=length - deleteChunk.getLength();
if (toRemove > 0) {
remove(address + deleteChunk.getLength(),toRemove);
}
}
else {
splitChunk(chunk,address);
final MemoryChunk secondChunk=findChunk(address);
splitChunk(secondChunk,address + length);
removeChunk(findChunk(address));
}
}
}
finally {
m_writeLock.unlock();
}
}
|
Removes a memory region from the memory.
|
void ackReceived(SIPRequest sipRequest){
if (this.ackSeen) return;
SIPServerTransaction tr=this.getInviteTransaction();
if (tr != null) {
if (tr.getCSeq() == sipRequest.getCSeq().getSeqNumber()) {
acquireTimerTaskSem();
try {
if (this.timerTask != null) {
this.timerTask.cancel();
this.timerTask=null;
}
}
finally {
releaseTimerTaskSem();
}
this.ackSeen=true;
if (this.dialogDeleteTask != null) {
this.dialogDeleteTask.cancel();
this.dialogDeleteTask=null;
}
this.setLastAckReceived(sipRequest);
if (sipStack.isLoggingEnabled()) {
sipStack.getStackLogger().logDebug("ackReceived for " + ((SIPTransaction)tr).getMethod());
this.ackLine=sipStack.getStackLogger().getLineCount();
this.printDebugInfo();
}
if (this.isBackToBackUserAgent) {
this.releaseAckSem();
}
this.setState(CONFIRMED_STATE);
}
}
}
|
Mark that the dialog has seen an ACK.
|
public int next(){
final int startNode=_startNode;
if (_startNode == NULL) {
return NULL;
}
int node=_currentNode;
int expType;
final int nodeType=_nodeType;
if (nodeType != DTM.ELEMENT_NODE) {
do {
node++;
expType=_exptype2(node);
if (NULL == expType || _parent2(node) < startNode && startNode != node) {
_currentNode=NULL;
return END;
}
}
while (expType != nodeType);
}
else if (startNode == DTMDefaultBase.ROOTNODE) {
do {
node++;
expType=_exptype2(node);
if (NULL == expType) {
_currentNode=NULL;
return END;
}
}
while (expType < DTM.NTYPES || m_extendedTypes[expType].getNodeType() != DTM.ELEMENT_NODE);
}
else {
do {
node++;
expType=_exptype2(node);
if (NULL == expType || _parent2(node) < startNode && startNode != node) {
_currentNode=NULL;
return END;
}
}
while (expType < DTM.NTYPES || m_extendedTypes[expType].getNodeType() != DTM.ELEMENT_NODE);
}
_currentNode=node;
return returnNode(makeNodeHandle(node));
}
|
Get the next node in the iteration.
|
public boolean isMatch(Geometry geom,String opName,Object[] args,Result actualResult,Result expectedResult,double tolerance){
return actualResult.equals(expectedResult,tolerance);
}
|
Tests whether the two results are equal within the given tolerance. The input parameters are not considered.
|
public double distance(final Int3D p){
final double dx=(double)this.x - p.x;
final double dy=(double)this.y - p.y;
final double dz=(double)this.z - p.z;
return Math.sqrt(dx * dx + dy * dy + dz * dz);
}
|
Returns the distance FROM this Double3D TO the specified point.
|
private String extractDescription(Element descriptionNode){
Assert.assertTrue(descriptionNode.getTagName().equals("description"));
return extractText(descriptionNode);
}
|
<!ELEMENT description (#PCDATA)>
|
public static LatLonPoint ZonedUTMtoLL(Ellipsoid ellip,double UTMNorthing,double UTMEasting,int ZoneNumber,char ZoneLetter,LatLonPoint llpoint){
return UTMPoint.UTMtoLL(ellip,UTMNorthing,UTMEasting,ZoneNumber,MGRSPoint.MGRSZoneToUTMZone(ZoneLetter),llpoint);
}
|
Converts UTM coords to lat/long given an ellipsoid. <p> Equations from USGS Bulletin 1532 <br> East Longitudes are positive, West longitudes are negative. <br> North latitudes are positive, South latitudes are negative. <br>
|
public void verifyInfo(String message,Throwable t){
verify(Level.INFO,message,t);
}
|
Verify a logging event at the info level with the given message and throwable.
|
protected static Map<String,String> convertHeaders(Header[] headers){
Map<String,String> result=new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
for (int i=0; i < headers.length; i++) {
result.put(headers[i].getName(),headers[i].getValue());
}
return result;
}
|
Converts Headers[] to Map<String, String>.
|
@Override public void close(){
if (process.isAlive()) {
process.destroy();
}
super.close();
}
|
Terminates process and closes all related streams
|
public JBZipFile(File f) throws IOException {
this(f,"UTF-8");
}
|
Opens the given file for reading, assuming the platform's native encoding for file names.
|
protected void processRememberedSets(){
}
|
Flush any remembered sets pertaining to the current collection. Non-generational collectors do nothing.
|
public static boolean textLayoutIsCompatible(Font font){
Font2D font2D=getFont2D(font);
if (font2D instanceof TrueTypeFont) {
TrueTypeFont ttf=(TrueTypeFont)font2D;
return ttf.getDirectoryEntry(TrueTypeFont.GSUBTag) == null || ttf.getDirectoryEntry(TrueTypeFont.GPOSTag) != null;
}
else {
return false;
}
}
|
Used by windows printing to assess if a font is likely to be layout compatible with JDK TrueType fonts should be, but if they have no GPOS table, but do have a GSUB table, then they are probably older fonts GDI handles differently.
|
public void testSet_result_zeroblob() throws Exception, UnsupportedEncodingException {
Stmt st=null;
TestFCZeroBlob testZeroBlobFnc=new TestFCZeroBlob();
byte[] byteVal={(byte)1,(byte)2,(byte)3};
db.exec("create table testBinaryData (binVal BINARY) ;",null);
try {
st=db.prepare("insert into testBinaryData values (?)");
st.bind(1,byteVal);
st.step();
db.create_function("testZeroBlob",0,testZeroBlobFnc);
TableResult res=db.get_table("select testZeroBlob() from testBinaryData");
TableResult res2=db.get_table("select zeroblob(" + testZeroBlobFnc.numBytes + ") from testBinaryData");
String row[]=(String[])res.rows.elementAt(0);
String val=row[0];
assertNotNull(val);
assertEquals(((String[])res2.rows.elementAt(0))[0],val);
assertTrue(testZeroBlobFnc.functionCalled);
}
finally {
db.exec("drop table if exists testBinaryData;",null);
}
}
|
ZeroBlob not supported
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.