Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
APSTUD-4778: fixed halt condition and also made improvement where ong…
…oing parses will be seen and used instead of requesting new parses.
- Loading branch information
Showing
25 changed files
with
1,497 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
plugins/com.aptana.core/src/com/aptana/core/util/ImmutableTupleN.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* Aptana Studio | ||
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions). | ||
* Please see the license.html included with this distribution for details. | ||
* Any modifications to this file must keep this entire header intact. | ||
*/ | ||
package com.aptana.core.util; | ||
|
||
/** | ||
* Defines a tuple of objects, adding equals and hashCode operations. It's expected that any object added to this tuple | ||
* is immutable (properly implementing hashCode() and equals()). | ||
* | ||
* @author Fabio | ||
*/ | ||
public class ImmutableTupleN | ||
{ | ||
|
||
private final Object[] tuple; | ||
private int hash; | ||
|
||
public ImmutableTupleN(Object... tuple) | ||
{ | ||
this.tuple = tuple; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) | ||
{ | ||
if (!(obj instanceof ImmutableTupleN)) | ||
{ | ||
return false; | ||
} | ||
|
||
ImmutableTupleN t2 = (ImmutableTupleN) obj; | ||
if (t2.tuple.length != this.tuple.length) | ||
{ | ||
return false; | ||
} | ||
for (int i = 0; i < tuple.length; i++) | ||
{ | ||
Object o1 = tuple[i]; | ||
Object o2 = t2.tuple[i]; | ||
if (o1 != o2) | ||
{ | ||
if (o1 == null || o2 == null) | ||
{ | ||
return false; | ||
} | ||
if (!o1.equals(o2)) | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
if (hash != 0) | ||
{ | ||
return hash; | ||
} | ||
int ret = 1; | ||
int len = tuple.length; | ||
for (int i = 0; i < len; i++) | ||
{ | ||
Object o = tuple[i]; | ||
if (o == null) | ||
{ | ||
ret += (i * 3); | ||
} | ||
else | ||
{ | ||
int objHash = o.hashCode(); | ||
ret += (i * 7 + (3 * objHash)); | ||
} | ||
} | ||
hash = 7 + ret; | ||
return hash; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return this.getClass().getName() + "[" + StringUtil.join(", ", tuple) + "]"; | ||
} | ||
|
||
/** | ||
* @return the size of this tuple. | ||
*/ | ||
public int size() | ||
{ | ||
return this.tuple.length; | ||
} | ||
|
||
/** | ||
* @param i | ||
* the position of the element we want to get at the tuple. | ||
*/ | ||
public Object getAt(int i) | ||
{ | ||
return this.tuple[i]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
plugins/com.aptana.parsing/src/com/aptana/parsing/IParseStateCacheKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Aptana Studio | ||
* Copyright (c) 2005-2011 by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the GNU Public License (GPL) v3 (with exceptions). | ||
* Please see the license.html included with this distribution for details. | ||
* Any modifications to this file must keep this entire header intact. | ||
*/ | ||
package com.aptana.parsing; | ||
|
||
/** | ||
* @author Fabio | ||
*/ | ||
public interface IParseStateCacheKey | ||
{ | ||
|
||
/** | ||
* @return if a reparse is required. It may be possible that 2 keys are equal but a reparse is still needed. (i.e.: | ||
* done given the need of having a result with or without comments -- in which case having the comments is | ||
* accepted if we ask for it without the comments but the other way around would need a reparse). | ||
*/ | ||
public boolean requiresReparse(IParseStateCacheKey newCacheKey); | ||
|
||
/** | ||
* Just making explicit that we must have equals/hashCode properly implemented as this will be a key in a map. | ||
*/ | ||
public boolean equals(Object other); | ||
|
||
/** | ||
* Just making explicit that we must have equals/hashCode properly implemented as this will be a key in a map. | ||
*/ | ||
public int hashCode(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.