metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/IntegerMeasurement.java Diff Switch to side-by-side view
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RealMeasurement.java Diff Switch to side-by-side view
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/MeasurementCollection.java Diff Switch to side-by-side view
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric
File was removed.
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans
File was removed.
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model
File was removed.
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CC.ecore to metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RascalMetrics.ecore
--- a/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CC.ecore +++ b/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RascalMetrics.ecore @@ -1,28 +1,34 @@ <?xml version="1.0" encoding="ASCII"?> -<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="org.ossmeter.metricprovider.rascal.metric.trans.model"> - <eClassifiers xsi:type="ecore:EClass" name="CC"> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="org.ossmeter.metricprovider.rascal.trans.model"> + <eClassifiers xsi:type="ecore:EClass" name="RascalMetrics"> <eAnnotations source="db"> <details key="qualifiedCollectionNames" value="true"/> </eAnnotations> - <eAnnotations source="customize"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="methodCC" upperBound="-1" eType="//CCData" containment="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="measurements" upperBound="-1" eType="//Measurement" containment="true"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="CCData"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileURL"> + <eClassifiers xsi:type="ecore:EClass" name="Measurement" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="uri"> <eAnnotations source="searchable"/> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="methodName"> - <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="ccValue"> - <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELong"/> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="revisionNumber"> - <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> - </eStructuralFeatures> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="date"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="metric"> + <eAnnotations source="searchable"/> <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eStructuralFeatures> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="IntegerMeasurement" eSuperTypes="//Measurement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//ELong"/> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="RealMeasurement" eSuperTypes="//Measurement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> + </eStructuralFeatures> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="BooleanMeasurement" eSuperTypes="//Measurement"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value"> + <eType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/> + </eStructuralFeatures> + </eClassifiers> </ecore:EPackage>
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CC.emf to metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RascalMetrics.emf
--- a/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CC.emf +++ b/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RascalMetrics.emf @@ -1,16 +1,25 @@ -package org.ossmeter.metricprovider.rascal.metric.trans.model; +package org.ossmeter.metricprovider.rascal.trans.model; @db(qualifiedCollectionNames="true") -@customize -class CC { - val CCData[*] methodCC; +class RascalMetrics { + val Measurement[*] measurements; +} + +abstract class Measurement { + @searchable + attr String uri; + @searchable + attr String metric; } -class CCData { - @searchable - attr String fileURL; - attr String methodName; - attr long ccValue; - attr String revisionNumber; - attr String date; -}+class IntegerMeasurement extends Measurement { + attr long value; +} + +class RealMeasurement extends Measurement { + attr float value; +} + +class BooleanMeasurement extends Measurement { + attr boolean value; +}
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CC.java to metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RascalMetrics.java
--- a/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CC.java +++ b/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/RascalMetrics.java @@ -1,33 +1,29 @@ -package org.ossmeter.metricprovider.rascal.metric.trans.model; +package org.ossmeter.metricprovider.rascal.trans.model; import com.googlecode.pongo.runtime.*; import com.mongodb.*; -// protected region custom-imports on begin -// protected region custom-imports end -public class CC extends PongoDB { +public class RascalMetrics extends PongoDB { - public CC() {} + public RascalMetrics() {} - public CC(DB db) { + public RascalMetrics(DB db) { setDb(db); } - protected CCDataCollection methodCC = null; - - // protected region custom-fields-and-methods on begin - // protected region custom-fields-and-methods end + protected MeasurementCollection measurements = null; - public CCDataCollection getMethodCC() { - return methodCC; + + public MeasurementCollection getMeasurements() { + return measurements; } @Override public void setDb(DB db) { super.setDb(db); - methodCC = new CCDataCollection(db.getCollection("CC.methodCC")); - pongoCollections.add(methodCC); + measurements = new MeasurementCollection(db.getCollection("RascalMetrics.measurements")); + pongoCollections.add(measurements); } }
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CCData.java to metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/BooleanMeasurement.java
--- a/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CCData.java +++ b/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/BooleanMeasurement.java @@ -1,4 +1,4 @@ -package org.ossmeter.metricprovider.rascal.metric.trans.model; +package org.ossmeter.metricprovider.rascal.trans.model; import com.mongodb.*; import java.util.*; @@ -6,68 +6,29 @@ import com.googlecode.pongo.runtime.querying.*; -public class CCData extends Pongo { +public class BooleanMeasurement extends Measurement { - public CCData() { + public BooleanMeasurement() { super(); - FILEURL.setOwningType("org.ossmeter.metricprovider.rascal.metric.trans.model.CCData"); - METHODNAME.setOwningType("org.ossmeter.metricprovider.rascal.metric.trans.model.CCData"); - CCVALUE.setOwningType("org.ossmeter.metricprovider.rascal.metric.trans.model.CCData"); - REVISIONNUMBER.setOwningType("org.ossmeter.metricprovider.rascal.metric.trans.model.CCData"); - DATE.setOwningType("org.ossmeter.metricprovider.rascal.metric.trans.model.CCData"); + super.setSuperTypes("org.ossmeter.metricprovider.rascal.trans.model.Measurement"); + URI.setOwningType("org.ossmeter.metricprovider.rascal.trans.model.BooleanMeasurement"); + METRIC.setOwningType("org.ossmeter.metricprovider.rascal.trans.model.BooleanMeasurement"); + VALUE.setOwningType("org.ossmeter.metricprovider.rascal.trans.model.BooleanMeasurement"); } - public static StringQueryProducer FILEURL = new StringQueryProducer("fileURL"); - public static StringQueryProducer METHODNAME = new StringQueryProducer("methodName"); - public static NumericalQueryProducer CCVALUE = new NumericalQueryProducer("ccValue"); - public static StringQueryProducer REVISIONNUMBER = new StringQueryProducer("revisionNumber"); - public static StringQueryProducer DATE = new StringQueryProducer("date"); + public static StringQueryProducer URI = new StringQueryProducer("uri"); + public static StringQueryProducer METRIC = new StringQueryProducer("metric"); + public static StringQueryProducer VALUE = new StringQueryProducer("value"); - public String getFileURL() { - return parseString(dbObject.get("fileURL")+"", ""); + public boolean getValue() { + return parseBoolean(dbObject.get("value")+"", false); } - public CCData setFileURL(String fileURL) { - dbObject.put("fileURL", fileURL); - notifyChanged(); - return this; - } - public String getMethodName() { - return parseString(dbObject.get("methodName")+"", ""); - } - - public CCData setMethodName(String methodName) { - dbObject.put("methodName", methodName); - notifyChanged(); - return this; - } - public long getCcValue() { - return parseLong(dbObject.get("ccValue")+"", 0); - } - - public CCData setCcValue(long ccValue) { - dbObject.put("ccValue", ccValue); - notifyChanged(); - return this; - } - public String getRevisionNumber() { - return parseString(dbObject.get("revisionNumber")+"", ""); - } - - public CCData setRevisionNumber(String revisionNumber) { - dbObject.put("revisionNumber", revisionNumber); - notifyChanged(); - return this; - } - public String getDate() { - return parseString(dbObject.get("date")+"", ""); - } - - public CCData setDate(String date) { - dbObject.put("date", date); + public BooleanMeasurement setValue(boolean value) { + dbObject.put("value", value); notifyChanged(); return this; }
metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CCDataCollection.java to metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/Measurement.java
--- a/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/metric/trans/model/CCDataCollection.java +++ b/metric-providers/org.ossmeter.metricprovider.rascal/src/org/ossmeter/metricprovider/rascal/trans/model/Measurement.java @@ -1,48 +1,45 @@ -package org.ossmeter.metricprovider.rascal.metric.trans.model; +package org.ossmeter.metricprovider.rascal.trans.model; +import com.mongodb.*; +import java.util.*; import com.googlecode.pongo.runtime.*; -import java.util.*; -import com.mongodb.*; +import com.googlecode.pongo.runtime.querying.*; -public class CCDataCollection extends PongoCollection<CCData> { + +public abstract class Measurement extends Pongo { - public CCDataCollection(DBCollection dbCollection) { - super(dbCollection); - createIndex("fileURL"); + + + public Measurement() { + super(); + URI.setOwningType("org.ossmeter.metricprovider.rascal.trans.model.Measurement"); + METRIC.setOwningType("org.ossmeter.metricprovider.rascal.trans.model.Measurement"); } - public Iterable<CCData> findById(String id) { - return new IteratorIterable<CCData>(new PongoCursorIterator<CCData>(this, dbCollection.find(new BasicDBObject("_id", id)))); + public static StringQueryProducer URI = new StringQueryProducer("uri"); + public static StringQueryProducer METRIC = new StringQueryProducer("metric"); + + + public String getUri() { + return parseString(dbObject.get("uri")+"", ""); } - public Iterable<CCData> findByFileURL(String q) { - return new IteratorIterable<CCData>(new PongoCursorIterator<CCData>(this, dbCollection.find(new BasicDBObject("fileURL", q + "")))); + public Measurement setUri(String uri) { + dbObject.put("uri", uri); + notifyChanged(); + return this; + } + public String getMetric() { + return parseString(dbObject.get("metric")+"", ""); } - public CCData findOneByFileURL(String q) { - CCData cCData = (CCData) PongoFactory.getInstance().createPongo(dbCollection.findOne(new BasicDBObject("fileURL", q + ""))); - if (cCData != null) { - cCData.setPongoCollection(this); - } - return cCData; - } + public Measurement setMetric(String metric) { + dbObject.put("metric", metric); + notifyChanged(); + return this; + } - - public long countByFileURL(String q) { - return dbCollection.count(new BasicDBObject("fileURL", q + "")); - } - @Override - public Iterator<CCData> iterator() { - return new PongoCursorIterator<CCData>(this, dbCollection.find()); - } - public void add(CCData cCData) { - super.add(cCData); - } - - public void remove(CCData cCData) { - super.remove(cCData); - } }