use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.
the class SerializerPerformanceTest method setup.
@Before
public void setup() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("entities");
_builder.newLine();
{
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, SerializerPerformanceTest.numberOfElements, true);
for (final Integer i : _doubleDotLessThan) {
_builder.append("\t");
_builder.append("//comment before element");
_builder.newLine();
_builder.append("\t");
_builder.append("Foo /* comment between elements*/ \"Bar\" //comment after element ");
_builder.newLine();
}
}
_builder.append("end");
_builder.newLine();
this.model = this._parseHelper.parse(_builder);
final EList<Entity> entities = this.model.getDomainModel().getEntities();
final Function1<Integer, Boolean> _function = (Integer it) -> {
return Boolean.valueOf((((it).intValue() % SerializerPerformanceTest.editEvery) == 0));
};
final Function1<Integer, Entity> _function_1 = (Integer it) -> {
return entities.get((it).intValue());
};
final Iterable<Entity> removeUs = IterableExtensions.<Integer, Entity>map(IterableExtensions.<Integer>filter(new ExclusiveRange(0, SerializerPerformanceTest.numberOfElements, true), _function), _function_1);
CollectionExtensions.<Entity>removeAll(entities, removeUs);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project metalib by softlang.
the class FsmlGenerator method getPackageName.
/**
* Gets an appropriate package name for the resource
*/
public String getPackageName(final Resource resource) {
final StringBuilder result = new StringBuilder();
final URI uri = resource.getURI();
int _segmentCount = uri.segmentCount();
int _minus = (_segmentCount - 1);
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(3, _minus, true);
for (final Integer i : _doubleDotLessThan) {
{
String _segment = uri.segment((i).intValue());
String _firstLower = StringExtensions.toFirstLower(_segment);
result.append(_firstLower);
result.append(".");
}
}
String _lastSegment = uri.lastSegment();
String _firstLower = StringExtensions.toFirstLower(_lastSegment);
String _fileName = this.getFileName(_firstLower);
result.append(_fileName);
return result.toString();
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-xtend by eclipse.
the class SwtBotProjectHelper method fileNew.
protected static void fileNew(final SWTWorkbenchBot it, final String newWhat) {
int retries = 3;
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, retries, true);
for (final Integer i : _doubleDotLessThan) {
try {
it.menu("File").menu("New").menu(newWhat).click();
return;
} catch (final Throwable _t) {
if (_t instanceof WidgetNotFoundException) {
final WidgetNotFoundException e = (WidgetNotFoundException) _t;
if (((i).intValue() == (retries - 1))) {
throw e;
}
String _message = e.getMessage();
String _plus = ("failed: " + _message);
InputOutput.<String>println(_plus);
InputOutput.<String>println("retrying...");
it.sleep(1000);
} else {
throw Exceptions.sneakyThrow(_t);
}
}
}
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.
the class ChunkedResourceDescriptions method readExternal.
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
final int numChunks = in.readInt();
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, numChunks, true);
for (final Integer i : _doubleDotLessThan) {
{
final String chunkName = in.readUTF();
final int numDescriptions = in.readInt();
final ArrayList<IResourceDescription> descriptions = new ArrayList<IResourceDescription>(numDescriptions);
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, numDescriptions, true);
for (final Integer j : _doubleDotLessThan_1) {
Object _readObject = in.readObject();
descriptions.add(((IResourceDescription) _readObject));
}
ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(descriptions);
this.chunk2resourceDescriptions.put(chunkName, _resourceDescriptionsData);
}
}
}
use of org.eclipse.xtext.xbase.lib.ExclusiveRange in project xtext-core by eclipse.
the class SerializableResourceDescription method readExternal.
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
this.setURI(SerializationExtensions.readURI(in));
final int descriptionsSize = in.readInt();
ArrayList<SerializableEObjectDescription> _arrayList = new ArrayList<SerializableEObjectDescription>(descriptionsSize);
this.descriptions = _arrayList;
ExclusiveRange _doubleDotLessThan = new ExclusiveRange(0, descriptionsSize, true);
for (final Integer i : _doubleDotLessThan) {
this.descriptions.add(SerializationExtensions.<SerializableEObjectDescription>readCastedObject(in));
}
final int referencesSize = in.readInt();
ArrayList<SerializableReferenceDescription> _arrayList_1 = new ArrayList<SerializableReferenceDescription>(referencesSize);
this.references = _arrayList_1;
ExclusiveRange _doubleDotLessThan_1 = new ExclusiveRange(0, referencesSize, true);
for (final Integer i_1 : _doubleDotLessThan_1) {
this.references.add(SerializationExtensions.<SerializableReferenceDescription>readCastedObject(in));
}
final int importedNamesSize = in.readInt();
ArrayList<QualifiedName> _arrayList_2 = new ArrayList<QualifiedName>(importedNamesSize);
this.importedNames = _arrayList_2;
ExclusiveRange _doubleDotLessThan_2 = new ExclusiveRange(0, importedNamesSize, true);
for (final Integer i_2 : _doubleDotLessThan_2) {
this.importedNames.add(SerializationExtensions.readQualifiedName(in));
}
}
Aggregations