code
stringlengths
10
174k
nl
stringlengths
3
129k
protected void sequence_FunctionBody_FunctionExpression_FunctionHeader_FunctionImpl_StrictFormalParameters_TypeVariables(ISerializationContext context,FunctionExpression semanticObject){ genericSequencer.createSequence(context,semanticObject); }
Contexts: FunctionExpression returns FunctionExpression Constraint: ( generator?='*'? (typeVars+=TypeVariable typeVars+=TypeVariable*)? name=BindingIdentifier? (fpars+=FormalParameter fpars+=FormalParameter*)? returnTypeRef=TypeRef? body=Block )
public String clusterTypeTipText(){ return "The type of cluster to use."; }
Returns the tip text for this property
public DefaultReadTrimmer(int windowSize,int qualityThreshold){ mWindowSize=windowSize; mQualityThreshold=qualityThreshold; }
Construct a read trimmer
public Task<FileShareRestRep> updateExport(URI id,String protocol,String securityType,String permissions,String rootUserMapping,FileExportUpdateParam update){ return putTask(update,getExportsUrl() + "/{protocol},{securityType},{permissions},{rootUserMapping}",id,protocol,securityType,permissions,rootUserMapping); }
Updates an export from the given file system by ID. <p> API Call: <tt>PUT /file/filesystems/{id}/exports/{protocol},{securityType},{permissions},{rootUserMapping}</tt>
@Override public void send(Object message,boolean sent) throws RemotingException { if (closed) { throw new RemotingException(this.getLocalAddress(),null,"Failed to send message " + message + ", cause: The channel "+ this+ " is closed!"); } if (message instanceof RpcInvocation) { RpcInvocation inv=(RpcInvocation)message; int id=SEQUENCE.incrementAndGet(); ChannelBuffer output=createRequestBuffer(id,inv); channel.send(output,sent); } }
Description: <br>
public static void main(final String[] args){ DOMTestCase.doMain(attrparentnodenull.class,args); }
Runs this test from the command line.
protected SVGOMMPathElement(){ }
Creates a new SVGOMMPathElement object.
public final Vec3D reciprocal(){ x=1f / x; y=1f / y; z=1f / z; return this; }
Replaces the vector components with their multiplicative inverse.
public AbstractKeyRangeIndexProcedure(){ }
De-serialization ctor.
public TestRunner(){ this(System.out); }
Constructs a TestRunner.
public String patch_addPadding(LinkedList<Patch> patches){ short paddingLength=this.Patch_Margin; String nullPadding=""; for (short x=1; x <= paddingLength; x++) { nullPadding+=String.valueOf((char)x); } for ( Patch aPatch : patches) { aPatch.start1+=paddingLength; aPatch.start2+=paddingLength; } Patch patch=patches.getFirst(); LinkedList<Diff> diffs=patch.diffs; if (diffs.isEmpty() || diffs.getFirst().operation != Operation.EQUAL) { diffs.addFirst(new Diff(Operation.EQUAL,nullPadding)); patch.start1-=paddingLength; patch.start2-=paddingLength; patch.length1+=paddingLength; patch.length2+=paddingLength; } else if (paddingLength > diffs.getFirst().text.length()) { Diff firstDiff=diffs.getFirst(); int extraLength=paddingLength - firstDiff.text.length(); firstDiff.text=nullPadding.substring(firstDiff.text.length()) + firstDiff.text; patch.start1-=extraLength; patch.start2-=extraLength; patch.length1+=extraLength; patch.length2+=extraLength; } patch=patches.getLast(); diffs=patch.diffs; if (diffs.isEmpty() || diffs.getLast().operation != Operation.EQUAL) { diffs.addLast(new Diff(Operation.EQUAL,nullPadding)); patch.length1+=paddingLength; patch.length2+=paddingLength; } else if (paddingLength > diffs.getLast().text.length()) { Diff lastDiff=diffs.getLast(); int extraLength=paddingLength - lastDiff.text.length(); lastDiff.text+=nullPadding.substring(0,extraLength); patch.length1+=extraLength; patch.length2+=extraLength; } return nullPadding; }
Add some padding on text start and end so that edges can match something. Intended to be called only from within patch_apply.
private void updateChannels(){ channel.setEnabled(!rejoinOpenChannels.isEnabled() || !rejoinOpenChannels.isSelected()); }
Enables or disables the channel inputbox depending on whether the rejoin open channels option is active and selected.
protected void startBridgeServer(int port) throws IOException { startBridgeServer(port,-1); }
Starts a bridge server on the given port, using the given deserializeValues and notifyBySubscription to serve up the given region.
public GeneralRuntimeException(String msg){ super(msg); }
Constructs an <code>GeneralException</code> with the specified detail message.
public JobDefinitionEntity createJobDefinitionEntity(NamespaceEntity namespaceEntity,String jobName,String description,String activitiId){ JobDefinitionEntity jobDefinitionEntity=new JobDefinitionEntity(); jobDefinitionEntity.setNamespace(namespaceEntity); jobDefinitionEntity.setName(jobName); jobDefinitionEntity.setDescription(description); jobDefinitionEntity.setActivitiId(activitiId); return jobDefinitionDao.saveAndRefresh(jobDefinitionEntity); }
Creates and persists a new job definition entity.
public QuadEdge insertSite(Vertex v){ QuadEdge e=locate(v); if ((v.equals(e.orig(),tolerance)) || (v.equals(e.dest(),tolerance))) { return e; } QuadEdge base=makeEdge(e.orig(),v); QuadEdge.splice(base,e); QuadEdge startEdge=base; do { base=connect(e,base.sym()); e=base.oPrev(); } while (e.lNext() != startEdge); return startEdge; }
Inserts a new site into the Subdivision, connecting it to the vertices of the containing triangle (or quadrilateral, if the split point falls on an existing edge). <p> This method does NOT maintain the Delaunay condition. If desired, this must be checked and enforced by the caller. <p> This method does NOT check if the inserted vertex falls on an edge. This must be checked by the caller, since this situation may cause erroneous triangulation
public DHPrivateKeySpec(BigInteger x,BigInteger p,BigInteger g){ this.x=x; this.p=p; this.g=g; }
Creates a new <code>DHPrivateKeySpec</code> with the specified <i>private value</i> <code>x</code>. <i>prime modulus</i> <code>p</code> and <i>base generator</i> <code>g</code>.
private boolean isMatEqual(Mat mat1,Mat mat2){ if (mat1.empty() && mat2.empty()) { return true; } if (mat1.cols() != mat2.cols() || mat1.rows() != mat2.rows() || mat1.dims() != mat2.dims()) { return false; } Mat diff=new Mat(); opencv_core.compare(mat1,mat2,diff,opencv_core.CMP_NE); int nz=opencv_core.countNonZero(diff); return nz == 0; }
This method was found here http://stackoverflow.com/a/32235744/3708426 Converted from C++ to Java
protected NewTargetImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public double strikeSensitivity(){ final double temp=stdDev * strike; final double DalphaDstrike=-dAlpha_dD1 / temp; final double DbetaDstrike=-dBeta_dD2 / temp; final double temp2=DalphaDstrike * forward + DbetaDstrike * x + beta * dx_dStrike; return discount * temp2; }
Sensitivity to strike.
public boolean hasChildren(){ return children.size() > 0; }
Checks if this node has children
@Override public boolean ready() throws IOException { ensureOpen(); return true; }
Tells whether this stream is ready to be read.
public String generateKey(){ if (invocationKey == null) { StringBuffer sb=new StringBuffer(); sb.append(table.getSchema()); sb.append(".").append(table.getName()); sb.append(".").append(key.getName()); for ( Object v : values) { sb.append("-").append(v.hashCode()); } invocationKey=sb.toString(); } return invocationKey; }
Returns a reasonably efficient key for this select that incorporates both the fully qualified key name as well as select values. This key can be used for caching information about this particular index prefetch query.
private int readFrameType(final Object[] frame,final int index,int v,final char[] buf,final Label[] labels){ int type=b[v++] & 0xFF; switch (type) { case 0: frame[index]=Opcodes.TOP; break; case 1: frame[index]=Opcodes.INTEGER; break; case 2: frame[index]=Opcodes.FLOAT; break; case 3: frame[index]=Opcodes.DOUBLE; break; case 4: frame[index]=Opcodes.LONG; break; case 5: frame[index]=Opcodes.NULL; break; case 6: frame[index]=Opcodes.UNINITIALIZED_THIS; break; case 7: frame[index]=readClass(v,buf); v+=2; break; default : frame[index]=readLabel(readUnsignedShort(v),labels); v+=2; } return v; }
Reads a stack map frame type and stores it at the given index in the given array.
@action(name="query",args={@arg(name=GamaMessageType.MESSAGE_STR,type=IType.MESSAGE,optional=false,doc=@doc("The message to be replied")),@arg(name=GamaMessage.CONTENTS,type=IType.LIST,optional=false,doc=@doc("The content of the replying message"))},doc=@doc("Replies a message with a 'query' performative message.")) public Object primQuery(final IScope scope) throws GamaRuntimeException { final IList originals=getMessageArg(scope); if (originals == null || originals.size() == 0) { throw GamaRuntimeException.error("No message to reply",scope); } return replyMessage(scope,originals,QUERY,getContentArg(scope)); }
Prim query.
protected String generateLockServiceDestroyedMessage(){ return LocalizedStrings.DLockService_0_HAS_BEEN_DESTROYED.toLocalizedString(this); }
Returns the string message to use in a LockServiceDestroyedException for this lock service.
protected void computeAverageLocalOfObservations(int[] sourceValues,int indexToModify){ if (indexToModify < sourceValues.length) { for (int s=0; s < base; s++) { sourceValues[indexToModify]=s; computeAverageLocalOfObservations(sourceValues,indexToModify + 1); } return; } double logTerm, localValue, sepCont; int jointSourcesVal, sourceVal; jointSourcesVal=0; for (int sIndex=0; sIndex < numSources; sIndex++) { jointSourcesVal*=base; jointSourcesVal+=sourceValues[sIndex]; } double[] localActAndTes=new double[numSources + 1]; for (int pastVal=0; pastVal < base_power_k; pastVal++) { for (int destVal=0; destVal < base; destVal++) { if (sourcesNextPastCount[jointSourcesVal][destVal][pastVal] != 0) { logTerm=((double)nextPastCount[destVal][pastVal]) / ((double)nextCount[destVal] * (double)pastCount[pastVal]); logTerm*=(double)observations; if (computeMultiInfoCoherence) { localActAndTes[0]=Math.log(logTerm); } for (int sIndex=0; sIndex < numSources; sIndex++) { sourceVal=sourceValues[sIndex]; localActAndTes[sIndex + 1]=((double)sourceNumValueNextPastCount[sIndex][sourceVal][destVal][pastVal] / (double)sourceNumValuePastCount[sIndex][sourceVal][pastVal]) / ((double)nextPastCount[destVal][pastVal] / (double)pastCount[pastVal]); logTerm*=localActAndTes[sIndex + 1]; if (computeMultiInfoCoherence) { localActAndTes[sIndex + 1]=Math.log(localActAndTes[sIndex + 1]); } } if (computeMultiInfoCoherence) { for (int i=0; i < sourcesNextPastCount[jointSourcesVal][destVal][pastVal]; i++) { miCalc.addObservation(localActAndTes); } } localValue=Math.log(logTerm) / log_2; sepCont=(double)sourcesNextPastCount[jointSourcesVal][destVal][pastVal] / (double)observations * localValue; average+=sepCont; if (sepCont >= 0.0) { avPositiveLocal+=sepCont; } else { avNegativeLocal+=sepCont; } if (localValue > max) { max=localValue; } else if (localValue < min) { min=localValue; } meanSqLocals+=sepCont * localValue; } } } }
Private utility function. <p>Updates the average, max, min and meanSq of locals for the separable information for the given source values in sourceValues up to the index indexToModify over all possible source values after the index indexToModify onwards. Uses recursion on increasing indexToModify. Designed to be called with indexToModify == 0 to compute average over all states.
private void drawItems(Canvas canvas){ canvas.save(); int top=(currentItem - firstItem) * getItemHeight() + (getItemHeight() - getHeight()) / 2; canvas.translate(PADDING,-top + scrollingOffset); itemsLayout.draw(canvas); canvas.restore(); }
Draws items
void importRecursivelyFrom(Object fileSystemObject,int policy) throws CoreException { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (!provider.isFolder(fileSystemObject)) { importFile(fileSystemObject,policy); return; } int childPolicy=importFolder(fileSystemObject,policy); if (childPolicy != POLICY_SKIP_CHILDREN) { Iterator children=provider.getChildren(fileSystemObject).iterator(); while (children.hasNext()) { importRecursivelyFrom(children.next(),childPolicy); } } }
Imports the specified file system object recursively into the workspace. If the import fails, adds a status object to the list to be returned by <code>getStatus</code>.
public double[] homogeneVector(double[] v){ assert (v.length == dim); double[] dv=Arrays.copyOf(v,dim + 1); dv[dim]=1.0; return dv; }
Transform an absolute vector into homogeneous coordinates.
public boolean isSpread(){ return spread; }
<!-- begin-user-doc --> <!-- end-user-doc -->
public LRS(int L,int R,RegressionDataSet rds,Regressor evaluater,int folds){ this(L,R,evaluater,folds); search(rds,L,R,evaluater,folds); }
Performs LRS feature selection for a regression problem
protected POInfo initPO(Properties ctx){ POInfo poi=POInfo.getPOInfo(ctx,Table_ID,get_TrxName()); return poi; }
Load Meta Data
private double calculateDistance(Example first,Example second){ double distance=0; for ( Attribute attribute : first.getAttributes()) { double diff=first.getValue(attribute) - second.getValue(attribute); distance+=diff * diff; } return Math.sqrt(distance); }
Calculates the euclidean distance between both examples.
protected boolean verifyAuthorizedInTenantOrg(URI tenantId){ StorageOSUser user=getUserFromContext(); if (tenantId.toString().equals(user.getTenantId()) || _permissionsHelper.userHasGivenRole(user,tenantId,Role.TENANT_ADMIN)) { return true; } return false; }
Checks if the user is authorized in the tenant org or not. Authorized if, The user is in the tenant org. The user who is not in the tenant org, but is a TenantAdmin of the tenant org.
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 release(int id){ if (id < 0) { throw new IllegalArgumentException(LocalizedStrings.UniqueIdGenerator_NEGATIVE_ID_0.toLocalizedString(Integer.valueOf(id))); } else if (id > this.MAX_ID) { throw new IllegalArgumentException(LocalizedStrings.UniqueIdGenerator_ID_MAX_ID_0.toLocalizedString(Integer.valueOf(id))); } synchronized (this) { clearBit(id); } }
Release a previously obtained id allowing it to be obtained in the future.
String fullName(){ String parsable=name; if (scope != null) { parsable+="." + scope.getName(); } return parsable; }
Returns a parsable name for identity: identityName.scopeName
public static int flashTime(){ return info().flashTime; }
Returns the time delay of drawing operation flashing.
private double calcArea(double width,double height){ return Math.max(minSideLength,width) * Math.max(minSideLength,height); }
Calculates the area while applying the minimum side length.
public FuzzyQuery(Term term,int maxEdits,int prefixLength,int maxExpansions,boolean transpositions){ super(term.field()); if (maxEdits < 0 || maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) { throw new IllegalArgumentException("maxEdits must be between 0 and " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE); } if (prefixLength < 0) { throw new IllegalArgumentException("prefixLength cannot be negative."); } if (maxExpansions <= 0) { throw new IllegalArgumentException("maxExpansions must be positive."); } this.term=term; this.maxEdits=maxEdits; this.prefixLength=prefixLength; this.transpositions=transpositions; this.maxExpansions=maxExpansions; setRewriteMethod(new MultiTermQuery.TopTermsBlendedFreqScoringRewrite(maxExpansions)); }
Create a new FuzzyQuery that will match terms with an edit distance of at most <code>maxEdits</code> to <code>term</code>. If a <code>prefixLength</code> &gt; 0 is specified, a common prefix of that length is also required.
public void insertLeaf(int index,Object key,Object value){ int len=keys.length + 1; Object[] newKeys=new Object[len]; DataUtils.copyWithGap(keys,newKeys,len - 1,index); keys=newKeys; Object[] newValues=new Object[len]; DataUtils.copyWithGap(values,newValues,len - 1,index); values=newValues; keys[index]=key; values[index]=value; totalCount++; addMemory(map.getKeyType().getMemory(key) + map.getValueType().getMemory(value)); }
Insert a key-value pair into this leaf.
public UpgradeProjectVisualPanel2(Project context){ this.context=context; initComponents(); }
Creates new form UpgradeProjectVisualPanel2
public void init() throws MessagingException { checkInitParameters(getAllowedInitParameters()); try { initDebug(); if (isDebug()) { log("Initializing"); } initHost(); initPort(); initMaxPings(); initPingIntervalMilli(); initStreamBufferSize(); if (getMaxPings() > 0) { ping(); } } catch ( Exception e) { log("Exception thrown",e); throw new MessagingException("Exception thrown",e); } }
Mailet initialization routine.
public JPAUserFlag(String name){ super(); this.name=name; }
Constructs a User Flag.
public Collection<?> toCollection(String column) throws SQLException { return super.toCollection(column); }
To Collection
public boolean isOverlap(Object objA,Object objB){ SpatialKey a=(SpatialKey)objA; SpatialKey b=(SpatialKey)objB; if (a.isNull() || b.isNull()) { return false; } for (int i=0; i < dimensions; i++) { if (a.max(i) < b.min(i) || a.min(i) > b.max(i)) { return false; } } return true; }
Check whether the two objects overlap.
public static Object readObjectFromFile(String name) throws ClassNotFoundException, IOException { byte[] data=readDataFromFile(name); return deserialize(data); }
Read serialized object from a file
public void scanReset(){ currentFeatureIdx=0; }
Scan reset.
public String next(int n) throws JSONException { if (n == 0) { return ""; } char[] chars=new char[n]; int pos=0; while (pos < n) { chars[pos]=this.next(); if (this.end()) { throw this.syntaxError("Substring bounds error"); } pos+=1; } return new String(chars); }
Get the next n characters.
public boolean isEndPointDead(){ return this.endPointDied; }
Returns true if the end point represented by this updater is considered dead.
private boolean canUseLookup(Raster src,Raster dst){ int datatype=src.getDataBuffer().getDataType(); if (datatype != DataBuffer.TYPE_BYTE && datatype != DataBuffer.TYPE_USHORT) { return false; } SampleModel dstSM=dst.getSampleModel(); dstNbits=dstSM.getSampleSize(0); if (!(dstNbits == 8 || dstNbits == 16)) { return false; } for (int i=1; i < src.getNumBands(); i++) { int bandSize=dstSM.getSampleSize(i); if (bandSize != dstNbits) { return false; } } SampleModel srcSM=src.getSampleModel(); srcNbits=srcSM.getSampleSize(0); if (srcNbits > 16) { return false; } for (int i=1; i < src.getNumBands(); i++) { int bandSize=srcSM.getSampleSize(i); if (bandSize != srcNbits) { return false; } } return true; }
Determines if the rescale can be performed as a lookup. The dst must be a byte or short type. The src must be less than 16 bits. All source band sizes must be the same and all dst band sizes must be the same.
@SuppressWarnings("unchecked") TypeDeclaration loadObject(String name,Map<String,Object> m,Scope parent,List<TypeParameter> existing){ Value obj; if (m.get(KEY_METATYPE) instanceof Value) { obj=(Value)m.get(KEY_METATYPE); } else { obj=new Value(); m.put(KEY_METATYPE,obj); obj.setName(name); obj.setContainer(parent); obj.setScope(parent); obj.setUnit(u2); com.redhat.ceylon.model.typechecker.model.Class type=new com.redhat.ceylon.model.typechecker.model.Class(); type.setName(name); type.setAnonymous(true); type.setUnit(u2); type.setContainer(parent); type.setScope(parent); if (parent == this) { u2.addDeclaration(obj); u2.addDeclaration(type); } parent.addMember(obj); obj.setType(type.getType()); setAnnotations(obj,(Integer)m.get(KEY_PACKED_ANNS),(Map<String,Object>)m.get(KEY_ANNOTATIONS)); setAnnotations(obj.getTypeDeclaration(),(Integer)m.remove(KEY_PACKED_ANNS),(Map<String,Object>)m.remove(KEY_ANNOTATIONS)); if (type.getExtendedType() == null) { if (m.containsKey("super")) { type.setExtendedType(getTypeFromJson((Map<String,Object>)m.remove("super"),parent instanceof Declaration ? (Declaration)parent : null,existing)); } else { type.setExtendedType(getTypeFromJson(idobj,parent instanceof Declaration ? (Declaration)parent : null,existing)); } } if (m.containsKey(KEY_SATISFIES)) { List<Map<String,Object>> stypes=(List<Map<String,Object>>)m.remove(KEY_SATISFIES); type.setSatisfiedTypes(parseTypeList(stypes,existing)); } if (m.containsKey(KEY_INTERFACES)) { for ( Map.Entry<String,Map<String,Object>> inner : ((Map<String,Map<String,Object>>)m.remove(KEY_INTERFACES)).entrySet()) { loadInterface(inner.getKey(),inner.getValue(),type,existing); } } if (m.containsKey(KEY_CLASSES)) { for ( Map.Entry<String,Map<String,Object>> inner : ((Map<String,Map<String,Object>>)m.remove(KEY_CLASSES)).entrySet()) { loadClass(inner.getKey(),inner.getValue(),type,existing); } } if (m.containsKey(KEY_OBJECTS)) { for ( Map.Entry<String,Map<String,Object>> inner : ((Map<String,Map<String,Object>>)m.remove(KEY_OBJECTS)).entrySet()) { loadObject(inner.getKey(),inner.getValue(),type,existing); } } addAttributesAndMethods(m,type,existing); } return obj.getTypeDeclaration(); }
Loads an object declaration, creating it if necessary, and returns its type declaration.
@Override public boolean isCellEditable(EventObject anEvent){ if (anEvent instanceof MouseEvent) { return ((MouseEvent)anEvent).getClickCount() >= clickCountToEdit; } return true; }
isCellEditable, Returns true if anEvent is not a MouseEvent. Otherwise, it returns true if the necessary number of clicks have occurred, and returns false otherwise.
public static void debugLineContents(Element line){ Document doc=line.getDocument(); System.out.print("["); for (int i=0; i < line.getElementCount(); i++) { Element l=line.getElement(i); try { System.out.print("'" + doc.getText(l.getStartOffset(),l.getEndOffset() - l.getStartOffset()) + "'"); } catch ( BadLocationException ex) { System.out.println("Bad location"); } } System.out.println("]"); }
Output the text of the subelements of the given element.
public void changePriority(T item,double priority){ }
Change the node in this heap with the given item to have the given priority. For this method only, you can assume the heap will not have two nodes with the same item. Check for item equality with .equals(), not ==
public PacketExtension parseExtension(XmlPullParser parser) throws Exception { OfflineMessageInfo info=new OfflineMessageInfo(); boolean done=false; while (!done) { int eventType=parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("item")) info.setNode(parser.getAttributeValue("","node")); } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("offline")) { done=true; } } } return info; }
Parses a OfflineMessageInfo packet (extension sub-packet).
protected CharacterClassEscapeSequenceImpl(){ super(); }
<!-- begin-user-doc --> <!-- end-user-doc -->
public Object runSafely(Catbert.FastStack stack) throws Exception { int idx=getInt(stack); MediaNode node=getMediaNode(stack); if (node != null) { DataObjectFilter[] filts=node.getFilters(); if (filts != null && idx >= 0 && idx < filts.length) return filts[idx].getTechnique(); } return null; }
Returns the name of the current filtering technique used by the specified MediaNode hierarchy. Since multiple filters can be set; an index must be specified to determine which one to get the technique of
private ArrayList<ArrayDBIDs> buildOneDimIndexes(Relation<? extends NumberVector> relation,DBIDs ids,DimensionSimilarityMatrix matrix){ final int dim=matrix.size(); ArrayList<ArrayDBIDs> subspaceIndex=new ArrayList<>(dim); SortDBIDsBySingleDimension comp=new VectorUtil.SortDBIDsBySingleDimension(relation); for (int i=0; i < dim; i++) { ArrayModifiableDBIDs amDBIDs=DBIDUtil.newArray(ids); comp.setDimension(matrix.dim(i)); amDBIDs.sort(comp); subspaceIndex.add(amDBIDs); } return subspaceIndex; }
Calculates "index structures" for every attribute, i.e. sorts a ModifiableArray of every DBID in the database for every dimension and stores them in a list
public Vertex parseFunction(TextStream stream,Map<String,Map<String,Vertex>> elements,boolean debug,Network network){ stream.nextWord(); Vertex function=parseElementName(Primitive.FUNCTION,stream,elements,debug,network); stream.skipWhitespace(); ensureNext('{',stream); function.addRelationship(Primitive.OPERATOR,new Primitive(function.getName())); stream.skipWhitespace(); char peek=stream.peek(); int index=0; while (peek != '}') { stream.skipWhitespace(); Vertex element=parseElement(stream,elements,debug,network); function.addRelationship(Primitive.DO,element,index); String previous=stream.peekPreviousWord(); stream.skipWhitespace(); if (!"}".equals(previous)) { ensureNext(';',',',stream); } stream.skipWhitespace(); peek=stream.peek(); index++; } ensureNext('}',stream); return function; }
Parse the function.
private LayerDefinition readLayer(final Node t) throws Exception { final int layerWidth=getAttribute(t,"width",stendhalMap.getWidth()); final int layerHeight=getAttribute(t,"height",stendhalMap.getHeight()); final LayerDefinition layer=new LayerDefinition(layerWidth,layerHeight); final int offsetX=getAttribute(t,"x",0); final int offsetY=getAttribute(t,"y",0); if ((offsetX != 0) || (offsetY != 0)) { System.err.println("Severe error: maps has offset displacement"); } layer.setName(getAttributeValue(t,"name")); for (Node child=t.getFirstChild(); child != null; child=child.getNextSibling()) { if ("data".equalsIgnoreCase(child.getNodeName())) { final String encoding=getAttributeValue(child,"encoding"); if ((encoding != null) && "base64".equalsIgnoreCase(encoding)) { final Node cdata=child.getFirstChild(); if (cdata != null) { final char[] enc=cdata.getNodeValue().trim().toCharArray(); final byte[] dec=Base64.decode(enc); final ByteArrayInputStream bais=new ByteArrayInputStream(dec); InputStream is; final String comp=getAttributeValue(child,"compression"); if ("gzip".equalsIgnoreCase(comp)) { is=new GZIPInputStream(bais); } else if ("zlib".equalsIgnoreCase(comp)) { is=new InflaterInputStream(bais); } else { is=bais; } final byte[] raw=layer.exposeRaw(); int offset=0; while (offset != raw.length) { offset+=is.read(raw,offset,raw.length - offset); } bais.close(); } } } } return layer; }
Loads a map layer from a layer node.
public AsyncResult QueryFirstAsync(RequestHeader RequestHeader,ViewDescription View,NodeTypeDescription[] NodeTypes,ContentFilter Filter,UnsignedInteger MaxDataSetsToReturn,UnsignedInteger MaxReferencesToReturn){ QueryFirstRequest req=new QueryFirstRequest(RequestHeader,View,NodeTypes,Filter,MaxDataSetsToReturn,MaxReferencesToReturn); return channel.serviceRequestAsync(req); }
Asynchronous QueryFirst service request.
public boolean contains(PrintStream p){ return m_Streams.contains(p); }
checks whether the given PrintStream is already in the list.
private void resetLoggedInOutIndicators(){ getLoggedInIndicaterRegexField().setToolTipText(null); getLoggedInIndicaterRegexField().setEnabled(true); getLoggedOutIndicaterRegexField().setToolTipText(null); getLoggedOutIndicaterRegexField().setEnabled(true); }
Resets the tool tip and enables the fields of the logged in/out indicators.
public Topology buildAppTopology(){ Topology t=tp.newTopology("mqttClientPublisher"); TStream<String> msgs=t.poll(new MsgSupplier(options.get(OPT_PUB_CNT)),1L,TimeUnit.SECONDS); MqttConfig config=Runner.newConfig(options); MqttStreams mqtt=new MqttStreams(t,null); mqtt.publish(msgs,options.get(OPT_TOPIC),options.get(OPT_QOS),options.get(OPT_RETAIN)); return t; }
Create a topology for the publisher application.
private String identifier() throws IOException { _asExpected=true; if (!isIdentifierStartChar()) { _asExpected=false; return null; } StringBuffer identifierValue=new StringBuffer(); while (!isAllRead() && isIdentifierChar()) { saveCurrent(); identifierValue.append(_working[_pos]); go(); } while (identifierValue.length() > 0 && Utils.isIdentifierHelperChar(identifierValue.charAt(identifierValue.length() - 1))) { identifierValue.deleteCharAt(identifierValue.length() - 1); } if (identifierValue.length() == 0) { return null; } String id=identifierValue.toString(); int columnIndex=id.indexOf(':'); if (columnIndex >= 0) { String prefix=id.substring(0,columnIndex); String suffix=id.substring(columnIndex + 1); int nextColumnIndex=suffix.indexOf(':'); if (nextColumnIndex >= 0) { suffix=suffix.substring(0,nextColumnIndex); } if (props.isNamespacesAware()) { id=prefix + ":" + suffix; if (!"xmlns".equalsIgnoreCase(prefix)) { _namespacePrefixes.add(prefix.toLowerCase()); } } else { id=suffix; } } return id; }
Parses an identifier from the current position.
protected void handleException(JMSException je){ if (endTime == 0) { endTime=System.currentTimeMillis(); } Exception le=je.getLinkedException(); Throwable t=je.getCause(); if (null == t && null != le && t != le) { je.initCause(le); } handleException((Exception)je); }
Overloaded method to cross-link JDK 1.4 initCause and JMS 1.1 linkedException if it has not already been done by the JMS vendor implementation.
public boolean isCloseOnCompletion(){ checkClosed(); return true; }
[Not supported]Java 1.7
public InvalidParameterSpecException(){ super(); }
Constructs an InvalidParameterSpecException with no detail message. A detail message is a String that describes this particular exception.
ScheduledFutureTask(Runnable r,V result,long ns){ super(r,result); this.time=ns; this.period=0; this.sequenceNumber=sequencer.getAndIncrement(); }
Creates a one-shot action with given nanoTime-based trigger time.
public static CreateInstance parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { CreateInstance object=new CreateInstance(); int event; java.lang.String nillableValue=null; java.lang.String prefix=""; java.lang.String namespaceuri=""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type") != null) { java.lang.String fullTypeName=reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","type"); if (fullTypeName != null) { java.lang.String nsPrefix=null; if (fullTypeName.indexOf(":") > -1) { nsPrefix=fullTypeName.substring(0,fullTypeName.indexOf(":")); } nsPrefix=nsPrefix == null ? "" : nsPrefix; java.lang.String type=fullTypeName.substring(fullTypeName.indexOf(":") + 1); if (!"createInstance".equals(type)) { java.lang.String nsUri=reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (CreateInstance)org.oscm.xsd.ExtensionMapper.getTypeObject(nsUri,type,reader); } } } java.util.Vector handledAttributes=new java.util.Vector(); reader.next(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("","request").equals(reader.getName())) { object.setRequest(org.oscm.xsd.InstanceRequest.Factory.parse(reader)); reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("","requestingUser").equals(reader.getName())) { object.setRequestingUser(org.oscm.xsd.User.Factory.parse(reader)); reader.next(); } else { } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()) throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getLocalName()); } catch ( javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; }
static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element
public void testSimpleFunction() throws Exception { check("test()","{fn test()}"); check("select test()","select {fn test()}"); check("select test() from table;","select {fn test()} from table;"); check("func(field1) func(field2)","{fn func(field1)} {fn func(field2)}"); check("select func(field1), func(field2)","select {fn func(field1)}, {fn func(field2)}"); check("select func(field1), func(field2) from table;","select {fn func(field1)}, {fn func(field2)} from table;"); }
Test escape sequence series.
@NamespacePermission(fields="#request.namespace",permissions=NamespacePermissionEnum.WRITE) @Override public BusinessObjectFormat createBusinessObjectFormat(BusinessObjectFormatCreateRequest request){ validateBusinessObjectFormatCreateRequest(request); BusinessObjectFormatKey businessObjectFormatKey=getBusinessObjectFormatKey(request); BusinessObjectDefinitionEntity businessObjectDefinitionEntity=businessObjectDefinitionDaoHelper.getBusinessObjectDefinitionEntity(new BusinessObjectDefinitionKey(businessObjectFormatKey.getNamespace(),businessObjectFormatKey.getBusinessObjectDefinitionName())); FileTypeEntity fileTypeEntity=fileTypeDaoHelper.getFileTypeEntity(request.getBusinessObjectFormatFileType()); BusinessObjectFormatEntity latestVersionBusinessObjectFormatEntity=businessObjectFormatDao.getBusinessObjectFormatByAltKey(businessObjectFormatKey); if (latestVersionBusinessObjectFormatEntity != null) { BusinessObjectFormat latestVersionBusinessObjectFormat=businessObjectFormatHelper.createBusinessObjectFormatFromEntity(latestVersionBusinessObjectFormatEntity); if (latestVersionBusinessObjectFormat.getSchema() != null) { validateNewSchemaIsAdditiveToOldSchema(request.getSchema(),latestVersionBusinessObjectFormat.getSchema()); } latestVersionBusinessObjectFormatEntity.setLatestVersion(false); businessObjectFormatDao.saveAndRefresh(latestVersionBusinessObjectFormatEntity); } Integer businessObjectFormatVersion=latestVersionBusinessObjectFormatEntity == null ? 0 : latestVersionBusinessObjectFormatEntity.getBusinessObjectFormatVersion() + 1; BusinessObjectFormatEntity newBusinessObjectFormatEntity=createBusinessObjectFormatEntity(request,businessObjectDefinitionEntity,fileTypeEntity,businessObjectFormatVersion); return businessObjectFormatHelper.createBusinessObjectFormatFromEntity(newBusinessObjectFormatEntity); }
Creates a new business object format.
public KafkaConfigState(ZookeeperConfiguration zkConfig){ this.configStore=new CuratorConfigStore<>(zkConfig.getFrameworkName(),zkConfig.getMesosZkUri()); }
Creates a new Kafka config state manager based on the provided bootstrap information.
public static ComponentUI createUI(JComponent c){ return new BEToolBarSeparatorUI(); }
Creates the ui.
public static void generateSample(MatrixBlock out,long range,int size,boolean replace,long seed) throws DMLRuntimeException { out.reset(size,1,false); out.allocateDenseBlock(); seed=(seed == -1 ? System.nanoTime() : seed); if (!replace) { for (int i=1; i <= size; i++) out.setValueDenseUnsafe(i - 1,0,i); Random rand=new Random(seed); for (int i=size + 1; i <= range; i++) { if (rand.nextInt(i) < size) out.setValueDenseUnsafe(rand.nextInt(size),0,i); } double tmp; int idx; for (int i=size - 1; i >= 1; i--) { idx=rand.nextInt(i); tmp=out.getValueDenseUnsafe(idx,0); out.setValueDenseUnsafe(idx,0,out.getValueDenseUnsafe(i,0)); out.setValueDenseUnsafe(i,0,tmp); } } else { Random r=new Random(seed); for (int i=0; i < size; i++) out.setValueDenseUnsafe(i,0,1 + nextLong(r,range)); } out.recomputeNonZeros(); out.examSparsity(); }
Generates a sample of size <code>size</code> from a range of values [1,range]. <code>replace</code> defines if sampling is done with or without replacement.
protected double defaultDistMult(){ return 4.0; }
returns the default distance multiplier
public void registerActivityType(String type,Class<? extends Activity> activityClass){ registerActivityType(type,activityClass,new DefaultActivityFactory(activityClass)); }
<p> Register an activity type with the specified non-default type name. </p>
public Object runSafely(Catbert.FastStack stack) throws Exception { String role=getString(stack); Show s=getShow(stack); return (s == null) ? Pooler.EMPTY_PERSON_ARRAY : s.getPeopleObjList(Show.getRoleForString(role)); }
Gets the people in the specified Show in the specified Role. Returned as a Person array.
public ParseException(){ super(); }
Constructs a new exception with no detail message.
public String splitEvaluatorTipText(){ return "The evaluator to apply to the cross validation folds. " + "This may be a classifier, regression scheme etc."; }
Returns the tip text for this property
public void testCanEscapeWindowsSlashes(){ assertEquals("c:\\\\test",PropertyUtils.escapeBackSlashesIfNotNull("c:\\test")); }
Test whether Windows backslash escaping works properly.
public void refresh(){ if (myColorsAware != null) { myNormalAttributesCache.clear(); mySelectedAttributesCache.clear(); } }
Asks the implementation to ensure that it uses the most up-to-date colors. <p/> I.e. this method is assumed to be called when color settings has been changed and gives a chance to reflect the changes accordingly.
protected void sendResponse(final PrintWriter writer,final String header,final String message,final String data){ try { JSONObject json=new JSONObject(); json.put("header",header); json.put("message",message); if (StringUtils.isNotBlank(data)) { json.put("data",data); } writer.write(json.toString()); } catch ( JSONException e) { LOGGER.error("Could not write JSON",e); if (StringUtils.isNotBlank(data)) { writer.write(String.format("{\"header\" : \"%s\", \"message\" : \"%s\", \"data\" : \"%s\"}",header,message,data)); } else { writer.write(String.format("{\"header\" : \"%s\", \"message\" : \"%s\"}",header,message)); } } }
Send the JSON response.
public ObjectName metricName(String contextName) throws MalformedObjectNameException { return new ObjectName("debezium.mysql:type=connector-metrics,context=" + contextName + ",server="+ serverName()); }
Create a JMX metric name for the given metric.
public void stopObligation(int id){ if (proverProcess != null && !proverProcess.isTerminated()) { try { proverProcess.getStreamsProxy().write("stop " + id + "\n"); } catch ( IOException e) { ProverUIActivator.getDefault().logError("Error sending signal to tlapm to stop obligation " + id,e); } } }
Sends a signal to the tlapm indicating that the obligation with the given id should be stopped.
public ConnectException(){ }
Construct a new ConnectException with no detailed message.
private void computeTabTiltHelper(long time,RectF stackRect){ final boolean portrait=mCurrentMode == Orientation.PORTRAIT; final float parentWidth=stackRect.width(); final float parentHeight=stackRect.height(); final float overscrollPercent=computeOverscrollPercent(); if (mOverviewAnimationType == OverviewAnimationType.START_PINCH || mOverviewAnimationType == OverviewAnimationType.DISCARD || mOverviewAnimationType == OverviewAnimationType.FULL_ROLL || mOverviewAnimationType == OverviewAnimationType.TAB_FOCUSED || mOverviewAnimationType == OverviewAnimationType.UNDISCARD || mOverviewAnimationType == OverviewAnimationType.DISCARD_ALL) { } else if (mPinch0TabIndex >= 0 || overscrollPercent == 0.0f || mOverviewAnimationType == OverviewAnimationType.REACH_TOP) { for (int i=0; i < mStackTabs.length; ++i) { StackTab stackTab=mStackTabs[i]; LayoutTab layoutTab=stackTab.getLayoutTab(); layoutTab.setTiltX(0,0); layoutTab.setTiltY(0,0); } } else if (overscrollPercent < 0) { if (mOverScrollCounter >= OVERSCROLL_FULL_ROLL_TRIGGER) { startAnimation(time,OverviewAnimationType.FULL_ROLL); mOverScrollCounter=0; setScrollTarget(MathUtils.clamp(mScrollOffset,getMinScroll(false),getMaxScroll(false)),false); } else { float tilt=0; if (overscrollPercent < -OVERSCROLL_TOP_SLIDE_PCTG) { float scaledOverscroll=(overscrollPercent + OVERSCROLL_TOP_SLIDE_PCTG) / (1 - OVERSCROLL_TOP_SLIDE_PCTG); tilt=mUnderScrollAngleInterpolator.getInterpolation(-scaledOverscroll) * -mMaxOverScrollAngle * BACKWARDS_TILT_SCALE; } float pivotOffset=0; LayoutTab topTab=mStackTabs[mStackTabs.length - 1].getLayoutTab(); pivotOffset=portrait ? topTab.getScaledContentHeight() / 2 + topTab.getY() : topTab.getScaledContentWidth() / 2 + topTab.getX(); for (int i=0; i < mStackTabs.length; ++i) { StackTab stackTab=mStackTabs[i]; LayoutTab layoutTab=stackTab.getLayoutTab(); if (portrait) { layoutTab.setTiltX(tilt,pivotOffset - layoutTab.getY()); } else { layoutTab.setTiltY(LocalizationUtils.isLayoutRtl() ? -tilt : tilt,pivotOffset - layoutTab.getX()); } } } } else { float tilt=mOverScrollAngleInterpolator.getInterpolation(overscrollPercent) * mMaxOverScrollAngle; float offset=mOverscrollSlideInterpolator.getInterpolation(overscrollPercent) * mMaxOverScrollSlide; for (int i=0; i < mStackTabs.length; ++i) { StackTab stackTab=mStackTabs[i]; LayoutTab layoutTab=stackTab.getLayoutTab(); if (portrait) { float adjust=MathUtils.clamp((layoutTab.getY() / parentHeight) + 0.50f,0,1); layoutTab.setTiltX(tilt * adjust,layoutTab.getScaledContentHeight() / 3); layoutTab.setY(layoutTab.getY() + offset); } else if (LocalizationUtils.isLayoutRtl()) { float adjust=MathUtils.clamp(-(layoutTab.getX() / parentWidth) + 0.50f,0,1); layoutTab.setTiltY(-tilt * adjust,layoutTab.getScaledContentWidth() * 2 / 3); layoutTab.setX(layoutTab.getX() - offset); } else { float adjust=MathUtils.clamp((layoutTab.getX() / parentWidth) + 0.50f,0,1); layoutTab.setTiltY(tilt * adjust,layoutTab.getScaledContentWidth() / 3); layoutTab.setX(layoutTab.getX() + offset); } } } }
ComputeTabPosition pass 4: Update the tilt of each tab.
public ActionForward executeAction(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response){ HttpSession session=request.getSession(); String idEntidad=(String)session.getAttribute(Misc.ENTIDAD_ID); ListaExpedientesForm listaExpedienteForm=(ListaExpedientesForm)form; try { String cnif=request.getParameter(Misc.CNIF); String numExpediente=request.getParameter(Misc.EXPEDIENTE); String procedimiento=request.getParameter(Misc.PROCEDIMIENTO); String numeroRegistroInicial=request.getParameter(Misc.NUMERO_REGISTRO_INICIAL); String fechaRegistroInicialDesdeRequest=request.getParameter(Misc.FECHA_REGISTRO_INICIAL_DESDE); String operadorFechaInicial=request.getParameter(Misc.OPERADOR_CONSULTA_FECHA_INICIAL); String fechaRegistroInicialHastaRequest=request.getParameter(Misc.FECHA_REGISTRO_INICIAL_HASTA); String fechaDesdeRequest=request.getParameter(Misc.FECHA_DESDE); String operador=request.getParameter(Misc.OPERADOR_CONSULTA); String fechaHastaRequest=request.getParameter(Misc.FECHA_HASTA); String estado=request.getParameter(Misc.ESTADO); String fechaParseadaDesde=null; String fechaParseadaHasta=null; String fechaRegistroInicialParseadaDesde=null; String fechaRegistroInicialParseadaHasta=null; try { fechaParseadaDesde=parsearFecha(fechaDesdeRequest); fechaParseadaHasta=parsearFecha(fechaHastaRequest); fechaRegistroInicialParseadaDesde=parsearFecha(fechaRegistroInicialDesdeRequest); fechaRegistroInicialParseadaHasta=parsearFecha(fechaRegistroInicialHastaRequest); } catch ( Exception e) { ActionMessages errors=new ActionMessages(); errors.add("error",new ActionMessage("formatoFechaIncorrecto")); return mapping.findForward("Busqueda"); } session.setAttribute(Misc.CNIF,cnif); session.setAttribute(Misc.EXPEDIENTE,numExpediente); session.setAttribute(Misc.PROCEDIMIENTO,procedimiento); session.setAttribute(Misc.NUMERO_REGISTRO_INICIAL,numeroRegistroInicial); session.setAttribute(Misc.FECHA_REGISTRO_INICIAL_DESDE,fechaRegistroInicialParseadaDesde); session.setAttribute(Misc.FECHA_REGISTRO_INICIAL_DESDE_BUSQUEDA,fechaRegistroInicialDesdeRequest); session.setAttribute(Misc.OPERADOR_CONSULTA_FECHA_INICIAL,operadorFechaInicial); session.setAttribute(Misc.FECHA_REGISTRO_INICIAL_HASTA,fechaRegistroInicialParseadaHasta); session.setAttribute(Misc.FECHA_REGISTRO_INICIAL_HASTA_BUSQUEDA,fechaRegistroInicialHastaRequest); session.setAttribute(Misc.FECHA_DESDE,fechaParseadaDesde); session.setAttribute(Misc.FECHA_DESDE_BUSQUEDA,fechaDesdeRequest); session.setAttribute(Misc.OPERADOR_CONSULTA,operador); session.setAttribute(Misc.FECHA_HASTA,fechaParseadaHasta); session.setAttribute(Misc.FECHA_HASTA_BUSQUEDA,fechaHastaRequest); session.setAttribute(Misc.ESTADO,estado); Entidad entidad=Misc.obtenerEntidad(idEntidad); ServicioConsultaExpedientes oServicio=LocalizadorServicios.getServicioConsultaExpedientes(); CriterioBusquedaExpedientes oCriterio=new CriterioBusquedaExpedientes(); oCriterio.setNIF(cnif); oCriterio.setExpediente(numExpediente); oCriterio.setNumeroRegistroInicial(numeroRegistroInicial); oCriterio.setProcedimiento(procedimiento); oCriterio.setFechaDesde(fechaParseadaDesde); oCriterio.setFechaHasta(fechaParseadaHasta); oCriterio.setOperadorConsulta(operador); oCriterio.setFechaRegistroInicialDesde(fechaRegistroInicialParseadaDesde); oCriterio.setFechaRegistroInicialHasta(fechaRegistroInicialParseadaHasta); oCriterio.setOperadorConsultaFechaInicial(operadorFechaInicial); oCriterio.setEstado(estado); Expedientes nuevoExpedientes=new Expedientes(); Expedientes expedientes=oServicio.busquedaExpedientes(oCriterio,entidad); for (int a=0; a < expedientes.count(); a++) { Expediente expediente=(Expediente)expedientes.get(a); if (expediente.getEstado().equals(Expediente.COD_ESTADO_EXPEDIENTE_FINALIZADO)) { expediente.setEstado("cerrado"); } else { expediente.setEstado("abierto"); } String proc=expediente.getProcedimiento(); if (proc.length() > 60) { proc=proc.substring(0,57) + "..."; expediente.setProcedimiento(proc); } boolean existeNotificacion=oServicio.existenNotificaciones(expediente.getNumero(),entidad); if (existeNotificacion) { expediente.setNotificacion("S"); } else { expediente.setNotificacion("N"); } boolean existeSubsanacion=oServicio.existenSubsanaciones(expediente.getNumero(),entidad); if (existeSubsanacion) { expediente.setAportacion("S"); } else { expediente.setAportacion("N"); } boolean existePago=oServicio.existenPagos(expediente.getNumero(),entidad); if (existePago) { expediente.setPagos("S"); } else { expediente.setPagos("N"); } nuevoExpedientes.add(expediente); } listaExpedienteForm.setExpedientes(nuevoExpedientes); request.setAttribute("expedientes",nuevoExpedientes.getExpedientes()); } catch ( Exception ex) { request.setAttribute(Misc.MENSAJE_ERROR,ex.getMessage()); } return mapping.findForward("Success_Search"); }
Se sobrescribe el metodo execute de la clase Action
public synchronized void flush() throws IOException { checkNotClosed(); trimToSize(); journalWriter.flush(); }
Force buffered operations to the filesystem.
public byte[] internalArray(){ return data; }
Returns the underlying array. This method exists as performance optimization to avoid extra copying of the arrays. Data inside of this array should not be altered, only copied.
protected Expression number(int opPos) throws TransformerException { return compileUnary(new org.apache.xpath.operations.Number(),opPos); }
Compile a 'number(...)' operation.
void transfer(IntEntry[] newTable){ IntEntry<VALUE>[] src=table; int newCapacity=newTable.length; for (int j=0; j < src.length; j++) { IntEntry<VALUE> e=src[j]; if (e != null) { src[j]=null; do { IntEntry<VALUE> next=e.next; int i=indexFor(e.hash,newCapacity); e.next=newTable[i]; newTable[i]=e; e=next; } while (e != null); } } }
Transfer all entries from current table to newTable.
protected void addPhraseFieldQueries(BooleanQuery.Builder query,List<Clause> clauses,ExtendedDismaxConfiguration config) throws SyntaxError { List<FieldParams> allPhraseFields=config.getAllPhraseFields(); if (allPhraseFields.size() > 0) { List<Clause> normalClauses=new ArrayList<>(clauses.size()); for ( Clause clause : clauses) { if (clause.field != null || clause.isPhrase) continue; if (clause.isBareWord()) { String s=clause.val; if ("OR".equals(s) || "AND".equals(s) || "NOT".equals(s)|| "TO".equals(s)) continue; } normalClauses.add(clause); } Multimap<Integer,FieldParams> phraseFieldsByWordGram=Multimaps.index(allPhraseFields,WORD_GRAM_EXTRACTOR); for ( Map.Entry<Integer,Collection<FieldParams>> phraseFieldsByWordGramEntry : phraseFieldsByWordGram.asMap().entrySet()) { Multimap<Integer,FieldParams> phraseFieldsBySlop=Multimaps.index(phraseFieldsByWordGramEntry.getValue(),PHRASE_SLOP_EXTRACTOR); for ( Map.Entry<Integer,Collection<FieldParams>> phraseFieldsBySlopEntry : phraseFieldsBySlop.asMap().entrySet()) { addShingledPhraseQueries(query,normalClauses,phraseFieldsBySlopEntry.getValue(),phraseFieldsByWordGramEntry.getKey(),config.tiebreaker,phraseFieldsBySlopEntry.getKey()); } } } }
Adds shingled phrase queries to all the fields specified in the pf, pf2 anf pf3 parameters
private void showResult(){ if (mLastDewarpedImg != null) { mShownBitmap=mLastDewarpedImg.convertToBitmap(); mLastDewarpedImg=null; mImageView.setImageBitmap(mShownBitmap); mResultView.setVisibility(View.VISIBLE); mHaveResult=false; if (Build.VERSION.SDK_INT >= 23) { if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { mBtnSave.setVisibility(View.INVISIBLE); requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},MY_STORAGE_REQUEST_CODE); } } } }
Shows the view with result image.
public static boolean isValidMD5(String s){ return s.matches("[a-fA-F0-9]{32}"); }
Checks if given string is a valid MD5 hash string using pattern
protected Map<String,String> loadSessionVariables(HttpServletRequest req) throws ServletException { Map<String,String> datastoreMap=new HashMap<>(); String sessionId=getCookieValue(req,"bookshelfSessionId"); if (sessionId.equals("")) { return datastoreMap; } Key key=keyFactory.newKey(sessionId); Transaction transaction=datastore.newTransaction(); try { Entity stateEntity=transaction.get(key); StringBuilder logNames=new StringBuilder(); if (stateEntity != null) { for ( String varName : stateEntity.names()) { req.getSession().setAttribute(varName,stateEntity.getString(varName)); datastoreMap.put(varName,stateEntity.getString(varName)); logNames.append(varName + " "); } } else { } } finally { if (transaction.active()) { transaction.rollback(); } } return datastoreMap; }
Take an HttpServletRequest, and copy all of the current session variables over to it
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder,int position){ mFastAdapter.onBindViewHolder(holder,position); }
the onBindViewHolder is managed by the FastAdapter so forward this correctly
public void clear(){ m.clear(); }
Removes all of the elements from this set.