code
stringlengths 10
174k
| nl
stringlengths 3
129k
|
|---|---|
public List<Integer> spiralOrderB(int[][] matrix){
List<Integer> res=new ArrayList<Integer>();
if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {
return res;
}
int iMin=0;
int iMax=matrix.length - 1;
int jMin=0;
int jMax=matrix[0].length - 1;
int i=0;
int j=0;
while (iMin <= iMax && jMin <= jMax) {
for (j=jMin; j <= jMax; j++) {
res.add(matrix[iMin][j]);
}
iMin++;
if (iMin > iMax) {
break;
}
for (i=iMin; i <= iMax; i++) {
res.add(matrix[i][jMax]);
}
jMax--;
if (jMax < jMin) {
break;
}
for (j=jMax; j >= jMin; j--) {
res.add(matrix[iMax][j]);
}
iMax--;
if (iMax < iMin) {
break;
}
for (i=iMax; i >= iMin; i--) {
res.add(matrix[i][jMin]);
}
jMin++;
}
return res;
}
|
Use rMin, rMax, cMin, cMax, to store the boundries Use i, j to track the position Move i, j around to add elements Break whenever out of bounds to avoid duplicate traversal
|
public boolean hasLandingPage(){
return landingPage;
}
|
Returns true if the marketplace has a landingpage
|
public String optString(String key){
return this.optString(key,"");
}
|
Get an optional string associated with a key. It returns an empty string if there is no such key. If the value is not a string and is not null, then it is converted to a string.
|
@Override public String toObjectExpr(String columnName){
if (_value == null) {
return "null";
}
else if (_value instanceof String) {
return "'" + _value + "'";
}
else {
return String.valueOf(_value);
}
}
|
Object expr support.
|
protected void paintComponent(Graphics g){
Graphics2D g2D=(Graphics2D)g;
Rectangle bounds=getBounds();
m_icon.paintIcon(this,g2D,0,0);
Color color=getForeground();
g2D.setPaint(color);
Font font=getFont();
AttributedString aString=new AttributedString(m_name);
aString.addAttribute(TextAttribute.FONT,font);
aString.addAttribute(TextAttribute.FOREGROUND,color);
AttributedCharacterIterator iter=aString.getIterator();
LineBreakMeasurer measurer=new LineBreakMeasurer(iter,g2D.getFontRenderContext());
float width=s_size.width - m_icon.getIconWidth() - 2;
TextLayout layout=measurer.nextLayout(width);
float xPos=m_icon.getIconWidth();
float yPos=layout.getAscent() + 2;
layout.draw(g2D,xPos,yPos);
width=s_size.width - 4;
while (measurer.getPosition() < iter.getEndIndex()) {
layout=measurer.nextLayout(width);
yPos+=layout.getAscent() + layout.getDescent() + layout.getLeading();
layout.draw(g2D,2,yPos);
}
}
|
Paint Component
|
public static String createTimeString(int year,int month,int day,int hours,int minutes,int seconds,String timezoneID){
StringBuilder builder=new StringBuilder();
builder.append(Integer.toString(year)).append("-").append(Integer.toString(month)).append("-").append(Integer.toString(day)).append("T");
if (hours < 10) {
builder.append(0);
}
builder.append(Integer.toString(hours));
builder.append(":");
if (minutes < 10) {
builder.append(0);
}
builder.append(Integer.toString(minutes));
builder.append(":");
if (seconds < 10) {
builder.append(0);
}
builder.append(Integer.toString(seconds));
builder.append(createTimezoneString(timezoneID));
return builder.toString();
}
|
Creates a timestamp conform to the ISO 8601 specification, supported its single information bits.
|
public JBBPOut ByteOrder(final JBBPByteOrder value) throws IOException {
assertNotEnded();
JBBPUtils.assertNotNull(value,"Byte order must not be null");
if (this.processCommands) {
this.byteOrder=value;
}
return this;
}
|
Define the byte outOrder for next session operations.
|
public Color alphaf(float alpha){
return rgba(red(),green(),blue(),colorConvert(alpha));
}
|
Creates Color instance with replaced alpha component.
|
public void attrModified(Attr node,String oldv,String newv){
if (!mutate) {
value=cssEngine.parsePropertyValue(SVGStylableElement.this,property,newv);
}
}
|
Called when an Attr node has been modified.
|
@Override public void close() throws IOException {
buffer=null;
}
|
Closes the stream
|
public void dispose(){
}
|
Does nothing
|
public void yypushback(int number){
if (number > yylength()) zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos-=number;
}
|
Pushes the specified amount of characters back into the input stream. They will be read again by then next call of the scanning method
|
public Allpass(Polynomial A){
k=A.reflectionCoefficients();
order=k.length;
state=new double[order + 1];
constructRationalRepresentation();
}
|
Instantiates a new allpass filter object from a Polynomial representing the allpass denominator.
|
private void updateBadge(){
if (badgeWidget == null) {
return;
}
if (tabSelected) {
badgeWidget.getElement().getStyle().setBorderColor(org.eclipse.che.ide.api.theme.Style.theme.activeTabBackground());
}
else {
badgeWidget.getElement().getStyle().setBorderColor(org.eclipse.che.ide.api.theme.Style.theme.tabsPanelBackground());
}
}
|
Updates a badge style.
|
static public void selectIntialPoints(DataSet d,int[] indices,DistanceMetric dm,List<Double> accelCache,Random rand,SeedSelection selectionMethod){
selectIntialPoints(d,indices,dm,accelCache,rand,selectionMethod,null);
}
|
Selects seeds from a data set to use for a clustering algorithm. The indices of the chosen points will be placed in the <tt>indices</tt> array.
|
boolean isOnScreen(){
if (!mHasSurface || !mPolicyVisibility || mDestroying) {
return false;
}
final AppWindowToken atoken=mAppToken;
if (atoken != null) {
return ((!mAttachedHidden && !atoken.hiddenRequested) || mWinAnimator.mAnimation != null || atoken.mAppAnimator.animation != null);
}
return !mAttachedHidden || mWinAnimator.mAnimation != null;
}
|
Is this window currently on-screen? It is on-screen either if it is visible or it is currently running an animation before no longer being visible.
|
public PointsToSet reachingObjects(SootField f){
Type t=f.getType();
if (t instanceof RefType) return FullObjectSet.v((RefType)t);
return FullObjectSet.v();
}
|
Returns the set of objects pointed to by static field f.
|
public void drawTile(VPFGraphicWarehouse warehouse,double dpplat,double dpplon,LatLonPoint ll1,LatLonPoint ll2){
double ll1lat=ll1.getY();
double ll1lon=ll1.getX();
double ll2lat=ll2.getY();
double ll2lon=ll2.getX();
try {
for (List<Object> node=new ArrayList<Object>(); parseRow(node); ) {
CoordFloatString coords=(CoordFloatString)node.get(coordColumn);
double lat=coords.getYasFloat(0);
double lon=coords.getXasFloat(0);
if ((lat > ll2lat) && (lat < ll1lat) && (lon > ll1lon)&& (lon < ll2lon)) {
warehouse.createNode(covtable,this,node,lat,lon,isEntityNode);
}
}
}
catch ( FormatException f) {
System.out.println("Exception: " + f.getClass() + " "+ f.getMessage());
}
}
|
Parse the node records for this tile, calling warehouse.createNode once for each record in the selection region.
|
public T caseProjectDependency(ProjectDependency object){
return null;
}
|
Returns the result of interpreting the object as an instance of '<em>Project Dependency</em>'. <!-- begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc -->
|
public static String resolveRepoUrl(String repoUrl){
Repositories repositories=Repositories.get();
return resolveRepoUrl(repositories,repoUrl);
}
|
Resolves a repository URL that can possibly contain a +-reference to a system repository or a user repository definition in the configuration file to one that is either a plain file system path or a remote URL
|
public boolean isTransient(){
return transient_var;
}
|
Method to check if this represents a transient variable.
|
public void add(T value){
pushBack();
array[0]=value;
}
|
Add a new value to the array
|
public DiscoveryNode node(){
return node;
}
|
The node referenced by the explanation
|
public int read() throws IOException {
return in.read();
}
|
Read a single character. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached.
|
public static String arrayToString(Object array){
String result;
int dimensions;
int i;
result="";
dimensions=getArrayDimensions(array);
if (dimensions == 0) {
result="null";
}
else if (dimensions == 1) {
for (i=0; i < Array.getLength(array); i++) {
if (i > 0) {
result+=",";
}
if (Array.get(array,i) == null) {
result+="null";
}
else {
result+=Array.get(array,i).toString();
}
}
}
else {
for (i=0; i < Array.getLength(array); i++) {
if (i > 0) {
result+=",";
}
result+="[" + arrayToString(Array.get(array,i)) + "]";
}
}
return result;
}
|
Returns the given Array in a string representation. Even though the parameter is of type "Object" one can hand over primitve arrays, e.g. int[3] or double[2][4].
|
private int measureHeight(int measureSpec){
float result;
int specMode=MeasureSpec.getMode(measureSpec);
int specSize=MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
result=specSize;
}
else {
result=mPaintSelected.getStrokeWidth() + getPaddingTop() + getPaddingBottom();
if (specMode == MeasureSpec.AT_MOST) {
result=Math.min(result,specSize);
}
}
return (int)FloatMath.ceil(result);
}
|
Determines the height of this view
|
public void viewpointChanged(){
contourScene.needsRender.set(true);
}
|
The viewpoint changed, redraw the scene.
|
public void testCompareToNegNeg1(){
byte aBytes[]={12,56,100,-2,-76,89,45,91,3,-15,35,26,3,91};
byte bBytes[]={10,20,30,40,50,60,70,10,20,30};
int aSign=-1;
int bSign=-1;
BigInteger aNumber=new BigInteger(aSign,aBytes);
BigInteger bNumber=new BigInteger(bSign,bBytes);
assertEquals(-1,aNumber.compareTo(bNumber));
}
|
compareTo(BigInteger a). Compare two negative numbers. The first is greater in absolute value.
|
private MessageBox(){
}
|
Do not create objects of this class.
|
public static double[][] randomNormal(int m,int n,double mu,double sigma){
double[][] A=new double[m][n];
for (int i=0; i < A.length; i++) for (int j=0; j < A[i].length; j++) A[i][j]=Random.normal(mu,sigma);
return A;
}
|
Create an m x n matrix of normally (Gaussian) distributed random numbers.
|
public final TestSubscriber<T> assertFusionRejected(){
if (establishedFusionMode != Fuseable.NONE) {
assertionError("Fusion was granted");
}
return this;
}
|
Assert that the fusion mode was granted.
|
protected void preorder(TreeNode<E> root){
if (root == null) return;
System.out.print(root.element + " ");
preorder(root.left);
preorder(root.right);
}
|
Preorder traversal from a subtree
|
public Boolean isLttrOfGrntedDlvryInd(){
return lttrOfGrntedDlvryInd;
}
|
Gets the value of the lttrOfGrntedDlvryInd property.
|
public static void logAndShow(Activity activity,String tag,Throwable t){
Log.e(tag,"Error",t);
String message=t.getMessage();
if (t instanceof GoogleJsonResponseException) {
GoogleJsonError details=((GoogleJsonResponseException)t).getDetails();
if (details != null) {
message=details.getMessage();
}
}
else if (t.getCause() instanceof GoogleAuthException) {
message=((GoogleAuthException)t.getCause()).getMessage();
}
showError(activity,message);
}
|
Logs the given throwable and shows an error alert dialog with its message.
|
public void focusGained(FocusEvent e){
getHandler().focusGained(e);
}
|
Invoked when focus is activated on the tree we're in, redraws the lead row.
|
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
|
private void loadDBisSavepointReleaseable(){
s_logger.log(Level.FINE,"loadDBisSavepointReleaseable",getDirection());
m_isSavepointReleaseable=true;
Savepoint sp=null;
try {
sp=getConnection().setSavepoint("releasetest");
try {
getConnection().releaseSavepoint(sp);
}
catch ( SQLException e) {
m_isSavepointReleaseable=false;
}
finally {
sp=null;
}
}
catch ( SQLException e) {
sp=null;
}
if (m_isSavepointReleaseable) s_logger.log(Level.FINE,"dbisSavepointReleaseableYes");
else s_logger.log(Level.FINE,"dbisSavepointReleaseableNo");
s_logger.flush();
}
|
checks whether savepoints are releasable (needed because buggy ORACLE jdbc driver does not allow to release savepoints)
|
public void replaceNode(BNode node){
if (!nodes.containsKey(node.getId())) {
log.fine("network does not contain a node with identifier " + node.getId());
}
else {
removeNode(node.getId());
}
addNode(node);
}
|
Replaces an existing node with a new one (with same identifier)
|
private void updateState(DialogueState state){
while (!state.getNewVariables().isEmpty()) {
Set<String> toProcess=state.getNewVariables();
state.reduce();
for ( Model model : system.getDomain().getModels()) {
if (model.isTriggered(state,toProcess)) {
boolean change=model.trigger(state);
if (change && model.isBlocking()) {
break;
}
}
}
}
}
|
Adds a particular content to the dialogue state
|
@Override public Enumeration<Option> listOptions(){
Vector<Option> result=new Vector<Option>();
result.addElement(new Option("\tA filter to apply (can be specified multiple times).","F",1,"-F <classname [options]>"));
result.addElement(new Option("\tAn attribute range (can be specified multiple times).\n" + "\tFor each filter a range must be supplied. 'first' and 'last'\n" + "\tare valid indices. 'inv(...)' around the range denotes an\n"+ "\tinverted range.","R",1,"-R <range>"));
result.addElement(new Option("\tFlag for leaving unused attributes out of the output, by default\n" + "\tthese are included in the filter output.","U",0,"-U"));
result.addAll(Collections.list(super.listOptions()));
return result.elements();
}
|
Returns an enumeration describing the available options.
|
public boolean isBaselineOffsetAsEnum(){
if (this.baselineOffsetAsEnum != null) return true;
else return false;
}
|
Check whether BaselineOffset is an enumerated value.
|
public QueueList(){
}
|
Create a queue list.
|
public MemoryByteArray(byte[] b,int filledLength){
super(filledLength,b.length);
this.b=b;
}
|
Construct a new MemoryByteArray to wrap the actual underlying byte array. This MemoryByteArray takes ownership of the array after construction and it should not be used outside of this object.
|
public void start(){
if (parent.isDisposed()) {
SWT.error(SWT.ERROR_WIDGET_DISPOSED);
}
currentPosition=0;
fadeIn=true;
fadeOut=false;
fadeOutCounter=0;
if (defaultColor == null) {
defaultColor=SWTGraphicUtil.getDefaultColor(parent,200,200,200);
}
if (selectionColor == null) {
selectionColor=parent.getDisplay().getSystemColor(SWT.COLOR_BLACK);
}
createShell();
createAndRunAnimatorThread();
}
|
Starts the ticker
|
public static int powerOfTwoFloor(int reference){
int power=(int)Math.floor(Math.log(reference) / Math.log(2d));
return (int)Math.pow(2d,power);
}
|
Returns the value that is the nearest power of 2 less than or equal to the given value.
|
public Map<Integer,Double> computeInPlace(double... dataset){
checkArgument(dataset.length > 0,"Cannot calculate quantiles of an empty dataset");
if (containsNaN(dataset)) {
Map<Integer,Double> nanMap=new HashMap<Integer,Double>();
for ( int index : indexes) {
nanMap.put(index,NaN);
}
return unmodifiableMap(nanMap);
}
int[] quotients=new int[indexes.length];
int[] remainders=new int[indexes.length];
int[] requiredSelections=new int[indexes.length * 2];
int requiredSelectionsCount=0;
for (int i=0; i < indexes.length; i++) {
long numerator=(long)indexes[i] * (dataset.length - 1);
int quotient=(int)LongMath.divide(numerator,scale,RoundingMode.DOWN);
int remainder=(int)(numerator - (long)quotient * scale);
quotients[i]=quotient;
remainders[i]=remainder;
requiredSelections[requiredSelectionsCount]=quotient;
requiredSelectionsCount++;
if (remainder != 0) {
requiredSelections[requiredSelectionsCount]=quotient + 1;
requiredSelectionsCount++;
}
}
sort(requiredSelections,0,requiredSelectionsCount);
selectAllInPlace(requiredSelections,0,requiredSelectionsCount - 1,dataset,0,dataset.length - 1);
Map<Integer,Double> ret=new HashMap<Integer,Double>();
for (int i=0; i < indexes.length; i++) {
int quotient=quotients[i];
int remainder=remainders[i];
if (remainder == 0) {
ret.put(indexes[i],dataset[quotient]);
}
else {
ret.put(indexes[i],interpolate(dataset[quotient],dataset[quotient + 1],remainder,scale));
}
}
return unmodifiableMap(ret);
}
|
Computes the quantile values of the given dataset, performing the computation in-place.
|
public boolean removeFile(MetaImage mi){
boolean rv=false;
synchronized (this) {
CachedFileEntry entry=miToCachedFile.get(mi);
if (entry != null) {
miToCachedFile.remove(mi);
totalFileSize-=entry.fileSize;
rv=entry.file.delete();
if (DEBUG_MI_CACHE) System.out.println("deleting tracked local cache file for MI " + mi + ": "+ entry.file+ ", image cache numItems="+ miToCachedFile.size()+ " total file size="+ totalFileSize);
}
return rv;
}
}
|
Remove this MetaImage's cached file from the cache tracker and remove from disk
|
public boolean contains(Geometry geom){
return eval(geom);
}
|
Tests whether this PreparedPolygon <tt>contains</tt> a given geometry.
|
void fireDisconnectedEvents(){
ArrayList registered=null;
HostEvent ev=null;
synchronized (listeners) {
registered=(ArrayList)listeners.clone();
}
for (Iterator i=registered.iterator(); i.hasNext(); ) {
HostListener l=(HostListener)i.next();
if (ev == null) {
ev=new HostEvent(this);
}
l.disconnected(ev);
}
}
|
Fire hostDisconnectEvent events.
|
private void renderAxes(Camera camera){
glPushMatrix();
glLoadIdentity();
float rotX=camera.getRotation().x;
float rotY=camera.getRotation().y;
float rotZ=0;
glRotatef(rotX,1.0f,0.0f,0.0f);
glRotatef(rotY,0.0f,1.0f,0.0f);
glRotatef(rotZ,0.0f,0.0f,1.0f);
glLineWidth(2.0f);
glBegin(GL_LINES);
glColor3f(1.0f,0.0f,0.0f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(1.0f,0.0f,0.0f);
glColor3f(0.0f,1.0f,0.0f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,1.0f,0.0f);
glColor3f(1.0f,1.0f,1.0f);
glVertex3f(0.0f,0.0f,0.0f);
glVertex3f(0.0f,0.0f,1.0f);
glEnd();
glPopMatrix();
}
|
Renders the three axis in space (For debugging purposes only
|
public static synchronized boolean saveTemplates(){
if (!getTemplatesEnabled()) {
return false;
}
return getCodeTemplateManager().saveTemplates();
}
|
Attempts to save all currently-known templates to the current template directory, as set by <code>setTemplateDirectory</code>. Templates will be saved as XML files with names equal to their abbreviations; for example, a template that expands on the word "forb" will be saved as <code>forb.xml</code>.
|
public static String encodeObject(java.io.Serializable serializableObject) throws java.io.IOException {
return encodeObject(serializableObject,NO_OPTIONS);
}
|
Serializes an object and returns the Base64-encoded version of that serialized object. <p>As of v 2.3, if the object cannot be serialized or there is another 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> The object is not GZip-compressed before being encoded.
|
public void beforeInsert(int index,int element){
if (size == index) {
add(element);
return;
}
if (index > size || index < 0) throw new IndexOutOfBoundsException("Index: " + index + ", Size: "+ size);
ensureCapacity(size + 1);
System.arraycopy(elements,index,elements,index + 1,size - index);
elements[index]=element;
size++;
}
|
Inserts the specified element before the specified position into the receiver. Shifts the element currently at that position (if any) and any subsequent elements to the right.
|
static String sqlToRegexSimilar(String sqlPattern,CharSequence escapeStr){
final char escapeChar;
if (escapeStr != null) {
if (escapeStr.length() != 1) {
throw invalidEscapeCharacter(escapeStr.toString());
}
escapeChar=escapeStr.charAt(0);
}
else {
escapeChar=0;
}
return sqlToRegexSimilar(sqlPattern,escapeChar);
}
|
Translates a SQL SIMILAR pattern to Java regex pattern, with optional escape string.
|
public void incrementWeight(){
if (strength < upperBound) {
strength+=increment;
}
getNetwork().fireSynapseChanged(this);
}
|
Increment this weight by increment.
|
public boolean isMinYSet(int scale){
return mMinY[scale] != MathHelper.NULL_VALUE;
}
|
Returns if the minimum Y value was set.
|
public void putDescription(File f,String fileDescription){
fileDescriptions.put(f,fileDescription);
}
|
Adds a human readable description of the file.
|
public static Exists createExists(Model model,ElementList elements){
Exists notExists=model.createResource(SP.Exists).as(Exists.class);
notExists.addProperty(SP.elements,elements);
return notExists;
}
|
Creates a new Exists as a blank node in a given Model.
|
private void clientServerTombstoneMessageTest(boolean replicatedRegion){
Host host=Host.getHost(0);
VM vm0=host.getVM(0);
VM vm1=host.getVM(1);
VM vm2=host.getVM(2);
VM vm3=host.getVM(3);
final String name=this.getUniqueName() + "Region";
int port1=createServerRegion(vm0,name,replicatedRegion);
int port2=createServerRegion(vm1,name,replicatedRegion);
createDurableClientRegion(vm2,name,port1,port2,true);
createDurableClientRegion(vm3,name,port1,port2,true);
createEntries(vm2);
destroyEntries(vm3);
forceGC(vm0);
if (!replicatedRegion) {
forceGC(vm1);
}
Wait.pause(5000);
checkClientReceivedGC(vm2);
checkClientReceivedGC(vm3);
checkServerQueuesEmpty(vm0);
checkServerQueuesEmpty(vm1);
}
|
test that distributed GC messages are properly cleaned out of durable client HA queues
|
public static void e(String tag,String msg){
e(tag,msg,null);
}
|
Prints a message at ERROR priority.
|
public TreePath(TreePath p,Tree t){
if (t.getKind() == Tree.Kind.COMPILATION_UNIT) {
compilationUnit=(CompilationUnitTree)t;
parent=null;
}
else {
compilationUnit=p.compilationUnit;
parent=p;
}
leaf=t;
}
|
Creates a TreePath for a child node.
|
public SourceFolderSelectionDialog(){
super(UIUtils.getShell());
this.setLabelProvider(new SourceFolderLabelProvider());
this.setContentProvider(new ArrayContentProvider());
this.setHelpAvailable(false);
}
|
Create a new source folder selection dialog
|
public OracleExtractionHG(int lm_feat_id_){
this.lm_feat_id=lm_feat_id_;
this.BACKOFF_LEFT_LM_STATE_SYM_ID=Vocabulary.id(BACKOFF_LEFT_LM_STATE_SYM);
this.NULL_LEFT_LM_STATE_SYM_ID=Vocabulary.id(NULL_RIGHT_LM_STATE_SYM);
this.NULL_RIGHT_LM_STATE_SYM_ID=Vocabulary.id(NULL_RIGHT_LM_STATE_SYM);
}
|
Constructs a new object capable of extracting a tree from a hypergraph that most closely matches a provided oracle sentence. <p> It seems that the symbol table here should only need to represent monolingual terminals, plus nonterminals.
|
public Criteria OR(){
return this.example.or();
}
|
Append "OR" Criteria
|
public JCStatement Call(JCExpression apply){
return apply.type.hasTag(VOID) ? Exec(apply) : Return(apply);
}
|
Wrap a method invocation in an expression statement or return statement, depending on whether the method invocation expression's type is void.
|
private void changeFontSize(int s){
setFont(m_currentFont=new Font("A Name",0,s));
m_fontSize=getFontMetrics(getFont());
Dimension d;
for (int noa=0; noa < m_numNodes; noa++) {
d=m_nodes[noa].m_node.stringSize(m_fontSize);
if (m_nodes[noa].m_node.getShape() == 1) {
m_nodes[noa].m_height=d.height + 10;
m_nodes[noa].m_width=d.width + 8;
m_nodes[noa].m_side=m_nodes[noa].m_width / 2;
}
else if (m_nodes[noa].m_node.getShape() == 2) {
m_nodes[noa].m_height=(int)((d.height + 2) * 1.6);
m_nodes[noa].m_width=(int)((d.width + 2) * 1.6);
m_nodes[noa].m_side=m_nodes[noa].m_width / 2;
}
if (noa < m_numNodes - 1) {
d=m_edges[noa].m_edge.stringSize(m_fontSize);
m_edges[noa].m_height=d.height + 8;
m_edges[noa].m_width=d.width + 8;
m_edges[noa].m_side=m_edges[noa].m_width / 2;
m_edges[noa].m_tb=m_edges[noa].m_height / 2;
}
}
}
|
This will change the font size for displaying the tree to the one specified.
|
public static int gsmBcdByteToInt(byte b){
int ret=0;
if ((b & 0xf0) <= 0x90) {
ret=(b >> 4) & 0xf;
}
if ((b & 0x0f) <= 0x09) {
ret+=(b & 0xf) * 10;
}
return ret;
}
|
Decodes a GSM-style BCD byte, returning an int ranging from 0-99. <p/> In GSM land, the least significant BCD digit is stored in the most significant nibble. <p/> Out-of-range digits are treated as 0 for the sake of the time stamp, because of this: <p/> TS 23.040 section 9.2.3.11 "if the MS receives a non-integer value in the SCTS, it shall assume the digit is set to 0 but shall store the entire field exactly as received"
|
public void paintPlot(Graphics2D g2,double xScale,double yScale,double xOffset,double yOffset){
if (distribution == null) {
return;
}
super.paintPlot(g2,xScale,yScale,xOffset,yOffset);
g2.setPaint(linePaint);
g2.setStroke(lineStroke);
double x1=xMin + offset;
double y1=distribution.pdf(x1 - offset);
double step=(xMax - xMin) / stepCount;
for (int i=1; i < stepCount; i++) {
double x2=x1 + step;
double y2=distribution.pdf(x2 - offset);
drawLine(g2,x1,y1,x2,y2);
x1=x2;
y1=y2;
}
}
|
Paint actual plot
|
protected void removeAction(KeyStroke keyStroke,KeyboardCallback keyboardCallback){
synchronized (actions) {
if (actions.containsKey(keyStroke) && actions.get(keyStroke).contains(keyboardCallback)) {
synchronized (actions.get(keyStroke)) {
actions.get(keyStroke).remove(keyboardCallback);
}
}
}
}
|
remove a single action.
|
@Override public void process(KeyValPair<K,V> tuple){
addTuple(tuple,numerators);
}
|
Adds tuple to the numerator hash.
|
public TimePeriodFormatException(String message){
super(message);
}
|
Creates a new exception.
|
private void returnData(Object ret){
if (myHost != null) {
myHost.returnData(ret);
}
}
|
Used to communicate a return object from a plugin tool to the main Whitebox user-interface.
|
@Override public boolean add(BugInstance bugInstance){
return add(bugInstance,bugInstance.getFirstVersion() == 0L && bugInstance.getLastVersion() == 0L);
}
|
Add a BugInstance to this BugCollection. This just calls add(bugInstance, true).
|
@Override public void close() throws IOException {
if (!closed) {
inf.end();
closed=true;
eof=true;
super.close();
}
}
|
Closes the input stream.
|
protected void prepare(){
ProcessInfoParameter[] para=getParameter();
for (int i=0; i < para.length; i++) {
String name=para[i].getParameterName();
if (para[i].getParameter() == null) ;
else if (name.equals("AD_Client_ID")) p_AD_Client_ID=para[i].getParameterAsInt();
else log.log(Level.SEVERE,"Unknown Parameter: " + name);
}
p_Record_ID=getRecord_ID();
}
|
Prepare - e.g., get Parameters.
|
private void checkRerequest(Set<String> streams){
if (!checkTimePassed(specialCheckLastDone,SPECIAL_CHECK_DELAY,streamsRequestErrors)) {
return;
}
requestStreamsInfo2(streams,true);
}
|
Check the given channels whether they meet the criteria for rechecking offline status. This check is performed relatively often, but as opposed to requestStreamsInfo() requests are only done rarely (when a stream just went offline).
|
private UasBnoAuth(){
}
|
DOCUMENT ME!
|
public boolean shouldStop(){
return getProcessState() == PROCESS_STATE_STOPPED;
}
|
Returns true iff the process should be stopped.
|
private void drawVertical(Canvas c,RecyclerView parent){
final int left=parent.getPaddingLeft();
final int right=parent.getWidth() - parent.getPaddingRight();
final int childCount=parent.getChildCount();
for (int i=0; i < childCount; i++) {
final View child=parent.getChildAt(i);
final RecyclerView.LayoutParams params=(RecyclerView.LayoutParams)child.getLayoutParams();
final int top=child.getBottom() + params.bottomMargin + Math.round(ViewCompat.getTranslationY(child));
final int bottom=top + mDivider.getIntrinsicHeight();
mDivider.setBounds(left,top,right,bottom);
mDivider.draw(c);
}
}
|
Draw vertical.
|
public final boolean bringPointIntoView(final int offset){
return getView().bringPointIntoView(offset);
}
|
Move the point, specified by the offset, into the view if it is needed. This has to be called after layout. Returns true if anything changed.
|
public boolean overEquator(){
LatLonPoint llN=new LatLonPoint.Float();
inverse(width / 2,0,llN);
LatLonPoint llS=new LatLonPoint.Float();
inverse(width / 2,height,llS);
return MoreMath.sign(llN.getY()) != MoreMath.sign(llS.getY());
}
|
Check if equator is visible on screen.
|
public void paintTabbedPaneTabAreaBorder(SynthContext context,Graphics g,int x,int y,int w,int h,int orientation){
paintBorder(context,g,x,y,w,h,null);
}
|
Paints the border of the area behind the tabs of a tabbed pane. This implementation invokes the method of the same name without the orientation.
|
public boolean isReadyToShop(){
return readyToShop;
}
|
Checks if a node is at the correct place where the shopping begins
|
private List<List<Cluster<CorrelationModel>>> extractCorrelationClusters(Clustering<Model> dbscanResult,Relation<V> relation,int dimensionality,ERiCNeighborPredicate<V>.Instance npred){
List<List<Cluster<CorrelationModel>>> clusterMap=new ArrayList<>();
for (int i=0; i <= dimensionality; i++) {
clusterMap.add(new ArrayList<Cluster<CorrelationModel>>());
}
Cluster<Model> noise=null;
for ( Cluster<Model> clus : dbscanResult.getAllClusters()) {
DBIDs group=clus.getIDs();
int dim=clus.isNoise() ? dimensionality : npred.dimensionality(clus.getIDs().iter());
if (dim < dimensionality) {
EigenPairFilter filter=new FirstNEigenPairFilter(dim);
List<Cluster<CorrelationModel>> correlationClusters=clusterMap.get(dim);
SortedEigenPairs epairs=settings.pca.processIds(group,relation).getEigenPairs();
int numstrong=filter.filter(epairs.eigenValues());
PCAFilteredResult pcares=new PCAFilteredResult(epairs,numstrong,1.,0.);
double[] centroid=Centroid.make(relation,group).getArrayRef();
Cluster<CorrelationModel> correlationCluster=new Cluster<>("[" + dim + "_"+ correlationClusters.size()+ "]",group,new CorrelationModel(pcares,centroid));
correlationClusters.add(correlationCluster);
}
else {
if (noise == null) {
noise=clus;
}
else {
ModifiableDBIDs merged=DBIDUtil.newHashSet(noise.getIDs());
merged.addDBIDs(clus.getIDs());
noise.setIDs(merged);
}
}
}
if (noise != null && noise.size() > 0) {
List<Cluster<CorrelationModel>> correlationClusters=clusterMap.get(dimensionality);
EigenPairFilter filter=new FirstNEigenPairFilter(dimensionality);
SortedEigenPairs epairs=settings.pca.processIds(noise.getIDs(),relation).getEigenPairs();
int numstrong=filter.filter(epairs.eigenValues());
PCAFilteredResult pcares=new PCAFilteredResult(epairs,numstrong,1.,0.);
double[] centroid=Centroid.make(relation,noise.getIDs()).getArrayRef();
Cluster<CorrelationModel> correlationCluster=new Cluster<>("[noise]",noise.getIDs(),new CorrelationModel(pcares,centroid));
correlationClusters.add(correlationCluster);
}
for (int i=dimensionality; i > 0; i--) {
if (!clusterMap.get(i).isEmpty()) {
break;
}
clusterMap.remove(i);
}
return clusterMap;
}
|
Extracts the correlation clusters and noise from the copac result and returns a mapping of correlation dimension to maps of clusters within this correlation dimension. Each cluster is defined by the basis vectors defining the subspace in which the cluster appears.
|
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
int userid=0;
String school="";
String code=request.getParameter("code");
school=(String)request.getSession().getAttribute("school");
if (school == null || "".equals(school)) {
response.sendRedirect("../index.jsp");
return;
}
try {
String id=request.getSession().getAttribute("userid").toString();
userid=Integer.parseInt(id);
}
catch ( Exception e) {
response.sendRedirect("../" + school);
return;
}
UserSql userSql=new UserSql(school);
User user=userSql.getUser(userid);
if (user == null) {
response.sendRedirect("../" + school);
return;
}
AESTool aesTool=new AESTool();
String username=aesTool.decrypt(user.getUsername(),"zhixin");
String password=aesTool.decrypt(user.getPassword(),"zhixin");
RequestDispatcher dispatcher=request.getRequestDispatcher("LoginServlet?username=" + username + "&password="+ password+ "&checkNum="+ code);
dispatcher.forward(request,response);
}
|
The doGet method of the servlet. <br> This method is called when a form has its tag value method equals to get.
|
public PowerModelCubic(double maxPower,double staticPowerPercent){
setMaxPower(maxPower);
setStaticPower(staticPowerPercent * maxPower);
setConstant((maxPower - getStaticPower()) / Math.pow(100,3));
}
|
Instantiates a new power model cubic.
|
@DSGenerator(tool_name="Doppelganger",tool_version="2.0",generated_on="2013-12-30 12:30:01.779 -0500",hash_original_method="F869914CDBD46FC071FA033F543D25F0",hash_generated_method="7A5DCEBD865AAB901EC83FAE4998317C") public synchronized DrmRights queryRights(DrmRawContent content){
DrmRights rights=new DrmRights();
int res=nativeQueryRights(content,rights);
if (JNI_DRM_FAILURE == res) return null;
return rights;
}
|
Query DRM rights of specified DRM raw content.
|
public MemoryCaching(){
setLimit(Runtime.getRuntime().maxMemory() / 4);
}
|
use 25% of heap
|
protected boolean runs(@NotNull String exec){
GeneralCommandLine commandLine=new GeneralCommandLine();
commandLine.setExePath(exec);
try {
CapturingProcessHandler handler=new CapturingProcessHandler(commandLine.createProcess(),CharsetToolkit.getDefaultSystemCharset());
ProcessOutput result=handler.runProcess((int)TimeUnit.SECONDS.toMillis(5));
return !result.isTimeout();
}
catch ( ExecutionException e) {
return false;
}
}
|
Checks if it is possible to run the specified program. Made protected for tests not to start a process there.
|
public void addLayoutComponent(String name,Component comp){
}
|
Adds the specified component to the layout. Not used by this class.
|
private void load(){
Task[] tasks=myTaskManager.getTasks();
for (int i=0; i < tasks.length; i++) {
Task task=tasks[i];
TaskGraphNode tgn=getTaskGraphNode(task);
TaskDependencySlice dependencies=task.getDependenciesAsDependee();
TaskDependency[] relationship=dependencies.toArray();
for (int j=0; j < relationship.length; j++) {
Task successor=relationship[j].getDependant();
tgn.addSuccessor(getTaskGraphNode(successor));
}
}
}
|
Loads data from task manager into pert chart abstraction. It creates all TaskGraphNodes.
|
private void debugSegmentEntries(WriteStream out,ReadStream is,SegmentExtent extent,TableEntry table) throws IOException {
TempBuffer tBuf=TempBuffer.create();
byte[] buffer=tBuf.buffer();
for (long ptr=extent.length() - BLOCK_SIZE; ptr > 0; ptr-=BLOCK_SIZE) {
is.position(ptr);
is.readAll(buffer,0,BLOCK_SIZE);
long seq=BitsUtil.readLong(buffer,0);
int head=8;
byte[] tableKey=new byte[32];
System.arraycopy(buffer,head,tableKey,0,tableKey.length);
is.readAll(tableKey,0,tableKey.length);
head+=tableKey.length;
int offset=BLOCK_SIZE - 8;
int tail=BitsUtil.readInt16(buffer,offset);
offset+=2;
boolean isCont=buffer[offset] == 1;
if (seq <= 0 || tail <= 0) {
return;
}
while ((head=debugSegmentIndex(out,is,buffer,extent.address(),ptr,head,table)) < tail) {
}
if (!isCont) {
break;
}
}
}
|
Trace through the segment entries.
|
public void showColumn(int modelColumn){
for ( TableColumn column : allColumns) {
if (column.getModelIndex() == modelColumn) {
showColumn(column);
break;
}
}
}
|
Show a hidden column in the table.
|
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 boolean isCategoriesEnabled(){
return categoriesEnabled;
}
|
Returns whether categories are available for searching and browsing on the marketplace.
|
public boolean isParser(){
return (iParser != null);
}
|
Is this formatter capable of parsing.
|
public void onAccessibilityEvent(AccessibilityEvent event){
if (event.getEventType() == AccessibilityEventCompat.TYPE_TOUCH_INTERACTION_START) {
mLastTouchTime=System.nanoTime();
}
}
|
Called so we can avoid detecting screen touches as side taps.
|
@Override public boolean eIsSet(int featureID){
switch (featureID) {
case GamlPackage.PRAGMA__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
return super.eIsSet(featureID);
}
|
<!-- begin-user-doc --> <!-- end-user-doc -->
|
public PasswordExpiration(boolean isNotificationEnabled,String fromAddr,String subject,int[] notificationTime){
this.isEmailNotificationEnabled=isNotificationEnabled;
this.emailFrom=fromAddr;
this.emailSubject=subject;
this.notificationDays=notificationTime;
}
|
Create a password expiration configuration.
|
public void init(ServletConfig config) throws ServletException {
super.init(config);
if (!WebEnv.initWeb(config)) throw new ServletException("LocationServlet.init");
}
|
Initialize global variables
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.