Compare commits
94 Commits
V1.1.0
...
selction_bug
| Author | SHA1 | Date | |
|---|---|---|---|
| 979261432a | |||
| e25f56a8a9 | |||
| 8a8691a889 | |||
| de15b84bef | |||
| b78d8bea45 | |||
| a49842a119 | |||
| dbe5d603ed | |||
| cde1835c74 | |||
| b332eca891 | |||
| 75efd69b77 | |||
| 960610bab2 | |||
| 98029f8c7a | |||
| 9c09cf5f40 | |||
| 113d65cfc4 | |||
| 22e7bb04f0 | |||
| d8c5b7d9c3 | |||
| 2e7ae5309f | |||
| f81e830e93 | |||
| 47a285bf6d | |||
| c080773878 | |||
| bcf4e1a274 | |||
| 93fd192782 | |||
| e687eef42c | |||
| 2a709113fe | |||
| 8d7acdb9cb | |||
| 77684d828c | |||
| 9f902057ba | |||
| 42660c7a2e | |||
| 97a806f9d9 | |||
| 60185fbaee | |||
| 5411a405d4 | |||
| 694dad1cf5 | |||
| 5fb9a7dcdf | |||
| 3faa7205ae | |||
| 3cbe5d56d9 | |||
| 5745ab4f2c | |||
| 4a17108ccc | |||
| 408138c27c | |||
| 3211db8743 | |||
| 0c81988d8c | |||
| 0107c423a3 | |||
| 5d41816eb6 | |||
| e41b7e25ed | |||
| dba8b2731d | |||
| 048fa93b53 | |||
| 6cc5597c25 | |||
| 694423be3b | |||
| 0634b9cfd5 | |||
| c4b16338a8 | |||
| bda2a84532 | |||
| 9d4c951e7f | |||
| 8a89b21d34 | |||
| e02df858fa | |||
| 0fbe22e2e0 | |||
| 021c2bceff | |||
| 9862c14040 | |||
| 23131e7527 | |||
| 0833bca1bd | |||
| 1cf00ec882 | |||
| 6c0bbd5f1f | |||
| f13b091664 | |||
| dff41eceb2 | |||
| d267e64907 | |||
| 792dcd55f3 | |||
| 2b33ea0c85 | |||
| f69a6f2e89 | |||
| 0f133a3df6 | |||
| 549c522bf7 | |||
| 2f11d8ed7b | |||
| 7dd0a24df6 | |||
| a052fe2324 | |||
| 4fc24453ae | |||
| b468fba441 | |||
| f80021059e | |||
| 7c0822b4d2 | |||
| cdde384ed3 | |||
| fce1bdb1e7 | |||
| b68a7d3259 | |||
| 44b13c105d | |||
| ed0558afdf | |||
| d0be3b0ca2 | |||
| a052c6aa3b | |||
| 8a30ba8dea | |||
| 0a7972c54d | |||
| b1890eb5e1 | |||
| 1aaf5c837e | |||
| c8a213e985 | |||
| 5f82700290 | |||
| 40a0137dfd | |||
| 4ec9a928b9 | |||
| c82c41bbf0 | |||
| 79c49e6f1d | |||
| 96d628d322 | |||
| b4d81d96b8 |
@@ -3,3 +3,8 @@
|
|||||||
/.recommenders/
|
/.recommenders/
|
||||||
/RemoteSystemsTempFiles/
|
/RemoteSystemsTempFiles/
|
||||||
/*.zip
|
/*.zip
|
||||||
|
SCViewer initiator_target.launch
|
||||||
|
SCViewer.xcf
|
||||||
|
SCViewer_1.png
|
||||||
|
*.launch
|
||||||
|
copyrightLog.txt
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
Eclipse Public License - v 1.0
|
||||||
|
|
||||||
|
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
|
||||||
|
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
|
||||||
|
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||||
|
|
||||||
|
1. DEFINITIONS
|
||||||
|
|
||||||
|
"Contribution" means:
|
||||||
|
|
||||||
|
a) in the case of the initial Contributor, the initial code and documentation
|
||||||
|
distributed under this Agreement, and
|
||||||
|
b) in the case of each subsequent Contributor:
|
||||||
|
i) changes to the Program, and
|
||||||
|
ii) additions to the Program;
|
||||||
|
|
||||||
|
where such changes and/or additions to the Program originate from and are
|
||||||
|
distributed by that particular Contributor. A Contribution 'originates'
|
||||||
|
from a Contributor if it was added to the Program by such Contributor
|
||||||
|
itself or anyone acting on such Contributor's behalf. Contributions do not
|
||||||
|
include additions to the Program which: (i) are separate modules of
|
||||||
|
software distributed in conjunction with the Program under their own
|
||||||
|
license agreement, and (ii) are not derivative works of the Program.
|
||||||
|
|
||||||
|
"Contributor" means any person or entity that distributes the Program.
|
||||||
|
|
||||||
|
"Licensed Patents" mean patent claims licensable by a Contributor which are
|
||||||
|
necessarily infringed by the use or sale of its Contribution alone or when
|
||||||
|
combined with the Program.
|
||||||
|
|
||||||
|
"Program" means the Contributions distributed in accordance with this
|
||||||
|
Agreement.
|
||||||
|
|
||||||
|
"Recipient" means anyone who receives the Program under this Agreement,
|
||||||
|
including all Contributors.
|
||||||
|
|
||||||
|
2. GRANT OF RIGHTS
|
||||||
|
a) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||||
|
Recipient a non-exclusive, worldwide, royalty-free copyright license to
|
||||||
|
reproduce, prepare derivative works of, publicly display, publicly
|
||||||
|
perform, distribute and sublicense the Contribution of such Contributor,
|
||||||
|
if any, and such derivative works, in source code and object code form.
|
||||||
|
b) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||||
|
Recipient a non-exclusive, worldwide, royalty-free patent license under
|
||||||
|
Licensed Patents to make, use, sell, offer to sell, import and otherwise
|
||||||
|
transfer the Contribution of such Contributor, if any, in source code and
|
||||||
|
object code form. This patent license shall apply to the combination of
|
||||||
|
the Contribution and the Program if, at the time the Contribution is
|
||||||
|
added by the Contributor, such addition of the Contribution causes such
|
||||||
|
combination to be covered by the Licensed Patents. The patent license
|
||||||
|
shall not apply to any other combinations which include the Contribution.
|
||||||
|
No hardware per se is licensed hereunder.
|
||||||
|
c) Recipient understands that although each Contributor grants the licenses
|
||||||
|
to its Contributions set forth herein, no assurances are provided by any
|
||||||
|
Contributor that the Program does not infringe the patent or other
|
||||||
|
intellectual property rights of any other entity. Each Contributor
|
||||||
|
disclaims any liability to Recipient for claims brought by any other
|
||||||
|
entity based on infringement of intellectual property rights or
|
||||||
|
otherwise. As a condition to exercising the rights and licenses granted
|
||||||
|
hereunder, each Recipient hereby assumes sole responsibility to secure
|
||||||
|
any other intellectual property rights needed, if any. For example, if a
|
||||||
|
third party patent license is required to allow Recipient to distribute
|
||||||
|
the Program, it is Recipient's responsibility to acquire that license
|
||||||
|
before distributing the Program.
|
||||||
|
d) Each Contributor represents that to its knowledge it has sufficient
|
||||||
|
copyright rights in its Contribution, if any, to grant the copyright
|
||||||
|
license set forth in this Agreement.
|
||||||
|
|
||||||
|
3. REQUIREMENTS
|
||||||
|
|
||||||
|
A Contributor may choose to distribute the Program in object code form under
|
||||||
|
its own license agreement, provided that:
|
||||||
|
|
||||||
|
a) it complies with the terms and conditions of this Agreement; and
|
||||||
|
b) its license agreement:
|
||||||
|
i) effectively disclaims on behalf of all Contributors all warranties
|
||||||
|
and conditions, express and implied, including warranties or
|
||||||
|
conditions of title and non-infringement, and implied warranties or
|
||||||
|
conditions of merchantability and fitness for a particular purpose;
|
||||||
|
ii) effectively excludes on behalf of all Contributors all liability for
|
||||||
|
damages, including direct, indirect, special, incidental and
|
||||||
|
consequential damages, such as lost profits;
|
||||||
|
iii) states that any provisions which differ from this Agreement are
|
||||||
|
offered by that Contributor alone and not by any other party; and
|
||||||
|
iv) states that source code for the Program is available from such
|
||||||
|
Contributor, and informs licensees how to obtain it in a reasonable
|
||||||
|
manner on or through a medium customarily used for software exchange.
|
||||||
|
|
||||||
|
When the Program is made available in source code form:
|
||||||
|
|
||||||
|
a) it must be made available under this Agreement; and
|
||||||
|
b) a copy of this Agreement must be included with each copy of the Program.
|
||||||
|
Contributors may not remove or alter any copyright notices contained
|
||||||
|
within the Program.
|
||||||
|
|
||||||
|
Each Contributor must identify itself as the originator of its Contribution,
|
||||||
|
if
|
||||||
|
any, in a manner that reasonably allows subsequent Recipients to identify the
|
||||||
|
originator of the Contribution.
|
||||||
|
|
||||||
|
4. COMMERCIAL DISTRIBUTION
|
||||||
|
|
||||||
|
Commercial distributors of software may accept certain responsibilities with
|
||||||
|
respect to end users, business partners and the like. While this license is
|
||||||
|
intended to facilitate the commercial use of the Program, the Contributor who
|
||||||
|
includes the Program in a commercial product offering should do so in a manner
|
||||||
|
which does not create potential liability for other Contributors. Therefore,
|
||||||
|
if a Contributor includes the Program in a commercial product offering, such
|
||||||
|
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
|
||||||
|
every other Contributor ("Indemnified Contributor") against any losses,
|
||||||
|
damages and costs (collectively "Losses") arising from claims, lawsuits and
|
||||||
|
other legal actions brought by a third party against the Indemnified
|
||||||
|
Contributor to the extent caused by the acts or omissions of such Commercial
|
||||||
|
Contributor in connection with its distribution of the Program in a commercial
|
||||||
|
product offering. The obligations in this section do not apply to any claims
|
||||||
|
or Losses relating to any actual or alleged intellectual property
|
||||||
|
infringement. In order to qualify, an Indemnified Contributor must:
|
||||||
|
a) promptly notify the Commercial Contributor in writing of such claim, and
|
||||||
|
b) allow the Commercial Contributor to control, and cooperate with the
|
||||||
|
Commercial Contributor in, the defense and any related settlement
|
||||||
|
negotiations. The Indemnified Contributor may participate in any such claim at
|
||||||
|
its own expense.
|
||||||
|
|
||||||
|
For example, a Contributor might include the Program in a commercial product
|
||||||
|
offering, Product X. That Contributor is then a Commercial Contributor. If
|
||||||
|
that Commercial Contributor then makes performance claims, or offers
|
||||||
|
warranties related to Product X, those performance claims and warranties are
|
||||||
|
such Commercial Contributor's responsibility alone. Under this section, the
|
||||||
|
Commercial Contributor would have to defend claims against the other
|
||||||
|
Contributors related to those performance claims and warranties, and if a
|
||||||
|
court requires any other Contributor to pay any damages as a result, the
|
||||||
|
Commercial Contributor must pay those damages.
|
||||||
|
|
||||||
|
5. NO WARRANTY
|
||||||
|
|
||||||
|
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
|
||||||
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
|
||||||
|
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
|
||||||
|
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
|
||||||
|
Recipient is solely responsible for determining the appropriateness of using
|
||||||
|
and distributing the Program and assumes all risks associated with its
|
||||||
|
exercise of rights under this Agreement , including but not limited to the
|
||||||
|
risks and costs of program errors, compliance with applicable laws, damage to
|
||||||
|
or loss of data, programs or equipment, and unavailability or interruption of
|
||||||
|
operations.
|
||||||
|
|
||||||
|
6. DISCLAIMER OF LIABILITY
|
||||||
|
|
||||||
|
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
|
||||||
|
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
|
||||||
|
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
|
||||||
|
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
|
OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
7. GENERAL
|
||||||
|
|
||||||
|
If any provision of this Agreement is invalid or unenforceable under
|
||||||
|
applicable law, it shall not affect the validity or enforceability of the
|
||||||
|
remainder of the terms of this Agreement, and without further action by the
|
||||||
|
parties hereto, such provision shall be reformed to the minimum extent
|
||||||
|
necessary to make such provision valid and enforceable.
|
||||||
|
|
||||||
|
If Recipient institutes patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
|
||||||
|
(excluding combinations of the Program with other software or hardware)
|
||||||
|
infringes such Recipient's patent(s), then such Recipient's rights granted
|
||||||
|
under Section 2(b) shall terminate as of the date such litigation is filed.
|
||||||
|
|
||||||
|
All Recipient's rights under this Agreement shall terminate if it fails to
|
||||||
|
comply with any of the material terms or conditions of this Agreement and does
|
||||||
|
not cure such failure in a reasonable period of time after becoming aware of
|
||||||
|
such noncompliance. If all Recipient's rights under this Agreement terminate,
|
||||||
|
Recipient agrees to cease use and distribution of the Program as soon as
|
||||||
|
reasonably practicable. However, Recipient's obligations under this Agreement
|
||||||
|
and any licenses granted by Recipient relating to the Program shall continue
|
||||||
|
and survive.
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute copies of this Agreement, but in
|
||||||
|
order to avoid inconsistency the Agreement is copyrighted and may only be
|
||||||
|
modified in the following manner. The Agreement Steward reserves the right to
|
||||||
|
publish new versions (including revisions) of this Agreement from time to
|
||||||
|
time. No one other than the Agreement Steward has the right to modify this
|
||||||
|
Agreement. The Eclipse Foundation is the initial Agreement Steward. The
|
||||||
|
Eclipse Foundation may assign the responsibility to serve as the Agreement
|
||||||
|
Steward to a suitable separate entity. Each new version of the Agreement will
|
||||||
|
be given a distinguishing version number. The Program (including
|
||||||
|
Contributions) may always be distributed subject to the version of the
|
||||||
|
Agreement under which it was received. In addition, after a new version of the
|
||||||
|
Agreement is published, Contributor may elect to distribute the Program
|
||||||
|
(including its Contributions) under the new version. Except as expressly
|
||||||
|
stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
|
||||||
|
licenses to the intellectual property of any Contributor under this Agreement,
|
||||||
|
whether expressly, by implication, estoppel or otherwise. All rights in the
|
||||||
|
Program not expressly granted under this Agreement are reserved.
|
||||||
|
|
||||||
|
This Agreement is governed by the laws of the State of New York and the
|
||||||
|
intellectual property laws of the United States of America. No party to this
|
||||||
|
Agreement will bring a legal action under this Agreement more than one year
|
||||||
|
after the cause of action arose. Each party waives its rights to a jury trial in
|
||||||
|
any resulting litigation.
|
||||||
@@ -6,30 +6,18 @@ created by the SystemC VCD trace implementation and the SystemC Verification Lib
|
|||||||
For further description of the SCV please refer to
|
For further description of the SCV please refer to
|
||||||
http://www.accellera.org/activities/committees/systemc-verification.
|
http://www.accellera.org/activities/committees/systemc-verification.
|
||||||
|
|
||||||
The viewer is in early alpha stage and not yet ready for production use!
|
> If you encounter issue when running on Linux please try running as `SWT_GTK3=0 scviewer` as there exist issues wiht GTK3.
|
||||||
|
|
||||||
|
The viewer has the following features
|
||||||
|
- support of VCD files (compressed and uncompressed)
|
||||||
|
- real numbers
|
||||||
|
- showing vectors and real numbers as analog (step-wise & continuous)
|
||||||
|
- various value representations of bit vectors
|
||||||
|
- support of SCV transaction recordings in various formats
|
||||||
|
- text log files (compressed and uncompressed)
|
||||||
|
- sqlite based
|
||||||
|
- visualization of transaction relations
|
||||||
|
|
||||||
The plugins are structured as follows:
|
|
||||||
- com.minres.scviewer.database
|
|
||||||
the interface defining the API to access the database and the implementation for VCD
|
|
||||||
- com.minres.scviewer.database.text
|
|
||||||
an implementation of the API to read the text files generated by the SCV
|
|
||||||
sc_tr_text database
|
|
||||||
- com.minres.scviewer.database.sqlite
|
|
||||||
an implementation of the API to read the files generated by implementation in the
|
|
||||||
sc_tr_sqlite project using a SQLite based database
|
|
||||||
- com.minres.scviewer.database.test
|
|
||||||
a some JUnit tests of the 3 back ends
|
|
||||||
- com.minres.scviewer.ui
|
|
||||||
the viewer it self to diplay the transactions and associated views like the
|
|
||||||
outline of the DB and the properties of the transaction
|
|
||||||
- com.minres.scviewer.feature
|
|
||||||
the feature combining the plugins above into a somhow usable form
|
|
||||||
- scv_tr_sqlite
|
|
||||||
a C++ project containing the SQLite based SCV database implementation and the scv4tlm
|
|
||||||
socket implementations.
|
|
||||||
A simple example (scv_tr_recording_example.cpp) for testig purposes of the database is
|
|
||||||
provided.
|
|
||||||
|
|
||||||
To build the plugins the Eclipse SDK or PDE can be used. In both cases the Groovy
|
To build the plugins the Eclipse SDK or PDE can be used. In both cases the Groovy
|
||||||
eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be
|
eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be
|
||||||
installed.
|
installed.
|
||||||
@@ -39,4 +27,5 @@ TODO
|
|||||||
- add more tests
|
- add more tests
|
||||||
- move to feature based product to allow automatic updates
|
- move to feature based product to allow automatic updates
|
||||||
- improve graphics
|
- improve graphics
|
||||||
- catch-up e3 plugin to functionality of e4 product
|
- catch-up e3 plugin to functionality of e4 product
|
||||||
|
- add calculated traces
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry exported="true" kind="lib" path="json-20180813.jar" sourcepath="json-20180813-sources.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="leveldb-0.11-SNAPSHOT-uber.jar" sourcepath="leveldb-0.11-SNAPSHOT-sources.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/json-20180813-sources.jar
|
||||||
|
/leveldb-0.11-SNAPSHOT-sources.jar
|
||||||
|
/bin/
|
||||||
|
/target/
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.minres.scviewer.database.leveldb</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ds.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
pluginProject.equinox=false
|
||||||
|
pluginProject.extensions=false
|
||||||
|
resolve.requirebundle=false
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
enabled=true
|
||||||
|
path=OSGI-INF
|
||||||
|
validationErrorLevel=error
|
||||||
|
validationErrorLevel.missingImplicitUnbindMethod=error
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Leveldb
|
||||||
|
Bundle-SymbolicName: com.minres.scviewer.database.leveldb
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
||||||
|
Service-Component: OSGI-INF/*.xml
|
||||||
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Bundle-ClassPath: leveldb-0.11-SNAPSHOT-uber.jar,
|
||||||
|
.,
|
||||||
|
json-20180813.jar
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="LevelDbLoader">
|
||||||
|
<implementation class="com.minres.scviewer.database.leveldb.LevelDBLoader"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="com.minres.scviewer.database.IWaveformDbLoader"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.,\
|
||||||
|
OSGI-INF/,\
|
||||||
|
leveldb-0.11-SNAPSHOT-uber.jar,\
|
||||||
|
json-20180813.jar
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>com.minres.scviewer.database.leveldb</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.minres.scviewer</groupId>
|
||||||
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
|
</parent>
|
||||||
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
</project>
|
||||||
+87
@@ -0,0 +1,87 @@
|
|||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.iq80.leveldb.Options;
|
||||||
|
import org.iq80.leveldb.impl.SeekingIterator;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
|
public class LevelDBLoader implements IWaveformDbLoader {
|
||||||
|
|
||||||
|
static byte[] toByteArray(String value) {
|
||||||
|
return value.getBytes(UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TxDBWrapper levelDb;
|
||||||
|
private IWaveformDb db;
|
||||||
|
private Long maxTime=null;
|
||||||
|
private List<RelationType> usedRelationsList = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean load(IWaveformDb db, File inp) throws Exception {
|
||||||
|
try {
|
||||||
|
this.db=db;
|
||||||
|
levelDb = new TxDBWrapper(new Options(), inp);
|
||||||
|
JSONObject configVal = new JSONObject(levelDb.get("__config"));
|
||||||
|
if(!configVal.isEmpty())
|
||||||
|
levelDb.setTimeResolution(configVal.getLong("resolution"));
|
||||||
|
} catch(Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getMaxTime() {
|
||||||
|
if(maxTime==null) {
|
||||||
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
|
it.seek("st~");
|
||||||
|
Entry<String, String> val = null;
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<String, String> v = it.next();
|
||||||
|
if(!v.getKey().startsWith("st~")) continue;
|
||||||
|
val=v;
|
||||||
|
}
|
||||||
|
if(val==null)
|
||||||
|
maxTime = 0L;
|
||||||
|
else {
|
||||||
|
String[] token = val.getKey().split("~");
|
||||||
|
maxTime = Long.parseLong(token[2], 16)*levelDb.getTimeResolution();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IWaveform> getAllWaves() {
|
||||||
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
|
it.seek("s~");
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<String, String> val = it.next();
|
||||||
|
if(!val.getKey().startsWith("s~")) break;
|
||||||
|
TxStream stream = new TxStream(levelDb, db, new JSONObject(val.getValue()));
|
||||||
|
stream.setRelationTypeList(usedRelationsList);
|
||||||
|
streams.add(stream);
|
||||||
|
}
|
||||||
|
return streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<RelationType> getAllRelationTypes() {
|
||||||
|
// return Collections.emptyList();
|
||||||
|
return usedRelationsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
import static org.iq80.leveldb.shaded.guava.collect.Maps.immutableEntry;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.iq80.leveldb.DBIterator;
|
||||||
|
import org.iq80.leveldb.impl.SeekingIterator;
|
||||||
|
|
||||||
|
class StringDbIterator implements SeekingIterator<String, String> {
|
||||||
|
private final DBIterator iterator;
|
||||||
|
|
||||||
|
StringDbIterator(DBIterator iterator) {
|
||||||
|
this.iterator = iterator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return iterator.hasNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void seekToFirst() {
|
||||||
|
iterator.seekToFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void seek(String targetKey) {
|
||||||
|
iterator.seek(targetKey.getBytes(UTF_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entry<String, String> peek() {
|
||||||
|
return adapt(iterator.peekNext());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entry<String, String> next() {
|
||||||
|
return adapt(iterator.next());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Entry<String, String> adapt(Entry<byte[], byte[]> next) {
|
||||||
|
return immutableEntry(new String(next.getKey(), UTF_8), new String(next.getValue(), UTF_8));
|
||||||
|
}
|
||||||
|
}
|
||||||
+172
@@ -0,0 +1,172 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import org.iq80.leveldb.impl.SeekingIterator;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
|
||||||
|
public class Tx implements ITx {
|
||||||
|
|
||||||
|
private TxDBWrapper levelDb;
|
||||||
|
private TxStream trStream;
|
||||||
|
private TxGenerator trGenerator;
|
||||||
|
private long id;
|
||||||
|
private long start_time=0;
|
||||||
|
private long end_time=0;
|
||||||
|
private int concurency_index;
|
||||||
|
private boolean initialized=false;
|
||||||
|
private List<ITxAttribute> attributes;
|
||||||
|
private List<ITxRelation> incoming, outgoing;
|
||||||
|
|
||||||
|
public Tx(TxDBWrapper levelDb, TxStream trStream, TxGenerator trGenerator, long id) {
|
||||||
|
this.levelDb=levelDb;
|
||||||
|
this.trStream=trStream;
|
||||||
|
this.trGenerator=trGenerator;
|
||||||
|
this.id=id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITxStream<ITxEvent> getStream() {
|
||||||
|
return trStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITxGenerator getGenerator() {
|
||||||
|
return trGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getConcurrencyIndex() {
|
||||||
|
if(!initialized) loadFromDb();
|
||||||
|
return concurency_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getBeginTime() {
|
||||||
|
if(!initialized) loadFromDb();
|
||||||
|
return start_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getEndTime() {
|
||||||
|
loadFromDb();
|
||||||
|
return end_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ITxAttribute> getAttributes() {
|
||||||
|
if(attributes==null) {
|
||||||
|
loadFromDb();
|
||||||
|
}
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ITxRelation> getIncomingRelations() {
|
||||||
|
if(incoming==null) {
|
||||||
|
incoming = new ArrayList<ITxRelation>();
|
||||||
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
|
String key = "ri~"+String.format("%016x", id);
|
||||||
|
it.seek(key);
|
||||||
|
while(it.hasNext()) {
|
||||||
|
String val = it.next().getKey();
|
||||||
|
if(!val.startsWith(key)) break;;
|
||||||
|
String[] token = val.split("~");
|
||||||
|
long otherId = Long.parseLong(token[2], 16);
|
||||||
|
incoming.add(createRelation(otherId, token[3], false));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return incoming;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ITxRelation> getOutgoingRelations() {
|
||||||
|
if(outgoing==null) {
|
||||||
|
outgoing = new ArrayList<ITxRelation>();
|
||||||
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
|
String key="ro~"+String.format("%016x", id);
|
||||||
|
it.seek(key);
|
||||||
|
while(it.hasNext()) {
|
||||||
|
String val = it.next().getKey();
|
||||||
|
if(!val.startsWith(key)) break;
|
||||||
|
String[] token = val.split("~");
|
||||||
|
long otherId = Long.parseLong(token[2], 16);
|
||||||
|
outgoing.add(createRelation(otherId, token[3], true));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return outgoing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(ITx o) {
|
||||||
|
int res = this.getBeginTime().compareTo(o.getBeginTime());
|
||||||
|
if(res!=0)
|
||||||
|
return res;
|
||||||
|
else
|
||||||
|
return this.getId().compareTo(o.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFromDb() throws JSONException {
|
||||||
|
JSONObject dbVal = new JSONObject(levelDb.get("x~"+ String.format("%016x", id)));
|
||||||
|
start_time=dbVal.getLong("START_TIME") * levelDb.getTimeResolution();
|
||||||
|
end_time=dbVal.getLong("END_TIME") * levelDb.getTimeResolution();
|
||||||
|
concurency_index=dbVal.getInt("conc");
|
||||||
|
attributes=new ArrayList<>();
|
||||||
|
JSONArray arr = dbVal.getJSONArray("attr");
|
||||||
|
arr.forEach(entry -> {
|
||||||
|
TxAttribute attr = new TxAttribute(this, (JSONObject) entry);
|
||||||
|
attributes.add(attr);
|
||||||
|
});
|
||||||
|
initialized=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ITxRelation createRelation(long otherId, String name, boolean outgoing) {
|
||||||
|
try {
|
||||||
|
JSONObject otherTxVal = new JSONObject(levelDb.get("x~"+ String.format("%016x", otherId)));
|
||||||
|
if(otherTxVal.isEmpty()) return null;
|
||||||
|
JSONObject otherStreamVal = new JSONObject(levelDb.get("s~"+ String.format("%016x", otherTxVal.getLong("s"))));
|
||||||
|
if(otherStreamVal.isEmpty()) return null;
|
||||||
|
TxStream tgtStream = (TxStream) trStream.getDb().getStreamByName(otherStreamVal.getString("name"));
|
||||||
|
Tx that = (Tx) tgtStream.getTransactions().get(otherId);
|
||||||
|
return outgoing?
|
||||||
|
new TxRelation(trStream.getRelationType(name), this, that):
|
||||||
|
new TxRelation(trStream.getRelationType(name), that, this);
|
||||||
|
} catch (SecurityException | IllegalArgumentException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.AssociationType;
|
||||||
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
|
||||||
|
public class TxAttribute implements ITxAttribute{
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private DataType dataType;
|
||||||
|
|
||||||
|
private AssociationType associationType;
|
||||||
|
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public TxAttribute(Tx trTransaction, JSONObject attribute) {
|
||||||
|
this.name=attribute.getString("name");
|
||||||
|
this.dataType=DataType.values()[attribute.getInt("type")];
|
||||||
|
this.associationType=AssociationType.values()[attribute.getInt("assoc")];
|
||||||
|
this.value=attribute.get("value");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataType getDataType() {
|
||||||
|
return dataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AssociationType getType() {
|
||||||
|
return associationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+90
@@ -0,0 +1,90 @@
|
|||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.iq80.leveldb.Options;
|
||||||
|
import org.iq80.leveldb.Range;
|
||||||
|
import org.iq80.leveldb.ReadOptions;
|
||||||
|
import org.iq80.leveldb.Snapshot;
|
||||||
|
import org.iq80.leveldb.impl.DbImpl;
|
||||||
|
import org.iq80.leveldb.impl.SeekingIterator;
|
||||||
|
|
||||||
|
class TxDBWrapper {
|
||||||
|
private final Options options;
|
||||||
|
private final ReadOptions ro = new ReadOptions();
|
||||||
|
private final File databaseDir;
|
||||||
|
private DbImpl db;
|
||||||
|
private long timeResolution=1L;;
|
||||||
|
|
||||||
|
TxDBWrapper(Options options, File databaseDir) throws IOException {
|
||||||
|
this.options = options.verifyChecksums(true).createIfMissing(false).errorIfExists(false).cacheSize(64*1024*1024);
|
||||||
|
this.databaseDir = databaseDir;
|
||||||
|
this.db = new DbImpl(options, databaseDir);
|
||||||
|
ro.snapshot(db.getSnapshot());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String get(String key) {
|
||||||
|
byte[] slice = db.get(LevelDBLoader.toByteArray(key));
|
||||||
|
if (slice == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new String(slice, UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String get(String key, Snapshot snapshot) {
|
||||||
|
byte[] slice = db.get(LevelDBLoader.toByteArray(key), ro);
|
||||||
|
return slice == null? null : new String(slice, UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void put(String key, String value) {
|
||||||
|
db.put(LevelDBLoader.toByteArray(key), LevelDBLoader.toByteArray(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(String key) {
|
||||||
|
db.delete(LevelDBLoader.toByteArray(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
public SeekingIterator<String, String> iterator() {
|
||||||
|
return new StringDbIterator(db.iterator());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Snapshot getSnapshot() {
|
||||||
|
return db.getSnapshot();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
try {
|
||||||
|
ro.snapshot().close();
|
||||||
|
db.close();
|
||||||
|
} catch (IOException e) {} // ignore any error
|
||||||
|
}
|
||||||
|
|
||||||
|
public long size(String start, String limit) {
|
||||||
|
return db.getApproximateSizes(new Range(LevelDBLoader.toByteArray(start), LevelDBLoader.toByteArray(limit)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMaxNextLevelOverlappingBytes() {
|
||||||
|
return db.getMaxNextLevelOverlappingBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reopen() throws IOException {
|
||||||
|
reopen(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reopen(Options options) throws IOException {
|
||||||
|
this.close();
|
||||||
|
db = new DbImpl(options.verifyChecksums(true).createIfMissing(false).errorIfExists(false), databaseDir);
|
||||||
|
ro.snapshot(db.getSnapshot());
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimeResolution() {
|
||||||
|
return timeResolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeResolution(long resolution) {
|
||||||
|
this.timeResolution = resolution;
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
-22
@@ -8,39 +8,50 @@
|
|||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
public class SignalChange implements IWaveformEvent {
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
Long time;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
|
||||||
|
|
||||||
public SignalChange() {
|
|
||||||
time=0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SignalChange(Long time) {
|
public class TxEvent implements ITxEvent {
|
||||||
|
|
||||||
|
private final Type type;
|
||||||
|
private ITx tx;
|
||||||
|
|
||||||
|
public TxEvent(Type type, ITx tx) {
|
||||||
super();
|
super();
|
||||||
this.time = time;
|
this.type = type;
|
||||||
}
|
this.tx = tx;
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(IWaveformEvent o) {
|
|
||||||
return time.compareTo(o.getTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getTime() {
|
public Long getTime() {
|
||||||
return time;
|
return type==Type.BEGIN?tx.getBeginTime():tx.getEndTime();
|
||||||
}
|
|
||||||
|
|
||||||
public void setTime(Long time) {
|
|
||||||
this.time = time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWaveformEvent duplicate() throws CloneNotSupportedException {
|
public IWaveformEvent duplicate() throws CloneNotSupportedException {
|
||||||
return (IWaveformEvent) this.clone();
|
return new TxEvent(type, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(IWaveformEvent o) {
|
||||||
|
return getTime().compareTo(o.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITx getTransaction() {
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
|
||||||
|
public class TxGenerator implements ITxGenerator {
|
||||||
|
|
||||||
|
private ITxStream<ITxEvent> stream;
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public TxGenerator(ITxStream<ITxEvent> stream, JSONObject object) {
|
||||||
|
this.stream=stream;
|
||||||
|
this.id=object.getLong("id");
|
||||||
|
this.name=object.getString("name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITxStream<ITxEvent> getStream() {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ITx> getTransactions() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
|
public class TxRelation implements ITxRelation {
|
||||||
|
|
||||||
|
RelationType relationType;
|
||||||
|
Tx source, target;
|
||||||
|
|
||||||
|
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
||||||
|
this.source = source;
|
||||||
|
this.target = target;
|
||||||
|
this.relationType = relationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RelationType getRelationType() {
|
||||||
|
return relationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITx getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITx getTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+178
@@ -0,0 +1,178 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.leveldb;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.iq80.leveldb.impl.SeekingIterator;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.NavigableMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.HierNode;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
|
public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
|
|
||||||
|
private TxDBWrapper levelDb;
|
||||||
|
|
||||||
|
private String fullName;
|
||||||
|
|
||||||
|
private String kind;
|
||||||
|
|
||||||
|
private IWaveformDb db;
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
private TreeMap<Long, TxGenerator> generators;
|
||||||
|
|
||||||
|
private TreeMap<Long, ITx> transactions;
|
||||||
|
|
||||||
|
private Integer maxConcurrency;
|
||||||
|
|
||||||
|
private TreeMap<Long, List<ITxEvent>> events;
|
||||||
|
|
||||||
|
private List<RelationType> usedRelationsList;
|
||||||
|
|
||||||
|
public TxStream(TxDBWrapper database, IWaveformDb waveformDb, JSONObject object) {
|
||||||
|
super(object.get("name").toString());
|
||||||
|
this.levelDb=database;
|
||||||
|
this.db=waveformDb;
|
||||||
|
this.fullName=object.getString("name");
|
||||||
|
this.kind=object.getString("kind");
|
||||||
|
this.id = object.getLong("id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWaveformDb getDb() {
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFullName() {
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ITxGenerator> getGenerators() {
|
||||||
|
if(generators==null){
|
||||||
|
generators=new TreeMap<Long, TxGenerator>();
|
||||||
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
|
String key="sg~"+String.format("%016x", id);
|
||||||
|
it.seek(key);
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<String, String> val = it.next();
|
||||||
|
if(!val.getKey().startsWith(key)) break;
|
||||||
|
JSONObject jVal = new JSONObject(val.getValue());
|
||||||
|
generators.put(jVal.getLong("id"), new TxGenerator(this, jVal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList<ITxGenerator>(generators.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxConcurrency() {
|
||||||
|
if(maxConcurrency==null){
|
||||||
|
getTransactions();
|
||||||
|
}
|
||||||
|
return maxConcurrency;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NavigableMap<Long, List<ITxEvent>> getEvents(){
|
||||||
|
if(events==null){
|
||||||
|
events=new TreeMap<Long, List<ITxEvent>>();
|
||||||
|
for(Entry<Long, ITx> entry:getTransactions().entrySet()){
|
||||||
|
ITx tx = entry.getValue();
|
||||||
|
putEvent(new TxEvent(TxEvent.Type.BEGIN, tx));
|
||||||
|
putEvent(new TxEvent(TxEvent.Type.END, tx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void putEvent(TxEvent ev){
|
||||||
|
Long time = ev.getTime();
|
||||||
|
if(!events.containsKey(time)){
|
||||||
|
Vector<ITxEvent> vector=new Vector<ITxEvent>();
|
||||||
|
vector.add(ev);
|
||||||
|
events.put(time, vector);
|
||||||
|
} else {
|
||||||
|
events.get(time).add(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Map<Long, ITx> getTransactions() {
|
||||||
|
if(transactions==null){
|
||||||
|
if(generators==null) getGenerators();
|
||||||
|
transactions = new TreeMap<Long, ITx>();
|
||||||
|
maxConcurrency=0;
|
||||||
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
|
String key = "sgx~"+String.format("%016x", id);
|
||||||
|
it.seek(key);
|
||||||
|
while(it.hasNext()) {
|
||||||
|
Entry<String, String> val = it.next();
|
||||||
|
if(!val.getKey().startsWith(key)) break;
|
||||||
|
String[] token = val.getKey().split("~");
|
||||||
|
long gid = Long.parseLong(token[2], 16); // gen id
|
||||||
|
long id = Long.parseLong(token[3], 16); // tx id
|
||||||
|
ITx tx = new Tx(levelDb, this, generators.get(gid), id);
|
||||||
|
transactions.put(id, tx);
|
||||||
|
maxConcurrency= Math.max(maxConcurrency, tx.getConcurrencyIndex());
|
||||||
|
}
|
||||||
|
maxConcurrency++;
|
||||||
|
}
|
||||||
|
return transactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ITxEvent> getWaveformEventsAtTime(Long time) {
|
||||||
|
return getEvents().get(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelationTypeList(List<RelationType> usedRelationsList){
|
||||||
|
this.usedRelationsList=usedRelationsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelationType getRelationType(String name) {
|
||||||
|
RelationType relType=RelationType.create(name);
|
||||||
|
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
|
||||||
|
return relType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean equals(IWaveform other) {
|
||||||
|
return(other instanceof TxStream && this.getId()==other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
|
<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Bundle-Name: SQLite transaction database
|
|||||||
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
@@ -15,3 +15,4 @@ Bundle-ActivationPolicy: lazy
|
|||||||
Embed-Dependency: sqlite-jdbc
|
Embed-Dependency: sqlite-jdbc
|
||||||
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
||||||
a="sqlite-jdbc";v="3.8.7"
|
a="sqlite-jdbc";v="3.8.7"
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.sqlite
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
@@ -15,4 +15,5 @@
|
|||||||
<version>3.8.7</version>
|
<version>3.8.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</project>
|
||||||
+14
-11
@@ -13,6 +13,7 @@ package com.minres.scviewer.database.sqlite;
|
|||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -22,7 +23,6 @@ import java.util.List;
|
|||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
||||||
@@ -60,9 +60,9 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() {
|
public List<IWaveform> getAllWaves() {
|
||||||
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
||||||
List<IWaveform<? extends IWaveformEvent>> streams=new ArrayList<IWaveform<? extends IWaveformEvent>>();
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
try {
|
try {
|
||||||
for(ScvStream scvStream:handler.selectObjects()){
|
for(ScvStream scvStream:handler.selectObjects()){
|
||||||
TxStream stream = new TxStream(database, db, scvStream);
|
TxStream stream = new TxStream(database, db, scvStream);
|
||||||
@@ -81,14 +81,17 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db;
|
this.db=db;
|
||||||
FileInputStream fis = new FileInputStream(file);
|
try {
|
||||||
byte[] buffer = new byte[x.length];
|
FileInputStream fis = new FileInputStream(file);
|
||||||
int read = fis.read(buffer, 0, x.length);
|
byte[] buffer = new byte[x.length];
|
||||||
fis.close();
|
int read = fis.read(buffer, 0, x.length);
|
||||||
if (read == x.length)
|
fis.close();
|
||||||
for (int i = 0; i < x.length; i++)
|
if (read == x.length)
|
||||||
if (buffer[i] != x[i]) return false;
|
for (int i = 0; i < x.length; i++)
|
||||||
|
if (buffer[i] != x[i]) return false;
|
||||||
|
} catch(FileNotFoundException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
database=new SQLiteDatabase(file.getAbsolutePath());
|
database=new SQLiteDatabase(file.getAbsolutePath());
|
||||||
database.setData("TIMERESOLUTION", 1L);
|
database.setData("TIMERESOLUTION", 1L);
|
||||||
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
|
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,6 @@ import com.minres.scviewer.database.ITxGenerator;
|
|||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
@@ -117,6 +116,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
|||||||
sb.append(scvStream.getId());
|
sb.append(scvStream.getId());
|
||||||
resultSet = statement.executeQuery(sb.toString());
|
resultSet = statement.executeQuery(sb.toString());
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
|
if(maxConcurrency==null) maxConcurrency=0;
|
||||||
Object value = resultSet.getObject("concurrencyLevel");
|
Object value = resultSet.getObject("concurrencyLevel");
|
||||||
if(value!=null)
|
if(value!=null)
|
||||||
maxConcurrency=(Integer) value;
|
maxConcurrency=(Integer) value;
|
||||||
@@ -192,7 +192,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
|
public Boolean equals(IWaveform other) {
|
||||||
return(other instanceof TxStream && this.getId()==other.getId());
|
return(other instanceof TxStream && this.getId()==other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -11,32 +11,32 @@
|
|||||||
<booleanAttribute key="clearws" value="true"/>
|
<booleanAttribute key="clearws" value="true"/>
|
||||||
<booleanAttribute key="clearwslog" value="false"/>
|
<booleanAttribute key="clearwslog" value="false"/>
|
||||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||||
<booleanAttribute key="default" value="false"/>
|
<booleanAttribute key="default" value="true"/>
|
||||||
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.database.swt,com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
|
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
|
||||||
<booleanAttribute key="includeOptional" value="true"/>
|
<booleanAttribute key="includeOptional" value="true"/>
|
||||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
<listEntry value="/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java"/>
|
<listEntry value="/com.minres.scviewer.database.test"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
<listEntry value="1"/>
|
<listEntry value="4"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.minres.scviewer.database.test.DatabaseServicesTest"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||||
<stringAttribute key="selected_target_plugins" value="com.google.guava*10.0.1.v201203051515@default:default,com.google.guava*15.0.0.v201403281430@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet*3.0.0.v201112011016@default:default,javax.servlet*3.1.0.v201410161800@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy*2.4.3.xx-201508121448-e45@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.trace@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.mozilla.javascript@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
|
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,org.apache.ant@default:default,org.apache.commons.jxpath@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.hamcrest.core@default:default,org.junit@default:default"/>
|
||||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true"/>
|
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true,com.opcoach.e4.preferences@default:default"/>
|
||||||
<booleanAttribute key="show_selected_only" value="false"/>
|
<booleanAttribute key="show_selected_only" value="false"/>
|
||||||
<booleanAttribute key="tracing" value="false"/>
|
<booleanAttribute key="tracing" value="false"/>
|
||||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Bundle-Name: SCViewer database tests
|
|||||||
Bundle-SymbolicName: com.minres.scviewer.database.test
|
Bundle-SymbolicName: com.minres.scviewer.database.test
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GnbH
|
Bundle-Vendor: MINRES Technologies GnbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: org.junit,
|
Require-Bundle: org.junit,
|
||||||
com.minres.scviewer.database,
|
com.minres.scviewer.database,
|
||||||
com.minres.scviewer.database.sqlite;bundle-version="1.0.0",
|
com.minres.scviewer.database.sqlite;bundle-version="1.0.0",
|
||||||
@@ -12,3 +12,4 @@ Require-Bundle: org.junit,
|
|||||||
com.minres.scviewer.database.vcd;bundle-version="1.0.0"
|
com.minres.scviewer.database.vcd;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.test
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/.scviewer.*
|
||||||
|
/.my_db.txlog*
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
|||||||
|
MANIFEST-000045
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
2018/11/03-15:38:59.715484 139851522529088Delete type=3 #1
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
+3915
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-surefire-plugin</artifactId>
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
|
<version>0.23.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- <bundleStartLevel /> -->
|
<!-- <bundleStartLevel /> -->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -26,6 +27,5 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
||||||
+66
-9
@@ -15,11 +15,23 @@ import static org.junit.Assert.assertNotNull;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.AssociationType;
|
||||||
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.ISignal;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.ITxEvent.Type;
|
||||||
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
|
|
||||||
@@ -43,13 +55,6 @@ public class DatabaseServicesTest {
|
|||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
waveformDb=waveformDbFactory.getDatabase();
|
waveformDb=waveformDbFactory.getDatabase();
|
||||||
// Wait for OSGi dependencies
|
|
||||||
// for (int i = 0; i < 10; i++) {
|
|
||||||
// if (waveformDb.size() == 3) // Dependencies fulfilled
|
|
||||||
// return;
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// }
|
|
||||||
// assertEquals("OSGi dependencies unfulfilled", 3, WaveformDb.getLoaders().size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@@ -62,13 +67,22 @@ public class DatabaseServicesTest {
|
|||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
waveformDb.load(f);
|
waveformDb.load(f);
|
||||||
assertNotNull(waveformDb);
|
assertNotNull(waveformDb);
|
||||||
assertEquals(14, waveformDb.getAllWaves().size());
|
List<IWaveform> waves= waveformDb.getAllWaves();
|
||||||
|
assertEquals(14, waves.size());
|
||||||
assertEquals(2, waveformDb.getChildNodes().size());
|
assertEquals(2, waveformDb.getChildNodes().size());
|
||||||
|
IWaveform bus_data_wave = waves.get(0);
|
||||||
|
ISignal<?> bus_data_sig = (ISignal<?>) bus_data_wave;
|
||||||
|
Entry<Long, ?> bus_data_entry = bus_data_sig.getEvents().floorEntry(1400000000L);
|
||||||
|
assertTrue("01111000".equals(bus_data_entry.getValue().toString()));
|
||||||
|
IWaveform rw_wave = waves.get(2);
|
||||||
|
ISignal<?> rw_sig = (ISignal<?>) rw_wave;
|
||||||
|
Entry<Long, ?> rw_entry = rw_sig.getEvents().floorEntry(2360000000L);
|
||||||
|
assertTrue("1".equals(rw_entry.getValue().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTxSQLite() throws Exception {
|
public void testTxSQLite() throws Exception {
|
||||||
File f = new File("inputs/my_db.txdb").getAbsoluteFile();
|
File f = new File("inputs/my_sqldb.txdb").getAbsoluteFile();
|
||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
waveformDb.load(f);
|
waveformDb.load(f);
|
||||||
assertNotNull(waveformDb);
|
assertNotNull(waveformDb);
|
||||||
@@ -86,5 +100,48 @@ public class DatabaseServicesTest {
|
|||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void testTxLDb() throws Exception {
|
||||||
|
File f = new File("inputs/my_ldb.txldb").getAbsoluteFile();
|
||||||
|
assertTrue(f.exists());
|
||||||
|
waveformDb.load(f);
|
||||||
|
assertNotNull(waveformDb);
|
||||||
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
|
List<IWaveform> waves = waveformDb.getAllWaves();
|
||||||
|
assertEquals(3, waves.size());
|
||||||
|
IWaveform wave = waves.get(0);
|
||||||
|
assertTrue(wave instanceof ITxStream<?>);
|
||||||
|
ITxStream<?> stream = (ITxStream<?>) wave;
|
||||||
|
assertEquals(2, stream.getGenerators().size());
|
||||||
|
NavigableMap<Long, List<ITxEvent>> eventsList = stream.getEvents();
|
||||||
|
assertEquals(27, eventsList.size());
|
||||||
|
Entry<Long, List<ITxEvent>> eventEntry = eventsList.firstEntry();
|
||||||
|
assertEquals(100000000L, (long) eventEntry.getKey());
|
||||||
|
List<ITxEvent> events = eventEntry.getValue();
|
||||||
|
assertEquals(1, events.size());
|
||||||
|
ITxEvent event = events.get(0);
|
||||||
|
assertEquals(Type.BEGIN, event.getType());
|
||||||
|
ITx tx = event.getTransaction();
|
||||||
|
assertEquals(3L, (long) tx.getId());
|
||||||
|
List<ITxAttribute> attrs = tx.getAttributes();
|
||||||
|
assertEquals(1, attrs.size());
|
||||||
|
ITxAttribute attr = attrs.get(0);
|
||||||
|
assertEquals("data", attr.getName());
|
||||||
|
assertEquals(DataType.UNSIGNED, attr.getDataType());
|
||||||
|
assertEquals(AssociationType.END, attr.getType());
|
||||||
|
assertTrue(attr.getValue() instanceof Integer);
|
||||||
|
assertEquals(0, (int) attr.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHierarchicalVCD() throws Exception {
|
||||||
|
File f = new File("inputs/simple_system.vcd").getAbsoluteFile();
|
||||||
|
assertTrue(f.exists());
|
||||||
|
waveformDb.load(f);
|
||||||
|
assertNotNull(waveformDb);
|
||||||
|
assertEquals(779, waveformDb.getAllWaves().size());
|
||||||
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-api-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-forkjoin-9.2.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
|
||||||
|
<classpathentry exported="true" kind="lib" path="lib/mapdb-3.0.7.jar" sourcepath="lib/mapdb-3.0.7-sources.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
groovy.compiler.level=23
|
groovy.compiler.level=26
|
||||||
|
|||||||
@@ -2,11 +2,10 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Textual transaction database
|
Bundle-Name: Textual transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
Bundle-SymbolicName: com.minres.scviewer.database.text
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
org.osgi.framework;version="1.3.0"
|
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.codehaus.groovy;bundle-version="1.8.6",
|
org.codehaus.groovy;bundle-version="1.8.6",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
@@ -15,3 +14,12 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
|||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.text
|
||||||
|
Bundle-ClassPath: lib/mapdb-3.0.7.jar,
|
||||||
|
.,
|
||||||
|
lib/eclipse-collections-9.2.0.jar,
|
||||||
|
lib/eclipse-collections-api-9.2.0.jar,
|
||||||
|
lib/eclipse-collections-forkjoin-9.2.0.jar,
|
||||||
|
lib/kotlin-stdlib-1.2.42.jar,
|
||||||
|
lib/lz4-1.3.0.jar,
|
||||||
|
lib/elsa-3.0.0-M5.jar
|
||||||
|
|||||||
@@ -10,6 +10,16 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
OSGI-INF/
|
OSGI-INF/,\
|
||||||
bin.excludes = **/*.groovy
|
lib/,\
|
||||||
|
lib/mapdb-3.0.7.jar,\
|
||||||
|
lib/eclipse-collections-9.2.0.jar,\
|
||||||
|
lib/eclipse-collections-api-9.2.0.jar,\
|
||||||
|
lib/eclipse-collections-forkjoin-9.2.0.jar,\
|
||||||
|
lib/kotlin-stdlib-1.2.42.jar,\
|
||||||
|
lib/lz4-1.3.0.jar,\
|
||||||
|
lib/elsa-3.0.0-M5.jar
|
||||||
|
bin.excludes = **/*.groovy,\
|
||||||
|
lib/mapdb-3.0.7-sources.jar,\
|
||||||
|
lib/mapdb-3.0.7-javadoc.jar
|
||||||
source.. = src/
|
source.. = src/
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,18 +2,21 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.text</artifactId>
|
<artifactId>com.minres.scviewer.database.text</artifactId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-compiler-plugin</artifactId>
|
<artifactId>tycho-compiler-plugin</artifactId>
|
||||||
|
<version>0.23.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<compilerId>groovy-eclipse-compiler</compilerId>
|
<compilerId>groovy-eclipse-compiler</compilerId>
|
||||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
||||||
@@ -36,8 +39,6 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
||||||
+73
-18
@@ -10,7 +10,15 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.text;
|
package com.minres.scviewer.database.text;
|
||||||
|
|
||||||
|
import java.nio.charset.CharsetDecoder;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.zip.GZIPInputStream
|
||||||
|
|
||||||
|
import org.codehaus.groovy.ast.stmt.CatchStatement
|
||||||
|
import org.mapdb.DB
|
||||||
|
import org.mapdb.DBMaker
|
||||||
|
|
||||||
|
import groovy.io.FileType
|
||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType
|
import com.minres.scviewer.database.AssociationType
|
||||||
import com.minres.scviewer.database.DataType
|
import com.minres.scviewer.database.DataType
|
||||||
@@ -26,10 +34,12 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
private Long maxTime;
|
private Long maxTime;
|
||||||
|
|
||||||
IWaveformDb db;
|
IWaveformDb db;
|
||||||
|
|
||||||
def streams = []
|
def streams = []
|
||||||
|
|
||||||
def relationTypes=[:]
|
def relationTypes=[:]
|
||||||
|
|
||||||
|
DB mapDb
|
||||||
|
|
||||||
public TextDbLoader() {
|
public TextDbLoader() {
|
||||||
}
|
}
|
||||||
@@ -56,18 +66,57 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
boolean load(IWaveformDb db, File file) throws Exception {
|
boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db
|
this.db=db
|
||||||
this.streams=[]
|
this.streams=[]
|
||||||
FileInputStream fis = new FileInputStream(file)
|
try {
|
||||||
byte[] buffer = new byte[x.size()]
|
def gzipped = isGzipped(file)
|
||||||
def readCnt = fis.read(buffer, 0, x.size())
|
if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){
|
||||||
fis.close()
|
def mapDbFile = File.createTempFile("."+file.name, "tmp", file.parentFile)
|
||||||
if(readCnt==x.size())
|
mapDbFile.delete()
|
||||||
for(int i=0; i<x.size(); i++)
|
mapDbFile.deleteOnExit()
|
||||||
if(buffer[i]!=x[i]) return false
|
this.mapDb = DBMaker
|
||||||
parseInput(file)
|
.fileDB(mapDbFile)
|
||||||
calculateConcurrencyIndicees()
|
.fileMmapEnableIfSupported()
|
||||||
|
.fileMmapPreclearDisable()
|
||||||
|
.cleanerHackEnable()
|
||||||
|
.allocateStartSize(64*1024*1024)
|
||||||
|
.allocateIncrement(64*1024*1024)
|
||||||
|
.make()
|
||||||
|
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||||
|
calculateConcurrencyIndicees()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} catch(EOFException e) {
|
||||||
|
return true;
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isTxfile(InputStream istream) {
|
||||||
|
byte[] buffer = new byte[x.size()]
|
||||||
|
def readCnt = istream.read(buffer, 0, x.size())
|
||||||
|
istream.close()
|
||||||
|
if(readCnt==x.size()){
|
||||||
|
for(int i=0; i<x.size(); i++)
|
||||||
|
if(buffer[i]!=x[i]) return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isGzipped(File f) {
|
||||||
|
InputStream is = null;
|
||||||
|
try {
|
||||||
|
is = new FileInputStream(f);
|
||||||
|
byte [] signature = new byte[2];
|
||||||
|
int nread = is.read( signature ); //read the gzip signature
|
||||||
|
return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
is.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private stringToScale(String scale){
|
private stringToScale(String scale){
|
||||||
switch(scale.trim()){
|
switch(scale.trim()){
|
||||||
case "fs":return 1L
|
case "fs":return 1L
|
||||||
@@ -78,7 +127,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
case "s": return 1000000000000000L
|
case "s": return 1000000000000000L
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private def parseInput(File input){
|
private def parseInput(InputStream inputStream){
|
||||||
def streamsById = [:]
|
def streamsById = [:]
|
||||||
def generatorsById = [:]
|
def generatorsById = [:]
|
||||||
def transactionsById = [:]
|
def transactionsById = [:]
|
||||||
@@ -86,7 +135,9 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
Tx transaction
|
Tx transaction
|
||||||
boolean endTransaction=false
|
boolean endTransaction=false
|
||||||
def matcher
|
def matcher
|
||||||
input.eachLine { line ->
|
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
|
||||||
|
long lineCnt=0;
|
||||||
|
reader.eachLine { line ->
|
||||||
def tokens = line.split(/\s+/)
|
def tokens = line.split(/\s+/)
|
||||||
switch(tokens[0]){
|
switch(tokens[0]){
|
||||||
case "scv_tr_stream":
|
case "scv_tr_stream":
|
||||||
@@ -95,7 +146,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
case "end_attribute":
|
case "end_attribute":
|
||||||
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
||||||
def id = Integer.parseInt(matcher[0][1])
|
def id = Integer.parseInt(matcher[0][1])
|
||||||
def stream = new TxStream(db, id, matcher[0][2], matcher[0][3])
|
def stream = new TxStream(this, id, matcher[0][2], matcher[0][3])
|
||||||
streams<<stream
|
streams<<stream
|
||||||
streamsById[id]=stream
|
streamsById[id]=stream
|
||||||
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
||||||
@@ -138,9 +189,11 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
break
|
break
|
||||||
case "a"://matcher = line =~ /^a\s+(.+)$/
|
case "a"://matcher = line =~ /^a\s+(.+)$/
|
||||||
if(endTransaction){
|
if(endTransaction){
|
||||||
transaction.attributes << new TxAttribute(transaction.generator.end_attrs[0], tokens[1])
|
transaction.attributes << new TxAttribute(transaction.generator.end_attrs[transaction.generator.end_attrs_idx], tokens[1])
|
||||||
|
transaction.generator.end_attrs_idx++
|
||||||
} else {
|
} else {
|
||||||
transaction.attributes << new TxAttribute(transaction.generator.begin_attrs[0], tokens[1])
|
transaction.attributes << new TxAttribute(transaction.generator.begin_attrs[transaction.generator.begin_attrs_idx], tokens[1])
|
||||||
|
transaction.generator.begin_attrs_idx++
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
|
case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
|
||||||
@@ -156,16 +209,18 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
println "Don't know what to do with: '$line'"
|
println "Don't know what to do with: '$line'"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
lineCnt++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def calculateConcurrencyIndicees(){
|
private def calculateConcurrencyIndicees(){
|
||||||
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Collection<RelationType> getAllRelationTypes(){
|
public Collection<RelationType> getAllRelationTypes(){
|
||||||
return relationTypes.values();
|
return relationTypes.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -17,7 +17,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
import com.google.common.collect.TreeMultimap
|
import org.mapdb.Serializer
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb
|
import com.minres.scviewer.database.IWaveformDb
|
||||||
@@ -44,14 +45,15 @@ class TxStream extends HierNode implements ITxStream {
|
|||||||
|
|
||||||
private TreeMap<Long, List<ITxEvent>> events
|
private TreeMap<Long, List<ITxEvent>> events
|
||||||
|
|
||||||
TxStream(IWaveformDb db, int id, String name, String kind){
|
TxStream(TextDbLoader loader, int id, String name, String kind){
|
||||||
super(name)
|
super(name)
|
||||||
this.id=id
|
this.id=id
|
||||||
this.database=db
|
this.database=loader.db
|
||||||
this.fullName=name
|
this.fullName=name
|
||||||
this.kind=kind
|
this.kind=kind
|
||||||
this.maxConcurrency=0
|
this.maxConcurrency=0
|
||||||
events = new TreeMap<Long, List<ITxEvent>>()
|
//events = new TreeMap<Long, List<ITxEvent>>()
|
||||||
|
events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ITxGenerator> getGenerators(){
|
List<ITxGenerator> getGenerators(){
|
||||||
@@ -110,7 +112,7 @@ class TxStream extends HierNode implements ITxStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
|
public Boolean equals(IWaveform other) {
|
||||||
return(other instanceof TxStream && this.getId()==other.getId());
|
return(other instanceof TxStream && this.getId()==other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,7 +1,101 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||||
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SWT widget
|
Bundle-Name: SWT widget
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
com.google.guava;bundle-version="15.0.0",
|
com.google.guava;bundle-version="15.0.0",
|
||||||
@@ -17,3 +17,4 @@ Export-Package: com.minres.scviewer.database.swt
|
|||||||
Bundle-ClassPath: .
|
Bundle-ClassPath: .
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin
|
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.ui.swt
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.minres.scviewer.database.swt;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
||||||
|
|
||||||
|
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||||
|
|
||||||
|
}
|
||||||
+7
-6
@@ -10,6 +10,8 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.swt.internal;
|
package com.minres.scviewer.database.swt.internal;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
@@ -22,6 +24,8 @@ public class RulerPainter implements IPainter {
|
|||||||
static final int rulerTickMinorC = 10;
|
static final int rulerTickMinorC = 10;
|
||||||
static final int rulerTickMajorC = 100;
|
static final int rulerTickMajorC = 100;
|
||||||
|
|
||||||
|
static final DecimalFormat df = new DecimalFormat("#.00####");
|
||||||
|
|
||||||
public RulerPainter(WaveformCanvas waveCanvas) {
|
public RulerPainter(WaveformCanvas waveCanvas) {
|
||||||
this.waveCanvas=waveCanvas;
|
this.waveCanvas=waveCanvas;
|
||||||
}
|
}
|
||||||
@@ -37,16 +41,13 @@ public class RulerPainter implements IPainter {
|
|||||||
String unit=waveCanvas.getUnitStr();
|
String unit=waveCanvas.getUnitStr();
|
||||||
int unitMultiplier=waveCanvas.getUnitMultiplier();
|
int unitMultiplier=waveCanvas.getUnitMultiplier();
|
||||||
long scaleFactor=waveCanvas.getScaleFactor();
|
long scaleFactor=waveCanvas.getScaleFactor();
|
||||||
long zoomLevel = waveCanvas.getZoomLevel();
|
// long zoomLevel = waveCanvas.getZoomLevel();
|
||||||
long start=area.x*scaleFactor;
|
long start=area.x*scaleFactor;
|
||||||
long end=start+area.width*scaleFactor;
|
long end=start+area.width*scaleFactor;
|
||||||
|
|
||||||
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
||||||
long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
||||||
if(zoomLevel%3==1){
|
|
||||||
rulerTickMinor/=3;
|
|
||||||
rulerTickMajor/=3;
|
|
||||||
}
|
|
||||||
int minorTickY = waveCanvas.rulerHeight-5;
|
int minorTickY = waveCanvas.rulerHeight-5;
|
||||||
int majorTickY = waveCanvas.rulerHeight-15;
|
int majorTickY = waveCanvas.rulerHeight-15;
|
||||||
int textY=waveCanvas.rulerHeight-20;
|
int textY=waveCanvas.rulerHeight-20;
|
||||||
@@ -67,7 +68,7 @@ public class RulerPainter implements IPainter {
|
|||||||
for (long tick = startMinorIncr; tick < end; tick += rulerTickMinor) {
|
for (long tick = startMinorIncr; tick < end; tick += rulerTickMinor) {
|
||||||
int x0 = (int) (tick/scaleFactor);
|
int x0 = (int) (tick/scaleFactor);
|
||||||
if ((tick % rulerTickMajor) == 0) {
|
if ((tick % rulerTickMajor) == 0) {
|
||||||
gc.drawText(Double.toString(tick/scaleFactor*unitMultiplier)+unit, x0, area.y+textY);
|
gc.drawText(df.format(tick/scaleFactor*unitMultiplier)+unit, x0, area.y+textY);
|
||||||
gc.drawLine(x0, area.y+majorTickY, x0,area.y+ bottom);
|
gc.drawLine(x0, area.y+majorTickY, x0,area.y+ bottom);
|
||||||
} else {
|
} else {
|
||||||
gc.drawLine(x0, area.y+minorTickY, x0, area.y+bottom);
|
gc.drawLine(x0, area.y+minorTickY, x0, area.y+bottom);
|
||||||
|
|||||||
+365
-90
@@ -10,136 +10,411 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.swt.internal;
|
package com.minres.scviewer.database.swt.internal;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
import org.eclipse.swt.graphics.FontData;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class SignalPainter extends TrackPainter {
|
public class SignalPainter extends TrackPainter {
|
||||||
|
private class SignalChange {
|
||||||
|
long time;
|
||||||
|
Object value;
|
||||||
|
boolean fromMap;
|
||||||
|
|
||||||
|
public SignalChange(Entry<Long, ?> entry) {
|
||||||
|
time = entry.getKey();
|
||||||
|
value = entry.getValue();
|
||||||
|
fromMap = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(Entry<Long, ?> entry, Long actTime) {
|
||||||
|
if (entry != null) {
|
||||||
|
time = entry.getKey();
|
||||||
|
value = entry.getValue();
|
||||||
|
fromMap = true;
|
||||||
|
} else {
|
||||||
|
time = actTime;
|
||||||
|
fromMap = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assign(SignalChange other) {
|
||||||
|
time = other.time;
|
||||||
|
value = other.value;
|
||||||
|
fromMap = other.fromMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
private static final JPanel DUMMY_PANEL = new JPanel();
|
||||||
|
|
||||||
private final WaveformCanvas waveCanvas;
|
private final WaveformCanvas waveCanvas;
|
||||||
private ISignal<? extends ISignalChange> signal;
|
|
||||||
|
int yOffsetT;
|
||||||
|
int yOffsetM;
|
||||||
|
int yOffsetB;
|
||||||
|
int maxX;
|
||||||
|
|
||||||
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||||
super(trackEntry, even);
|
super(trackEntry, even);
|
||||||
this.waveCanvas = txDisplay;
|
this.waveCanvas = txDisplay;
|
||||||
this.signal=trackEntry.getSignal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
private int getXEnd(long time) {
|
||||||
if(trackEntry.selected)
|
long ltmp = time / this.waveCanvas.getScaleFactor();
|
||||||
|
return ltmp > maxX ? maxX : (int) ltmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
|
ISignal<?> signal = trackEntry.getSignal();
|
||||||
|
if (trackEntry.selected)
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[even ? WaveformColors.TRACK_BG_EVEN.ordinal() : WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.fillRectangle(area);
|
gc.fillRectangle(area);
|
||||||
Entry<Long, ? extends ISignalChange> firstChange=signal.getEvents().floorEntry(area.x*this.waveCanvas.getScaleFactor());
|
long beginTime = area.x * this.waveCanvas.getScaleFactor();
|
||||||
Entry<Long, ? extends ISignalChange> lastTx=signal.getEvents().ceilingEntry((area.x+area.width)*this.waveCanvas.getScaleFactor());
|
long endTime = (area.x + area.width) * this.waveCanvas.getScaleFactor();
|
||||||
if(firstChange==null){
|
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
||||||
if(lastTx==null) return;
|
Entry<Long, ?> last = signal.getEvents().floorEntry(endTime);
|
||||||
firstChange = signal.getEvents().firstEntry();
|
if (first == null) {
|
||||||
} else if(lastTx==null){
|
if (last == null)
|
||||||
lastTx=signal.getEvents().lastEntry();
|
return;
|
||||||
|
first = signal.getEvents().firstEntry();
|
||||||
|
} else if (last == null) {
|
||||||
|
last = signal.getEvents().lastEntry();
|
||||||
}
|
}
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||||
gc.setLineStyle(SWT.LINE_SOLID);
|
gc.setLineStyle(SWT.LINE_SOLID);
|
||||||
gc.setLineWidth(1);
|
gc.setLineWidth(1);
|
||||||
Entry<Long, ? extends ISignalChange> left=firstChange;
|
NavigableMap<Long, ?> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
||||||
if(left.getValue() instanceof ISignalChangeSingle){
|
SignalChange left = new SignalChange(first);
|
||||||
NavigableMap<Long, ? extends ISignalChange> entries=signal.getEvents().subMap(firstChange.getKey(), false, lastTx.getKey(), true);
|
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||||
for(Entry<Long, ? extends ISignalChange> right:entries.entrySet()){
|
maxX = area.x + area.width;
|
||||||
int xEnd= (int)(right.getKey()/this.waveCanvas.getScaleFactor());
|
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||||
int xBegin= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
|
yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
|
||||||
if(xEnd>xBegin){
|
yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||||
int yOffset = this.waveCanvas.getTrackHeight()/2;
|
int xBegin = Math.max(area.x, (int) (left.time / this.waveCanvas.getScaleFactor()));
|
||||||
Color color = this.waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
int xEnd = Math.max(area.x, getXEnd(right.time));
|
||||||
switch(((ISignalChangeSingle) left.getValue()).getValue()){
|
boolean multiple = false;
|
||||||
case '1':
|
if (xEnd == xBegin) {
|
||||||
color=this.waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
// this can trigger if
|
||||||
yOffset = this.waveCanvas.getTrackHeight()/5;
|
// a) left == right
|
||||||
break;
|
// b) left to close to right
|
||||||
case '0':
|
if (left.time == right.time) {
|
||||||
color=this.waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
right.time = endTime;
|
||||||
yOffset = 4*this.waveCanvas.getTrackHeight()/5;
|
} else {
|
||||||
break;
|
multiple = true;
|
||||||
case 'Z':
|
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
|
||||||
color=this.waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
|
right.set(entries.floorEntry(eTime), endTime);
|
||||||
break;
|
right.time = eTime;
|
||||||
default:
|
|
||||||
}
|
|
||||||
yOffset+=area.y;
|
|
||||||
gc.setForeground(color);
|
|
||||||
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
|
||||||
int yNext = this.waveCanvas.getTrackHeight()/2;
|
|
||||||
switch(((ISignalChangeSingle) right.getValue()).getValue()){
|
|
||||||
case '1':
|
|
||||||
yNext = this.waveCanvas.getTrackHeight()/5+area.y;
|
|
||||||
break;
|
|
||||||
case '0':
|
|
||||||
yNext = 4*this.waveCanvas.getTrackHeight()/5+area.y;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
gc.drawLine(xEnd, yOffset, xEnd, yNext);
|
|
||||||
}
|
|
||||||
left=right;
|
|
||||||
}
|
}
|
||||||
} else if(left.getValue() instanceof ISignalChangeMulti){
|
xEnd = getXEnd(right.time);
|
||||||
NavigableMap<Long,? extends ISignalChange> entries=signal.getEvents().subMap(firstChange.getKey(), false, lastTx.getKey(), true);
|
}
|
||||||
for(Entry<Long, ? extends ISignalChange> right:entries.entrySet()){
|
|
||||||
int yOffsetT = this.waveCanvas.getTrackHeight()/5+area.y;
|
SignalStencil stencil = getStencil(gc, left, entries);
|
||||||
int yOffsetM = this.waveCanvas.getTrackHeight()/2+area.y;
|
do {
|
||||||
int yOffsetB = 4*this.waveCanvas.getTrackHeight()/5+area.y;
|
stencil.draw(gc, area, left.value, right.value, xBegin, xEnd, multiple);
|
||||||
Color colorBorder = this.waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
if (right.time >= endTime)
|
||||||
ISignalChangeMulti last = (ISignalChangeMulti) left.getValue();
|
break;
|
||||||
if(last.getValue().toString().contains("X")){
|
left.assign(right);
|
||||||
colorBorder=this.waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
xBegin = xEnd;
|
||||||
}else if(last.getValue().toString().contains("Z")){
|
right.set(entries.higherEntry(left.time), endTime);
|
||||||
colorBorder=this.waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
|
xEnd = getXEnd(right.time);
|
||||||
}
|
multiple = false;
|
||||||
int beginTime= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
|
if (xEnd == xBegin) {
|
||||||
int endTime= (int)(right.getKey()/this.waveCanvas.getScaleFactor());
|
multiple = true;
|
||||||
int[] points = {
|
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
|
||||||
beginTime,yOffsetM,
|
Entry<Long, ?> entry = entries.floorEntry(eTime);
|
||||||
beginTime+1,yOffsetT,
|
if(entry!=null && entry.getKey()> right.time)
|
||||||
endTime-1,yOffsetT,
|
right.set(entry, endTime);
|
||||||
endTime,yOffsetM,
|
xEnd = getXEnd(eTime);
|
||||||
endTime-1,yOffsetB,
|
}
|
||||||
beginTime+1,yOffsetB
|
} while (left.time < endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ?> entries) {
|
||||||
|
Object val = left.value;
|
||||||
|
if(val instanceof BitVector) {
|
||||||
|
BitVector bv = (BitVector) val;
|
||||||
|
if(bv.getWidth()==1)
|
||||||
|
return new SingleBitStencil();
|
||||||
|
if(trackEntry.waveDisplay==TrackEntry.WaveDisplay.DEFAULT)
|
||||||
|
return new MultiBitStencil(gc);
|
||||||
|
else
|
||||||
|
return new MultiBitStencilAnalog(entries, left.value,
|
||||||
|
trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
|
||||||
|
trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
|
||||||
|
} else if (val instanceof Double)
|
||||||
|
return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface SignalStencil {
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MultiBitStencil implements SignalStencil {
|
||||||
|
|
||||||
|
private java.awt.Font tmpAwtFont;
|
||||||
|
private int height;
|
||||||
|
|
||||||
|
public MultiBitStencil(GC gc) {
|
||||||
|
FontData fd = gc.getFont().getFontData()[0];
|
||||||
|
height = gc.getDevice().getDPI().y * fd.getHeight() / 72;
|
||||||
|
tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
|
BitVector last = (BitVector) left;
|
||||||
|
if (last.getValue().toString().contains("X")) {
|
||||||
|
colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
|
} else if (last.getValue().toString().contains("Z")) {
|
||||||
|
colorBorder = waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
|
||||||
|
}
|
||||||
|
int width = xEnd - xBegin;
|
||||||
|
if (width > 1) {
|
||||||
|
int[] points = {
|
||||||
|
xBegin, yOffsetM,
|
||||||
|
xBegin + 1, yOffsetT,
|
||||||
|
xEnd - 1, yOffsetT,
|
||||||
|
xEnd, yOffsetM,
|
||||||
|
xEnd - 1, yOffsetB,
|
||||||
|
xBegin + 1, yOffsetB
|
||||||
};
|
};
|
||||||
gc.setForeground(colorBorder);
|
gc.setForeground(colorBorder);
|
||||||
gc.drawPolygon(points);
|
gc.drawPolygon(points);
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
||||||
int size = gc.getDevice().getDPI().y * gc.getFont().getFontData()[0].getHeight()/72;
|
//TODO: this code should be provided from a central location
|
||||||
if(beginTime<area.x) beginTime=area.x;
|
String label = null;
|
||||||
int width=endTime-beginTime;
|
switch(trackEntry.valueDisplay) {
|
||||||
if(width>6) {
|
case SIGNED:
|
||||||
|
label=Long.toString(last.toSignedValue());
|
||||||
|
break;
|
||||||
|
case UNSIGNED:
|
||||||
|
label=Long.toString(last.toUnsignedValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
label="h'"+last.toHexString();
|
||||||
|
}
|
||||||
|
Point bb = getBoxWidth(gc, label);
|
||||||
|
if (xBegin < area.x) {
|
||||||
|
xBegin = area.x;
|
||||||
|
width = xEnd - xBegin;
|
||||||
|
}
|
||||||
|
if (width > (bb.x+1)) {
|
||||||
Rectangle old = gc.getClipping();
|
Rectangle old = gc.getClipping();
|
||||||
gc.setClipping(beginTime+3, yOffsetT, endTime-beginTime-5, yOffsetB-yOffsetT);
|
gc.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT);
|
||||||
gc.drawText("h'"+last.getValue().toHexString(), beginTime+3, yOffsetM-size/2-1);
|
gc.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1);
|
||||||
gc.setClipping(old);
|
gc.setClipping(old);
|
||||||
}
|
}
|
||||||
left=right;
|
} else {
|
||||||
|
gc.setForeground(colorBorder);
|
||||||
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Point getBoxWidth(GC gc, String label) {
|
||||||
|
return new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MultiBitStencilAnalog implements SignalStencil {
|
||||||
|
|
||||||
|
final boolean continous;
|
||||||
|
private long minVal;
|
||||||
|
private long range;
|
||||||
|
|
||||||
|
public MultiBitStencilAnalog(NavigableMap<Long, ?> entries, Object left, boolean continous, boolean signed) {
|
||||||
|
this.continous=continous;
|
||||||
|
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
||||||
|
minVal=((BitVector) left).toUnsignedValue();
|
||||||
|
range=2;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
long maxVal=minVal;
|
||||||
|
for (Object e : entries.values()) {
|
||||||
|
long v = ((BitVector)e).toUnsignedValue();
|
||||||
|
maxVal=Math.max(maxVal, v);
|
||||||
|
minVal=Math.min(minVal, v);
|
||||||
|
}
|
||||||
|
if(maxVal==minVal) {
|
||||||
|
maxVal--;
|
||||||
|
minVal++;
|
||||||
|
}
|
||||||
|
range = maxVal-minVal;
|
||||||
|
} else
|
||||||
|
minVal--;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
long leftVal = ((BitVector) left).toUnsignedValue();
|
||||||
|
long rightVal= ((BitVector) right).toUnsignedValue();
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
int yOffsetRight = (int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
if(continous) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||||
|
if(yOffsetRight!=yOffsetLeft) {
|
||||||
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SingleBitStencil implements SignalStencil {
|
||||||
public ISignal<? extends ISignalChange> getSignal() {
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
return signal;
|
if (multiple) {
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||||
|
gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||||
|
if(xEnd>xBegin)
|
||||||
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
|
} else {
|
||||||
|
Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
|
int yOffset = yOffsetM;
|
||||||
|
switch (((BitVector) left).getValue()[0]) {
|
||||||
|
case '1':
|
||||||
|
color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
||||||
|
yOffset = yOffsetT;
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
color = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
|
yOffset = yOffsetB;
|
||||||
|
break;
|
||||||
|
case 'Z':
|
||||||
|
color = waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
gc.setForeground(color);
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffset, maxX, yOffset);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
||||||
|
int yNext = yOffsetM;
|
||||||
|
switch (((BitVector) right).getValue()[0]) {
|
||||||
|
case '1':
|
||||||
|
yNext = yOffsetT;
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
yNext = yOffsetB;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
if (yOffset != yNext)
|
||||||
|
gc.drawLine(xEnd, yOffset, xEnd, yNext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
private class RealStencil implements SignalStencil {
|
||||||
|
|
||||||
|
double minVal, range;
|
||||||
|
|
||||||
|
final double scaleFactor = 1.05;
|
||||||
|
|
||||||
|
boolean continous=true;
|
||||||
|
|
||||||
|
public RealStencil(NavigableMap<Long, ?> entries, Object left, boolean continous) {
|
||||||
|
this.continous=continous;
|
||||||
|
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
||||||
|
minVal=(Double) left;
|
||||||
|
range=2.0;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
double maxVal=minVal;
|
||||||
|
for (Object e : entries.values()) {
|
||||||
|
double v = ((Double)e);
|
||||||
|
if(Double.isNaN(maxVal))
|
||||||
|
maxVal=v;
|
||||||
|
else if(!Double.isNaN(v))
|
||||||
|
maxVal=Math.max(maxVal, v);
|
||||||
|
if(Double.isNaN(minVal))
|
||||||
|
minVal=v;
|
||||||
|
else if(!Double.isNaN(v))
|
||||||
|
minVal=Math.min(minVal, v);
|
||||||
|
}
|
||||||
|
if(Double.isNaN(maxVal)){
|
||||||
|
maxVal=minVal=0.0;
|
||||||
|
}
|
||||||
|
range = (maxVal-minVal)*scaleFactor;
|
||||||
|
double avg = (maxVal+minVal)/2.0;
|
||||||
|
minVal=avg-(avg-minVal)*scaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
double leftVal = (Double) left;
|
||||||
|
double rightVal= (Double) right;
|
||||||
|
if(Double.isNaN(leftVal)) {
|
||||||
|
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
||||||
|
int width = xEnd - xBegin;
|
||||||
|
if (width > 1) {
|
||||||
|
int[] points = {
|
||||||
|
xBegin, yOffsetT,
|
||||||
|
xEnd, yOffsetT,
|
||||||
|
xEnd, yOffsetB,
|
||||||
|
xBegin, yOffsetB
|
||||||
|
};
|
||||||
|
gc.setForeground(color);
|
||||||
|
gc.drawPolygon(points);
|
||||||
|
gc.setBackground(color);
|
||||||
|
gc.fillPolygon(points);
|
||||||
|
} else {
|
||||||
|
gc.setForeground(color);
|
||||||
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
if(continous) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||||
|
if(yOffsetRight!=yOffsetLeft) {
|
||||||
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
+11
@@ -110,6 +110,17 @@ public class StreamPainter extends TrackPainter{
|
|||||||
gc.fillRectangle(bb);
|
gc.fillRectangle(bb);
|
||||||
gc.drawRectangle(bb);
|
gc.drawRectangle(bb);
|
||||||
} else {
|
} else {
|
||||||
|
// adjusting drawing width to circumvent issues in canvas algos
|
||||||
|
if(bb.x < area.x) {
|
||||||
|
bb.width = bb.width-(area.x-bb.x)+5;
|
||||||
|
bb.x=area.x-5;
|
||||||
|
}
|
||||||
|
int bb_x2 = bb.x+bb.width;
|
||||||
|
int area_x2 = area.x+area.width;
|
||||||
|
if(bb_x2>area_x2){
|
||||||
|
bb_x2=area_x2+5;
|
||||||
|
bb.width= bb_x2-bb.x;
|
||||||
|
}
|
||||||
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||||
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||||
}
|
}
|
||||||
|
|||||||
+93
-51
@@ -39,9 +39,10 @@ import org.eclipse.wb.swt.SWTResourceManager;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class WaveformCanvas extends Canvas {
|
public class WaveformCanvas extends Canvas {
|
||||||
@@ -55,11 +56,7 @@ public class WaveformCanvas extends Canvas {
|
|||||||
String unit="ns";
|
String unit="ns";
|
||||||
|
|
||||||
private int level = 12;
|
private int level = 12;
|
||||||
|
|
||||||
public final static String[] unitString={"fs", "ps", "ns", "µs", "ms"};//, "s"};
|
|
||||||
|
|
||||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
|
||||||
|
|
||||||
private long maxTime;
|
private long maxTime;
|
||||||
|
|
||||||
protected Point origin; /* original size */
|
protected Point origin; /* original size */
|
||||||
@@ -82,7 +79,7 @@ public class WaveformCanvas extends Canvas {
|
|||||||
|
|
||||||
private List<CursorPainter> cursorPainters;
|
private List<CursorPainter> cursorPainters;
|
||||||
|
|
||||||
HashMap<IWaveform<?>, IWaveformPainter> wave2painterMap;
|
HashMap<IWaveform, IWaveformPainter> wave2painterMap;
|
||||||
/**
|
/**
|
||||||
* Constructor for ScrollableCanvas.
|
* Constructor for ScrollableCanvas.
|
||||||
*
|
*
|
||||||
@@ -126,6 +123,31 @@ public class WaveformCanvas extends Canvas {
|
|||||||
painterList.add(marker);
|
painterList.add(marker);
|
||||||
cursorPainters.add(marker);
|
cursorPainters.add(marker);
|
||||||
wave2painterMap=new HashMap<>();
|
wave2painterMap=new HashMap<>();
|
||||||
|
// fall back initialization
|
||||||
|
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||||
|
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||||
|
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
||||||
|
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
||||||
|
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
|
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||||
|
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||||
|
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||||
|
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCursoPainter(CursorPainter cursorPainter){
|
public void addCursoPainter(CursorPainter cursorPainter){
|
||||||
@@ -137,32 +159,10 @@ public class WaveformCanvas extends Canvas {
|
|||||||
Display d = getDisplay();
|
Display d = getDisplay();
|
||||||
if (colourMap != null) {
|
if (colourMap != null) {
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
if (colourMap.containsKey(c)) {
|
if (colourMap.containsKey(c))
|
||||||
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
redraw();
|
redraw();
|
||||||
} else {
|
|
||||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
|
||||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
|
||||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
|
||||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
|
||||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
|
||||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
|
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
|
||||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
|
||||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +178,9 @@ public class WaveformCanvas extends Canvas {
|
|||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return getClientArea().width;
|
||||||
|
}
|
||||||
public void setOrigin(Point origin) {
|
public void setOrigin(Point origin) {
|
||||||
setOrigin(origin.x, origin.y);
|
setOrigin(origin.x, origin.y);
|
||||||
}
|
}
|
||||||
@@ -218,12 +221,12 @@ public class WaveformCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxZoomLevel(){
|
public int getMaxZoomLevel(){
|
||||||
return unitMultiplier.length*unitString.length-1;
|
return Constants.unitMultiplier.length*Constants.unitString.length-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoomLevel(int level) {
|
public void setZoomLevel(int level) {
|
||||||
long oldScaleFactor=scaleFactor;
|
long oldScaleFactor=scaleFactor;
|
||||||
if(level<unitMultiplier.length*unitString.length){
|
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||||
if(level%2==1) this.scaleFactor*=3;
|
if(level%2==1) this.scaleFactor*=3;
|
||||||
@@ -255,17 +258,17 @@ public class WaveformCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getScaleFactorPow10() {
|
public long getScaleFactorPow10() {
|
||||||
int scale = level/unitMultiplier.length;
|
int scale = level/Constants.unitMultiplier.length;
|
||||||
double res = Math.pow(1000, scale);
|
double res = Math.pow(1000, scale);
|
||||||
return (long) res;
|
return (long) res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnitStr(){
|
public String getUnitStr(){
|
||||||
return unitString[level/unitMultiplier.length];
|
return Constants.unitString[level/Constants.unitMultiplier.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUnitMultiplier(){
|
public int getUnitMultiplier(){
|
||||||
return unitMultiplier[level%unitMultiplier.length];
|
return Constants.unitMultiplier[level%Constants.unitMultiplier.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimeForOffset(int xOffset){
|
public long getTimeForOffset(int xOffset){
|
||||||
@@ -283,15 +286,23 @@ public class WaveformCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearAllWaveformPainter() {
|
public void clearAllWaveformPainter() {
|
||||||
|
clearAllWaveformPainter(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearAllWaveformPainter(boolean update) {
|
||||||
trackAreaPainter.getTrackVerticalOffset().clear();
|
trackAreaPainter.getTrackVerticalOffset().clear();
|
||||||
wave2painterMap.clear();
|
wave2painterMap.clear();
|
||||||
syncScrollBars();
|
if(update) syncScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWaveformPainter(IWaveformPainter painter) {
|
public void addWaveformPainter(IWaveformPainter painter) {
|
||||||
|
addWaveformPainter(painter, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addWaveformPainter(IWaveformPainter painter, boolean update) {
|
||||||
trackAreaPainter.addTrackPainter(painter);
|
trackAreaPainter.addTrackPainter(painter);
|
||||||
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
|
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
|
||||||
syncScrollBars();
|
if(update) syncScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CursorPainter> getCursorPainters() {
|
public List<CursorPainter> getCursorPainters() {
|
||||||
@@ -308,7 +319,7 @@ public class WaveformCanvas extends Canvas {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initalize the scrollbar and register listeners. */
|
/* Initialize the scrollbar and register listeners. */
|
||||||
private void initScrollBars() {
|
private void initScrollBars() {
|
||||||
ScrollBar horizontal = getHorizontalBar();
|
ScrollBar horizontal = getHorizontalBar();
|
||||||
horizontal.setEnabled(false);
|
horizontal.setEnabled(false);
|
||||||
@@ -342,38 +353,41 @@ public class WaveformCanvas extends Canvas {
|
|||||||
redraw();
|
redraw();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int height = trackAreaPainter.getHeight();
|
int height = trackAreaPainter.getHeight(); // incl. Ruler
|
||||||
int width = (int) (maxTime / scaleFactor);
|
int width = (int) (maxTime / scaleFactor);
|
||||||
|
Rectangle clientArea=getClientArea();
|
||||||
ScrollBar horizontal = getHorizontalBar();
|
ScrollBar horizontal = getHorizontalBar();
|
||||||
horizontal.setIncrement((int) (getClientArea().width / 100));
|
horizontal.setIncrement((int) (getClientArea().width / 100));
|
||||||
horizontal.setPageIncrement(getClientArea().width);
|
horizontal.setPageIncrement(getClientArea().width);
|
||||||
int cw = getClientArea().width;
|
int clientWidthw = clientArea.width;
|
||||||
if (width > cw) { /* image is wider than client area */
|
if (width > clientWidthw) { /* image is wider than client area */
|
||||||
|
horizontal.setMinimum(0);
|
||||||
horizontal.setMaximum(width);
|
horizontal.setMaximum(width);
|
||||||
horizontal.setEnabled(true);
|
horizontal.setEnabled(true);
|
||||||
if (((int) -origin.x) > horizontal.getMaximum() - cw)
|
if (((int) -origin.x) > horizontal.getMaximum() - clientWidthw)
|
||||||
origin.x = -horizontal.getMaximum() + cw;
|
origin.x = -horizontal.getMaximum() + clientWidthw;
|
||||||
} else { /* image is narrower than client area */
|
} else { /* image is narrower than client area */
|
||||||
horizontal.setEnabled(false);
|
horizontal.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
horizontal.setThumb(clientWidthw);
|
||||||
horizontal.setSelection(-origin.x);
|
horizontal.setSelection(-origin.x);
|
||||||
horizontal.setThumb(cw);
|
|
||||||
|
|
||||||
ScrollBar vertical = getVerticalBar();
|
ScrollBar vertical = getVerticalBar();
|
||||||
vertical.setIncrement((int) (getClientArea().height / 100));
|
vertical.setIncrement((int) (getClientArea().height / 100));
|
||||||
vertical.setPageIncrement((int) (getClientArea().height));
|
vertical.setPageIncrement((int) (getClientArea().height));
|
||||||
int ch = getClientArea().height;
|
int clientHeighth = clientArea.height;
|
||||||
if (height > ch) { /* image is higher than client area */
|
if (height > clientHeighth) { /* image is higher than client area */
|
||||||
|
vertical.setMinimum(0);
|
||||||
vertical.setMaximum(height);
|
vertical.setMaximum(height);
|
||||||
vertical.setEnabled(true);
|
vertical.setEnabled(true);
|
||||||
if (((int) -origin.y) > vertical.getMaximum() - ch)
|
if (((int) -origin.y) > vertical.getMaximum() - clientHeighth)
|
||||||
origin.y = -vertical.getMaximum() + ch;
|
origin.y = -vertical.getMaximum() + clientHeighth;
|
||||||
} else { /* image is less higher than client area */
|
} else { /* image is less higher than client area */
|
||||||
vertical.setMaximum((int) (ch));
|
vertical.setMaximum((int) (clientHeighth));
|
||||||
vertical.setEnabled(false);
|
vertical.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
vertical.setThumb(clientHeighth);
|
||||||
vertical.setSelection(-origin.y);
|
vertical.setSelection(-origin.y);
|
||||||
vertical.setThumb(ch);
|
|
||||||
redraw();
|
redraw();
|
||||||
fireSelectionEvent();
|
fireSelectionEvent();
|
||||||
|
|
||||||
@@ -423,7 +437,7 @@ public class WaveformCanvas extends Canvas {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> getEntriesAtPosition(IWaveform<? extends IWaveformEvent> iWaveform, int i) {
|
public List<Object> getEntriesAtPosition(IWaveform iWaveform, int i) {
|
||||||
LinkedList<Object> result=new LinkedList<>();
|
LinkedList<Object> result=new LinkedList<>();
|
||||||
int x = i - origin.x;
|
int x = i - origin.x;
|
||||||
for(IPainter p: wave2painterMap.values()){
|
for(IPainter p: wave2painterMap.values()){
|
||||||
@@ -466,6 +480,27 @@ public class WaveformCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reveal(IWaveform waveform) {
|
||||||
|
for (IWaveformPainter painter : wave2painterMap.values()) {
|
||||||
|
TrackEntry te = painter.getTrackEntry();
|
||||||
|
if(te.waveform == waveform) {
|
||||||
|
Point size = getSize();
|
||||||
|
//size.x -= getVerticalBar().getSize().x + 2;
|
||||||
|
size.y -=+rulerHeight;
|
||||||
|
ScrollBar sb = getHorizontalBar();
|
||||||
|
if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible()) // TODO: check on other platform than MacOSX
|
||||||
|
size.y-= getHorizontalBar().getSize().y;
|
||||||
|
int top = te.vOffset;
|
||||||
|
int bottom = top + trackHeight;
|
||||||
|
if (top < -origin.y) {
|
||||||
|
setOrigin(origin.x, -(top-trackHeight));
|
||||||
|
} else if (bottom > (size.y - origin.y)) {
|
||||||
|
setOrigin(origin.x, size.y - bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void reveal(long time) {
|
public void reveal(long time) {
|
||||||
int scaledTime = (int) (time / scaleFactor);
|
int scaledTime = (int) (time / scaleFactor);
|
||||||
Point size = getSize();
|
Point size = getSize();
|
||||||
@@ -510,4 +545,11 @@ public class WaveformCanvas extends Canvas {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long getMaxVisibleTime() {
|
||||||
|
return (getClientArea().width+origin.x)*scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
long getOriginTime() {
|
||||||
|
return origin.x * scaleFactor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+175
-113
@@ -13,6 +13,7 @@ package com.minres.scviewer.database.swt.internal;
|
|||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -66,20 +67,19 @@ import org.eclipse.swt.widgets.Label;
|
|||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.swt.widgets.ScrollBar;
|
import org.eclipse.swt.widgets.ScrollBar;
|
||||||
|
import org.eclipse.swt.widgets.Widget;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
import com.minres.scviewer.database.ui.ICursor;
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
@@ -88,10 +88,12 @@ import com.minres.scviewer.database.ui.WaveformColors;
|
|||||||
|
|
||||||
public class WaveformViewer implements IWaveformViewer {
|
public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private ListenerList selectionChangedListeners = new ListenerList();
|
private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>();
|
||||||
|
|
||||||
private PropertyChangeSupport pcs;
|
private PropertyChangeSupport pcs;
|
||||||
|
|
||||||
|
static final DecimalFormat df = new DecimalFormat("#.00####");
|
||||||
|
|
||||||
private ITx currentTxSelection;
|
private ITx currentTxSelection;
|
||||||
|
|
||||||
private TrackEntry currentWaveformSelection;
|
private TrackEntry currentWaveformSelection;
|
||||||
@@ -102,12 +104,14 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
private Control namePaneHeader;
|
private Control namePaneHeader;
|
||||||
|
|
||||||
private Canvas nameList;
|
final private Canvas nameList;
|
||||||
|
|
||||||
private Canvas valueList;
|
final private Canvas valueList;
|
||||||
|
|
||||||
WaveformCanvas waveformCanvas;
|
final WaveformCanvas waveformCanvas;
|
||||||
|
|
||||||
|
private boolean revealSelected=false;
|
||||||
|
|
||||||
private Composite top;
|
private Composite top;
|
||||||
|
|
||||||
protected ObservableList<TrackEntry> streams;
|
protected ObservableList<TrackEntry> streams;
|
||||||
@@ -118,19 +122,16 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
private TreeMap<Integer, TrackEntry> trackVerticalOffset;
|
private TreeMap<Integer, TrackEntry> trackVerticalOffset;
|
||||||
|
|
||||||
private HashMap<IWaveform<? extends IWaveformEvent>, String> actualValues;
|
|
||||||
|
|
||||||
private Font nameFont, nameFontB;
|
private Font nameFont, nameFontB;
|
||||||
|
|
||||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
if ((e.button == 1 || e.button == 3)) {
|
if (e.button == 1) {
|
||||||
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
setSelection(new StructuredSelection(entry.getValue()));
|
setSelection(new StructuredSelection(entry.getValue()));
|
||||||
}
|
} else if (e.button == 3) {
|
||||||
if (e.button == 3) {
|
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if(topMenu!=null) topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
@@ -144,12 +145,10 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
start=new Point(e.x, e.y);
|
start=new Point(e.x, e.y);
|
||||||
|
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
||||||
if (e.button == 1) {
|
if (e.button == 1) {
|
||||||
initialSelected = waveformCanvas.getClicked(start);
|
initialSelected = waveformCanvas.getClicked(start);
|
||||||
} else if (e.button == 3) {
|
} else if (e.button == 3) {
|
||||||
List<Object> hitted = waveformCanvas.getClicked(start);
|
|
||||||
if(hitted!=null && hitted.size()>0)
|
|
||||||
setSelection(new StructuredSelection(hitted));
|
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if(topMenu!=null) topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
@@ -157,29 +156,18 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
if (e.button == 1) {
|
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier
|
||||||
|
if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
||||||
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
||||||
// first set time
|
// first set cursor time
|
||||||
setCursorTime(snapOffsetToEvent(e));
|
setCursorTime(snapOffsetToEvent(e));
|
||||||
// then set selection and reveal
|
// then set selection and reveal
|
||||||
setSelection(new StructuredSelection(initialSelected));
|
setSelection(new StructuredSelection(initialSelected));
|
||||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
asyncUpdate(e.widget);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
waveformCanvas.redraw();
|
|
||||||
updateValueList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}else if (e.button == 2) {
|
}else if (e.button == 2 ||(e.button==1 && (e.stateMask&SWT.SHIFT)!=0)) {
|
||||||
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
||||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
asyncUpdate(e.widget);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
waveformCanvas.redraw();
|
|
||||||
updateValueList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,13 +213,12 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
||||||
trackVerticalHeight=0;
|
trackVerticalHeight=0;
|
||||||
actualValues = new HashMap<IWaveform<? extends IWaveformEvent>, String>();
|
|
||||||
|
|
||||||
nameFont = parent.getDisplay().getSystemFont();
|
nameFont = parent.getDisplay().getSystemFont();
|
||||||
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
||||||
|
|
||||||
streams = new ObservableList<>();
|
streams = new ObservableList<>();
|
||||||
streams.addPropertyChangeListener(this);
|
streams.addPropertyChangeListener("content", this);
|
||||||
|
|
||||||
top = new Composite(parent, SWT.NONE);
|
top = new Composite(parent, SWT.NONE);
|
||||||
top.setLayout(new FillLayout(SWT.HORIZONTAL));
|
top.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||||
@@ -273,9 +260,11 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
nameList.addListener(SWT.Paint, new Listener() {
|
nameList.addListener(SWT.Paint, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
GC gc = event.gc;
|
if(!trackVerticalOffset.isEmpty()) {
|
||||||
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
GC gc = event.gc;
|
||||||
paintNames(gc, rect);
|
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
||||||
|
paintNames(gc, rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
nameList.addMouseListener(nameValueMouseListener);
|
nameList.addMouseListener(nameValueMouseListener);
|
||||||
@@ -305,9 +294,11 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
valueList.addListener(SWT.Paint, new Listener() {
|
valueList.addListener(SWT.Paint, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
GC gc = event.gc;
|
if(!trackVerticalOffset.isEmpty()) {
|
||||||
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
GC gc = event.gc;
|
||||||
paintValues(gc, rect);
|
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
||||||
|
paintValues(gc, rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
valueList.addMouseListener(nameValueMouseListener);
|
valueList.addMouseListener(nameValueMouseListener);
|
||||||
@@ -315,7 +306,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
waveformCanvas.setMaxTime(1);
|
waveformCanvas.setMaxTime(1);
|
||||||
waveformCanvas.addMouseListener(waveformMouseListener);
|
waveformCanvas.addMouseListener(waveformMouseListener);
|
||||||
|
|
||||||
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int y = ((ScrollBar) e.widget).getSelection();
|
int y = ((ScrollBar) e.widget).getSelection();
|
||||||
@@ -377,23 +368,33 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent pce) {
|
public void propertyChange(PropertyChangeEvent pce) {
|
||||||
if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
|
if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
|
||||||
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
if(revealSelected) {
|
||||||
@Override
|
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
updateTracklist();
|
public void run() {
|
||||||
}
|
update();
|
||||||
});
|
waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||||
|
valueList.redraw();
|
||||||
|
nameList.redraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
revealSelected=false;
|
||||||
|
} else
|
||||||
|
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateTracklist() {
|
public void update() {
|
||||||
trackVerticalHeight = 0;
|
trackVerticalHeight = 0;
|
||||||
int nameMaxWidth = 0;
|
int nameMaxWidth = 0;
|
||||||
int previousHeight = trackVerticalOffset.size() == 0 ? 0 : trackVerticalOffset.lastKey();
|
|
||||||
IWaveformPainter painter = null;
|
IWaveformPainter painter = null;
|
||||||
trackVerticalOffset.clear();
|
trackVerticalOffset.clear();
|
||||||
actualValues.clear();
|
waveformCanvas.clearAllWaveformPainter(false);
|
||||||
waveformCanvas.clearAllWaveformPainter();
|
|
||||||
boolean even = true;
|
boolean even = true;
|
||||||
boolean clearSelection = true;
|
boolean clearSelection = true;
|
||||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||||
@@ -403,47 +404,39 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
streamEntry.vOffset=trackVerticalHeight;
|
streamEntry.vOffset=trackVerticalHeight;
|
||||||
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
||||||
if (streamEntry.isStream()) {
|
if (streamEntry.isStream()) {
|
||||||
|
streamEntry.currentValue="";
|
||||||
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
||||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||||
actualValues.put(streamEntry.waveform, "");
|
|
||||||
} else if (streamEntry.isSignal()) {
|
} else if (streamEntry.isSignal()) {
|
||||||
|
streamEntry.currentValue="---";
|
||||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||||
actualValues.put(streamEntry.waveform, "---");
|
|
||||||
}
|
}
|
||||||
waveformCanvas.addWaveformPainter(painter);
|
waveformCanvas.addWaveformPainter(painter, false);
|
||||||
trackVerticalOffset.put(trackVerticalHeight, streamEntry);
|
trackVerticalOffset.put(trackVerticalHeight, streamEntry);
|
||||||
tl.setText(streamEntry.waveform.getFullName());
|
tl.setText(streamEntry.waveform.getFullName());
|
||||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||||
trackVerticalHeight += streamEntry.height;
|
trackVerticalHeight += streamEntry.height;
|
||||||
even = !even;
|
even = !even;
|
||||||
}
|
}
|
||||||
|
waveformCanvas.syncScrollBars();
|
||||||
nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
|
nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
|
||||||
nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
|
nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
|
||||||
valueList.setSize(calculateValueWidth(), trackVerticalHeight);
|
|
||||||
valueListScrolled.setMinSize(calculateValueWidth(), trackVerticalHeight);
|
|
||||||
nameList.redraw();
|
nameList.redraw();
|
||||||
updateValueList();
|
updateValueList();
|
||||||
waveformCanvas.redraw();
|
waveformCanvas.redraw();
|
||||||
top.layout(new Control[] { valueList, nameList, waveformCanvas });
|
top.layout(new Control[] { valueList, nameList, waveformCanvas });
|
||||||
if (trackVerticalOffset.isEmpty()){
|
if (trackVerticalOffset.isEmpty()){
|
||||||
waveformCanvas.setOrigin(0, 0);
|
waveformCanvas.setOrigin(0, 0);
|
||||||
}else if(previousHeight > trackVerticalOffset.lastKey()){
|
|
||||||
Point o = waveformCanvas.getOrigin();
|
|
||||||
waveformCanvas.setOrigin(o.x, o.y - (previousHeight - trackVerticalOffset.lastKey()));
|
|
||||||
}
|
}
|
||||||
if(clearSelection) setSelection(new StructuredSelection());
|
if(clearSelection) setSelection(new StructuredSelection());
|
||||||
/* System.out.println("updateTracklist() state:");
|
}
|
||||||
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry: trackVerticalOffset.entrySet()){
|
|
||||||
System.out.println(" "+entry.getKey()+": " +entry.getValue().getFullName());
|
|
||||||
}
|
|
||||||
*/ }
|
|
||||||
|
|
||||||
private int calculateValueWidth() {
|
private int calculateValueWidth() {
|
||||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||||
tl.setFont(nameFontB);
|
tl.setFont(nameFontB);
|
||||||
int valueMaxWidth = 0;
|
int valueMaxWidth = 0;
|
||||||
for (String v : actualValues.values()) {
|
for (TrackEntry v : streams) {
|
||||||
tl.setText(v);
|
tl.setText(v.currentValue);
|
||||||
valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width);
|
valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width);
|
||||||
}
|
}
|
||||||
return valueMaxWidth + 15;
|
return valueMaxWidth + 15;
|
||||||
@@ -451,16 +444,36 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
|
|
||||||
private void updateValueList(){
|
private void updateValueList(){
|
||||||
final Long time = getCursorTime();
|
final Long time = getCursorTime();
|
||||||
for(Entry<IWaveform<? extends IWaveformEvent>, String> entry:actualValues.entrySet()){
|
for(TrackEntry entry:streams){
|
||||||
if(entry.getKey() instanceof ISignal){
|
if(entry.isSignal()){
|
||||||
ISignalChange event = ((ISignal<?>)entry.getKey()).getWaveformEventsBeforeTime(time);
|
ISignal<?> signal = (ISignal<?>) entry.waveform;
|
||||||
if(event instanceof ISignalChangeSingle){
|
Object value = signal.getWaveformValueBeforeTime(time);
|
||||||
entry.setValue("b'"+((ISignalChangeSingle)event).getValue());
|
if(value instanceof BitVector){
|
||||||
} else if(event instanceof ISignalChangeMulti){
|
BitVector bv = (BitVector) value;
|
||||||
entry.setValue("h'"+((ISignalChangeMulti)event).getValue().toHexString());
|
if(bv.getWidth()==1)
|
||||||
|
entry.currentValue="b'"+bv;
|
||||||
|
else {
|
||||||
|
// TODO: same code resides in SignalPainter, fix it
|
||||||
|
switch(entry.valueDisplay) {
|
||||||
|
case SIGNED:
|
||||||
|
entry.currentValue=Long.toString(bv.toSignedValue());
|
||||||
|
break;
|
||||||
|
case UNSIGNED:
|
||||||
|
entry.currentValue=Long.toString(bv.toUnsignedValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
entry.currentValue="h'"+bv.toHexString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(value instanceof Double){
|
||||||
|
Double val = (Double) value;
|
||||||
|
if(val>0.001)
|
||||||
|
entry.currentValue=String.format("%1$,.3f", val);
|
||||||
|
else
|
||||||
|
entry.currentValue=Double.toString(val);
|
||||||
}
|
}
|
||||||
} else if(entry.getKey() instanceof ITxStream<?>){
|
} else if(entry.isStream()){
|
||||||
ITxStream<?> stream = (ITxStream<?>) entry.getKey();
|
ITxStream<?> stream = (ITxStream<?>) entry.waveform;
|
||||||
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
||||||
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
||||||
if(firstTx!=null){
|
if(firstTx!=null){
|
||||||
@@ -474,19 +487,20 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
}
|
}
|
||||||
firstTx=stream.getEvents().lowerEntry(firstTx.getKey());
|
firstTx=stream.getEvents().lowerEntry(firstTx.getKey());
|
||||||
}while(firstTx!=null && !isArrayFull(resultsList));
|
}while(firstTx!=null && !isArrayFull(resultsList));
|
||||||
String value=null;
|
entry.currentValue="";
|
||||||
|
boolean separator=false;
|
||||||
for(ITx o:resultsList){
|
for(ITx o:resultsList){
|
||||||
if(value==null)
|
if(separator) entry.currentValue+="|";
|
||||||
value=new String();
|
if(o!=null) entry.currentValue+=((ITx)o).getGenerator().getName();
|
||||||
else
|
separator=true;
|
||||||
value+="|";
|
|
||||||
if(o!=null) value+=((ITx)o).getGenerator().getName();
|
|
||||||
}
|
}
|
||||||
entry.setValue(value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
valueList.redraw();
|
int width = calculateValueWidth();
|
||||||
|
valueList.setSize(width, trackVerticalHeight);
|
||||||
|
valueListScrolled.setMinSize(width, trackVerticalHeight);
|
||||||
|
valueListScrolled.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isArrayFull(Object[] array){
|
private boolean isArrayFull(Object[] array){
|
||||||
@@ -549,11 +563,13 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (currentTxSelection != null)
|
if (currentTxSelection != null) {
|
||||||
return new StructuredSelection(currentTxSelection);
|
Object[] elem = {currentTxSelection, currentWaveformSelection};
|
||||||
else if (currentWaveformSelection != null)
|
return new StructuredSelection(elem);
|
||||||
return new StructuredSelection(currentWaveformSelection.waveform);
|
} else if (currentWaveformSelection != null) {
|
||||||
else
|
Object[] elem = {currentWaveformSelection.waveform, currentWaveformSelection};
|
||||||
|
return new StructuredSelection(elem);
|
||||||
|
} else
|
||||||
return new StructuredSelection();
|
return new StructuredSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,6 +609,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
currentWaveformSelection = (TrackEntry) sel;
|
currentWaveformSelection = (TrackEntry) sel;
|
||||||
if(currentTxSelection!=null && currentTxSelection.getStream()!=currentWaveformSelection)
|
if(currentTxSelection!=null && currentTxSelection.getStream()!=currentWaveformSelection)
|
||||||
currentTxSelection=null;
|
currentTxSelection=null;
|
||||||
|
|
||||||
selectionChanged = true;
|
selectionChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,6 +622,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
}
|
}
|
||||||
if(currentWaveformSelection!=null) currentWaveformSelection.selected=true;
|
if(currentWaveformSelection!=null) currentWaveformSelection.selected=true;
|
||||||
if (selectionChanged) {
|
if (selectionChanged) {
|
||||||
|
if(currentWaveformSelection!=null) waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||||
waveformCanvas.setSelected(currentTxSelection);
|
waveformCanvas.setSelected(currentTxSelection);
|
||||||
valueList.redraw();
|
valueList.redraw();
|
||||||
nameList.redraw();
|
nameList.redraw();
|
||||||
@@ -628,7 +646,16 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void moveSelection(GotoDirection direction) {
|
public void moveSelection(GotoDirection direction) {
|
||||||
moveSelection(direction, NEXT_PREV_IN_STREAM) ;
|
if(direction==GotoDirection.NEXT || direction==GotoDirection.PREV)
|
||||||
|
moveSelection(direction, NEXT_PREV_IN_STREAM) ;
|
||||||
|
else {
|
||||||
|
int idx = streams.indexOf(currentWaveformSelection);
|
||||||
|
if(direction==GotoDirection.UP && idx>0) {
|
||||||
|
setSelection(new StructuredSelection(streams.get(idx-1)));
|
||||||
|
} else if(direction==GotoDirection.DOWN && idx<(streams.size()-1)) {
|
||||||
|
setSelection(new StructuredSelection(streams.get(idx+1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -724,10 +751,12 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
public void moveCursor(GotoDirection direction) {
|
public void moveCursor(GotoDirection direction) {
|
||||||
long time = getCursorTime();
|
long time = getCursorTime();
|
||||||
NavigableMap<Long, ?> map=null;
|
NavigableMap<Long, ?> map=null;
|
||||||
if(currentWaveformSelection.isStream()){
|
if(currentWaveformSelection!=null) {
|
||||||
map=currentWaveformSelection.getStream().getEvents();
|
if(currentWaveformSelection.isStream()){
|
||||||
} else if(currentWaveformSelection.isSignal()){
|
map=currentWaveformSelection.getStream().getEvents();
|
||||||
map=currentWaveformSelection.getSignal().getEvents();
|
} else if(currentWaveformSelection.isSignal()){
|
||||||
|
map=currentWaveformSelection.getSignal().getEvents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(map!=null){
|
if(map!=null){
|
||||||
Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
|
Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
|
||||||
@@ -736,6 +765,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
setCursorTime(time);
|
setCursorTime(time);
|
||||||
waveformCanvas.reveal(time);
|
waveformCanvas.reveal(time);
|
||||||
waveformCanvas.redraw();
|
waveformCanvas.redraw();
|
||||||
|
updateValueList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,17 +785,21 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
@Override
|
@Override
|
||||||
public void moveSelectedTrack(int i) {
|
public void moveSelectedTrack(int i) {
|
||||||
if(currentWaveformSelection!=null){
|
if(currentWaveformSelection!=null){
|
||||||
ITx selectedTx=currentTxSelection;
|
|
||||||
TrackEntry selectedWaveform=currentWaveformSelection;
|
|
||||||
int idx = streams.indexOf(currentWaveformSelection);
|
int idx = streams.indexOf(currentWaveformSelection);
|
||||||
int newIdx=idx+i;
|
int newIdx=idx+i;
|
||||||
if(newIdx>=0 && newIdx<streams.size()){
|
if(newIdx>=0 && newIdx<streams.size()){
|
||||||
Collections.swap(streams,idx,newIdx);
|
Collections.swap(streams,idx,newIdx);
|
||||||
updateTracklist();
|
revealSelected=true;
|
||||||
if(selectedTx!=null){
|
// update();
|
||||||
setSelection(new StructuredSelection(new Object[]{selectedTx, selectedWaveform.waveform}));
|
// ITx selectedTx=currentTxSelection;
|
||||||
} else
|
// if(selectedTx!=null){
|
||||||
setSelection(new StructuredSelection(selectedWaveform.waveform));
|
// setSelection(new StructuredSelection(new Object[]{selectedTx, currentWaveformSelection.waveform}));
|
||||||
|
// } else {
|
||||||
|
// setSelection(new StructuredSelection(currentWaveformSelection.waveform));
|
||||||
|
// }
|
||||||
|
// waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||||
|
// valueList.redraw();
|
||||||
|
// nameList.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -781,13 +815,13 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformCanvas.getTrackHeight());
|
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformCanvas.getTrackHeight());
|
||||||
if (lastKey == firstKey) {
|
if (lastKey == firstKey) {
|
||||||
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
||||||
IWaveform<? extends IWaveformEvent> w = trackEntry.waveform;
|
IWaveform w = trackEntry.waveform;
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
|
||||||
IWaveform<? extends IWaveformEvent> w = entry.getValue().waveform;
|
IWaveform w = entry.getValue().waveform;
|
||||||
subArea.height = waveformCanvas.getTrackHeight();
|
subArea.height = waveformCanvas.getTrackHeight();
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
@@ -808,18 +842,18 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformCanvas.getTrackHeight());
|
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformCanvas.getTrackHeight());
|
||||||
if (lastKey == firstKey) {
|
if (lastKey == firstKey) {
|
||||||
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
||||||
IWaveform<? extends IWaveformEvent> w = trackEntry.waveform;
|
IWaveform w = trackEntry.waveform;
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawValue(gc, subArea, firstKey, actualValues.get(w), trackEntry.selected);
|
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
IWaveform<? extends IWaveformEvent> w = entry.getValue().waveform;
|
IWaveform w = entry.getValue().waveform;
|
||||||
subArea.height = waveformCanvas.getTrackHeight();
|
subArea.height = waveformCanvas.getTrackHeight();
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawValue(gc, subArea, entry.getKey(), actualValues.get(w), entry.getValue().selected);
|
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(NoSuchElementException e){}
|
}catch(NoSuchElementException e){}
|
||||||
@@ -987,7 +1021,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
else
|
else
|
||||||
streams.add(tgtIdx, srcWave);
|
streams.add(tgtIdx, srcWave);
|
||||||
currentWaveformSelection=srcWave;
|
currentWaveformSelection=srcWave;
|
||||||
updateTracklist();
|
update();
|
||||||
} else if(source instanceof CursorPainter){
|
} else if(source instanceof CursorPainter){
|
||||||
((CursorPainter)source).setTime(0);
|
((CursorPainter)source).setTime(0);
|
||||||
updateValueList();
|
updateValueList();
|
||||||
@@ -1006,7 +1040,7 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackEntry getEntryForStream(IWaveform<?> source) {
|
public TrackEntry getEntryForStream(IWaveform source) {
|
||||||
for(TrackEntry trackEntry:streams)
|
for(TrackEntry trackEntry:streams)
|
||||||
if(trackEntry.waveform.equals(source)) return trackEntry;
|
if(trackEntry.waveform.equals(source)) return trackEntry;
|
||||||
return null;
|
return null;
|
||||||
@@ -1146,7 +1180,8 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
public String getScaledTime(long time) {
|
public String getScaledTime(long time) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
Double dTime=new Double(time);
|
Double dTime=new Double(time);
|
||||||
return sb.append(dTime/waveformCanvas.getScaleFactorPow10()).append(waveformCanvas.getUnitStr()).toString();
|
Double scaledTime = dTime/waveformCanvas.getScaleFactorPow10();
|
||||||
|
return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -1154,10 +1189,10 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getZoomLevels(){
|
public String[] getZoomLevels(){
|
||||||
String[] res = new String[WaveformCanvas.unitMultiplier.length*WaveformCanvas.unitString.length];
|
String[] res = new String[Constants.unitMultiplier.length*Constants.unitString.length];
|
||||||
int index=0;
|
int index=0;
|
||||||
for(String unit:WaveformCanvas.unitString){
|
for(String unit:Constants.unitString){
|
||||||
for(int factor:WaveformCanvas.unitMultiplier){
|
for(int factor:Constants.unitMultiplier){
|
||||||
res[index++]= new Integer(factor).toString()+unit;
|
res[index++]= new Integer(factor).toString()+unit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1180,4 +1215,31 @@ public class WaveformViewer implements IWaveformViewer {
|
|||||||
origin.x=(int) (-time/waveformCanvas.getScaleFactorPow10());
|
origin.x=(int) (-time/waveformCanvas.getScaleFactorPow10());
|
||||||
waveformCanvas.setOrigin(origin);
|
waveformCanvas.setOrigin(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scrollHorizontal(int percent) {
|
||||||
|
if(percent<-100) percent=-100;
|
||||||
|
if(percent>100) percent=100;
|
||||||
|
int diff = (waveformCanvas.getWidth()*percent)/100;
|
||||||
|
// ScrollBar sb = waveformCanvas.getHorizontalBar();
|
||||||
|
// int x = sb.getSelection();
|
||||||
|
// System.out.println("Setting sb to "+ (x+diff));
|
||||||
|
// if((x+diff)>0)
|
||||||
|
// sb.setSelection(x+diff);
|
||||||
|
// else
|
||||||
|
// sb.setSelection(0);
|
||||||
|
Point o = waveformCanvas.getOrigin();
|
||||||
|
waveformCanvas.setOrigin(o.x-diff, o.y);
|
||||||
|
waveformCanvas.redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void asyncUpdate(Widget widget) {
|
||||||
|
widget.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
waveformCanvas.redraw();
|
||||||
|
updateValueList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Database UI
|
Bundle-Name: Database UI
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui
|
Bundle-SymbolicName: com.minres.scviewer.database.ui
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database.ui
|
Export-Package: com.minres.scviewer.database.ui
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
org.eclipse.jface
|
org.eclipse.jface
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.ui
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.ui</artifactId>
|
<artifactId>com.minres.scviewer.database.ui</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
||||||
+5
-1
@@ -34,6 +34,8 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
|||||||
public void addSelectionChangedListener(ISelectionChangedListener listener);
|
public void addSelectionChangedListener(ISelectionChangedListener listener);
|
||||||
|
|
||||||
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
||||||
|
|
||||||
|
public void update();
|
||||||
|
|
||||||
public Control getControl();
|
public Control getControl();
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
|||||||
|
|
||||||
public List<TrackEntry> getStreamList();
|
public List<TrackEntry> getStreamList();
|
||||||
|
|
||||||
public TrackEntry getEntryForStream(IWaveform<?> source);
|
public TrackEntry getEntryForStream(IWaveform source);
|
||||||
|
|
||||||
public void moveSelectedTrack(int i);
|
public void moveSelectedTrack(int i);
|
||||||
|
|
||||||
@@ -100,4 +102,6 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
|||||||
public long getBaselineTime();
|
public long getBaselineTime();
|
||||||
|
|
||||||
public void setBaselineTime(Long scale);
|
public void setBaselineTime(Long scale);
|
||||||
|
|
||||||
|
public void scrollHorizontal(int percent);
|
||||||
}
|
}
|
||||||
+19
-5
@@ -11,14 +11,22 @@
|
|||||||
package com.minres.scviewer.database.ui;
|
package com.minres.scviewer.database.ui;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
|
|
||||||
public class TrackEntry {
|
public class TrackEntry {
|
||||||
final public IWaveform<? extends IWaveformEvent> waveform;
|
public enum ValueDisplay {
|
||||||
|
DEFAULT, SIGNED, UNSIGNED
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WaveDisplay {
|
||||||
|
DEFAULT, STEP_WISE, CONTINOUS
|
||||||
|
}
|
||||||
|
|
||||||
|
final public IWaveform waveform;
|
||||||
|
|
||||||
public int vOffset;
|
public int vOffset;
|
||||||
|
|
||||||
@@ -26,7 +34,13 @@ public class TrackEntry {
|
|||||||
|
|
||||||
public boolean selected;
|
public boolean selected;
|
||||||
|
|
||||||
public TrackEntry(IWaveform<? extends IWaveformEvent> waveform) {
|
public String currentValue="";
|
||||||
|
|
||||||
|
public ValueDisplay valueDisplay = ValueDisplay.DEFAULT;
|
||||||
|
|
||||||
|
public WaveDisplay waveDisplay = WaveDisplay.DEFAULT;
|
||||||
|
|
||||||
|
public TrackEntry(IWaveform waveform) {
|
||||||
this.waveform = waveform;
|
this.waveform = waveform;
|
||||||
vOffset=0;
|
vOffset=0;
|
||||||
height=0;
|
height=0;
|
||||||
@@ -45,7 +59,7 @@ public class TrackEntry {
|
|||||||
return waveform instanceof ISignal<?>;
|
return waveform instanceof ISignal<?>;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISignal<? extends ISignalChange> getSignal(){
|
public ISignal<?> getSignal(){
|
||||||
return (ISignal<?>) waveform;
|
return (ISignal<?>) waveform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ public enum WaveformColors {
|
|||||||
LINE, LINE_HIGHLITE,
|
LINE, LINE_HIGHLITE,
|
||||||
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
||||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNAL_TEXT,
|
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
||||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
|||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: VCD signal database
|
Bundle-Name: VCD signal database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 2.0.2.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
@@ -13,3 +13,4 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
|||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Import-Package: com.google.common.collect
|
Import-Package: com.google.common.collect
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.vcd
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.vcd</artifactId>
|
<artifactId>com.minres.scviewer.database.vcd</artifactId>
|
||||||
|
<version>2.0.2-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
+16
-7
@@ -34,26 +34,35 @@ public interface IVCDDatabaseBuilder {
|
|||||||
*
|
*
|
||||||
* @param netName the net name
|
* @param netName the net name
|
||||||
* @param i the index of the net, -1 if a new one, otherwise the id if the referenced
|
* @param i the index of the net, -1 if a new one, otherwise the id if the referenced
|
||||||
* @param width the width
|
* @param width the width, -1 equals real, 0... is a bit vector
|
||||||
* @return the integer
|
* @return the net id
|
||||||
*/
|
*/
|
||||||
public Integer newNet(String netName, int i, int width) ;
|
public Integer newNet(String netName, int i, int width) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the net width.
|
* Gets the net width.
|
||||||
*
|
*
|
||||||
* @param intValue the int value
|
* @param intValue the net id
|
||||||
* @return the net width
|
* @return the net width, -1 means a real-valued net
|
||||||
*/
|
*/
|
||||||
public int getNetWidth(int intValue);
|
public int getNetWidth(int netId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append transition.
|
* Append transition.
|
||||||
*
|
*
|
||||||
* @param signalId the int value
|
* @param netId the int value
|
||||||
* @param currentTime the current time in ps
|
* @param currentTime the current time in ps
|
||||||
* @param decodedValues the decoded values
|
* @param decodedValues the decoded values
|
||||||
*/
|
*/
|
||||||
public void appendTransition(int signalId, long currentTime, BitVector decodedValues);
|
public void appendTransition(int netId, long currentTime, BitVector decodedValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append transition.
|
||||||
|
*
|
||||||
|
* @param netId the int value
|
||||||
|
* @param currentTime the current time in ps
|
||||||
|
* @param decodedValue the decoded values
|
||||||
|
*/
|
||||||
|
public void appendTransition(int netId, long currentTime, double decodedValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-52
@@ -12,22 +12,23 @@ package com.minres.scviewer.database.vcd;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.NavigableMap;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
import com.minres.scviewer.database.InputFormatException;
|
import com.minres.scviewer.database.InputFormatException;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
private Stack<String> moduleStack;
|
private Stack<String> moduleStack;
|
||||||
|
|
||||||
/** The signals. */
|
/** The signals. */
|
||||||
private List<IWaveform<? extends IWaveformEvent>> signals;
|
private List<IWaveform> signals;
|
||||||
|
|
||||||
/** The max time. */
|
/** The max time. */
|
||||||
private long maxTime;
|
private long maxTime;
|
||||||
@@ -58,8 +59,20 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
public VCDDbLoader() {
|
public VCDDbLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The date bytes. */
|
private static boolean isGzipped(File f) {
|
||||||
private byte[] dateBytes = "$date".getBytes();
|
InputStream is = null;
|
||||||
|
try {
|
||||||
|
is = new FileInputStream(f);
|
||||||
|
byte [] signature = new byte[2];
|
||||||
|
int nread = is.read( signature ); //read the gzip signature
|
||||||
|
return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try { is.close();} catch (IOException e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
||||||
@@ -68,35 +81,36 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db;
|
this.db=db;
|
||||||
|
this.maxTime=0;
|
||||||
|
String name = file.getCanonicalFile().getName();
|
||||||
|
if(!(name.endsWith(".vcd") ||
|
||||||
|
name.endsWith(".vcdz") ||
|
||||||
|
name.endsWith(".vcdgz") ||
|
||||||
|
name.endsWith(".vcd.gz")) )
|
||||||
|
return false;
|
||||||
|
signals = new Vector<IWaveform>();
|
||||||
|
moduleStack= new Stack<String>();
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
byte[] buffer = new byte[dateBytes.length];
|
boolean res = new VCDFileParser(false).load(isGzipped(file)?new GZIPInputStream(fis):fis, this);
|
||||||
int read = fis.read(buffer, 0, dateBytes.length);
|
|
||||||
fis.close();
|
|
||||||
if (read == dateBytes.length)
|
|
||||||
for (int i = 0; i < dateBytes.length; i++)
|
|
||||||
if (buffer[i] != dateBytes[i])
|
|
||||||
return false;
|
|
||||||
|
|
||||||
signals = new Vector<IWaveform<? extends IWaveformEvent>>();
|
|
||||||
moduleStack= new Stack<String>();
|
|
||||||
boolean res = new VCDFileParser(false).load(new FileInputStream(file), this);
|
|
||||||
moduleStack=null;
|
moduleStack=null;
|
||||||
if(!res) throw new InputFormatException();
|
if(!res) throw new InputFormatException();
|
||||||
// calculate max time of database
|
// calculate max time of database
|
||||||
for(IWaveform<? extends IWaveformEvent> waveform:signals)
|
for(IWaveform waveform:signals) {
|
||||||
maxTime= Math.max(maxTime, ((ISignal<? extends ISignalChange>)waveform).getEvents().lastKey());
|
NavigableMap<Long, ?> events =((ISignal<?>)waveform).getEvents();
|
||||||
|
if(events.size()>0)
|
||||||
|
maxTime= Math.max(maxTime, events.lastKey());
|
||||||
|
}
|
||||||
// extend signals to hav a last value set at max time
|
// extend signals to hav a last value set at max time
|
||||||
for(IWaveform<? extends IWaveformEvent> waveform:signals){
|
for(IWaveform s:signals){
|
||||||
TreeMap<Long,? extends ISignalChange> events = ((VCDSignal<? extends ISignalChange>)waveform).values;
|
if(s instanceof VCDSignal<?>) {
|
||||||
if(events.lastKey()<maxTime){
|
TreeMap<Long,?> events = (TreeMap<Long, ?>) ((VCDSignal<?>)s).getEvents();
|
||||||
ISignalChange x = events.lastEntry().getValue();
|
if(events.size()>0 && events.lastKey()<maxTime){
|
||||||
if(x instanceof ISignalChangeSingle)
|
Object val = events.lastEntry().getValue();
|
||||||
((VCDSignal<ISignalChangeSingle>)waveform).values.put(maxTime,
|
if(val instanceof BitVector) {
|
||||||
new VCDSignalChangeSingle(maxTime, ((ISignalChangeSingle)x).getValue()));
|
((VCDSignal<BitVector>)s).addSignalChange(maxTime, (BitVector) val);
|
||||||
else
|
} else if(val instanceof Double)
|
||||||
if(x instanceof ISignalChangeMulti)
|
((VCDSignal<Double>)s).addSignalChange(maxTime, (Double) val);
|
||||||
((VCDSignal<ISignalChangeMulti>)waveform).values.put(maxTime,
|
}
|
||||||
new VCDSignalChangeMulti(maxTime, ((ISignalChangeMulti)x).getValue()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -114,7 +128,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
|
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() {
|
public List<IWaveform> getAllWaves() {
|
||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,9 +137,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enterModule(String tokenString) {
|
public void enterModule(String tokenString) {
|
||||||
if(moduleStack.isEmpty())
|
if(moduleStack.isEmpty()) {
|
||||||
moduleStack.push(tokenString);
|
if("SystemC".compareTo(tokenString)!=0) moduleStack.push(tokenString);
|
||||||
else
|
} else
|
||||||
moduleStack.push(moduleStack.peek()+"."+tokenString);
|
moduleStack.push(moduleStack.peek()+"."+tokenString);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -143,17 +157,17 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Integer newNet(String netName, int i, int width) {
|
public Integer newNet(String name, int i, int width) {
|
||||||
|
String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
|
||||||
int id = signals.size();
|
int id = signals.size();
|
||||||
VCDSignal<? extends IWaveformEvent> signal;
|
assert(width>=0);
|
||||||
if(width==1){
|
if(width==0) {
|
||||||
signal = i<0 ? new VCDSignal<ISignalChangeSingle>(db, id, netName) :
|
signals.add( i<0 ? new VCDSignal<Double>(db, id, netName, width) :
|
||||||
new VCDSignal<ISignalChangeSingle>((VCDSignal<ISignalChangeSingle>)signals.get(i), id, netName);
|
new VCDSignal<Double>((VCDSignal<Double>)signals.get(i), id, netName));
|
||||||
} else {
|
} else if(width>0){
|
||||||
signal = i<0 ? new VCDSignal<ISignalChangeMulti>(db, id, netName, width) :
|
signals.add( i<0 ? new VCDSignal<BitVector>(db, id, netName, width) :
|
||||||
new VCDSignal<ISignalChangeMulti>((VCDSignal<VCDSignalChangeMulti>)signals.get(i), id, netName);
|
new VCDSignal<BitVector>((VCDSignal<BitVector>)signals.get(i), id, netName));
|
||||||
};
|
}
|
||||||
signals.add(signal);
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +176,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getNetWidth(int intValue) {
|
public int getNetWidth(int intValue) {
|
||||||
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(intValue);
|
VCDSignal<?> signal = (VCDSignal<?>) signals.get(intValue);
|
||||||
return signal.getWidth();
|
return signal.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,13 +185,22 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
|
public void appendTransition(int signalId, long currentTime, BitVector value) {
|
||||||
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
VCDSignal<BitVector> signal = (VCDSignal<BitVector>) signals.get(signalId);
|
||||||
Long time = currentTime* TIME_RES;
|
Long time = currentTime* TIME_RES;
|
||||||
if(signal.getWidth()==1){
|
signal.getEvents().put(time, value);
|
||||||
((VCDSignal<ISignalChangeSingle>)signal).values.put(time, new VCDSignalChangeSingle(time, decodedValues.getValue()[0]));
|
}
|
||||||
} else {
|
|
||||||
((VCDSignal<VCDSignalChangeMulti>)signal).values.put(time, new VCDSignalChangeMulti(time, decodedValues));
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void appendTransition(int signalId, long currentTime, double value) {
|
||||||
|
VCDSignal<?> signal = (VCDSignal<?>) signals.get(signalId);
|
||||||
|
Long time = currentTime* TIME_RES;
|
||||||
|
if(signal.getWidth()==0){
|
||||||
|
((VCDSignal<Double>)signal).getEvents().put(time, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+72
-30
@@ -13,6 +13,7 @@ package com.minres.scviewer.database.vcd;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.BitValue;
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
|
|
||||||
class VCDFileParser {
|
class VCDFileParser {
|
||||||
@@ -21,10 +22,12 @@ class VCDFileParser {
|
|||||||
private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
|
private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
|
||||||
private long picoSecondsPerIncrement;
|
private long picoSecondsPerIncrement;
|
||||||
private boolean stripNetWidth;
|
private boolean stripNetWidth;
|
||||||
|
private boolean replaceColon;
|
||||||
long currentTime;
|
long currentTime;
|
||||||
|
|
||||||
public VCDFileParser(boolean stripNetWidth) {
|
public VCDFileParser(boolean stripNetWidth) {
|
||||||
this.stripNetWidth=stripNetWidth;
|
this.stripNetWidth=stripNetWidth;
|
||||||
|
this.replaceColon=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean load(InputStream is, IVCDDatabaseBuilder builder) {
|
public boolean load(InputStream is, IVCDDatabaseBuilder builder) {
|
||||||
@@ -61,9 +64,11 @@ class VCDFileParser {
|
|||||||
|
|
||||||
private void parseVar() throws Exception {
|
private void parseVar() throws Exception {
|
||||||
nextToken(); // type
|
nextToken(); // type
|
||||||
|
String type = tokenizer.sval;
|
||||||
nextToken(); // size
|
nextToken(); // size
|
||||||
int width = Integer.parseInt(tokenizer.sval);
|
int width = Integer.parseInt(tokenizer.sval);
|
||||||
|
if("real".equals(type))
|
||||||
|
width=0;
|
||||||
nextToken();
|
nextToken();
|
||||||
String id = tokenizer.sval;
|
String id = tokenizer.sval;
|
||||||
nextToken();
|
nextToken();
|
||||||
@@ -73,11 +78,17 @@ class VCDFileParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer net = nameToNetMap.get(id);
|
Integer net = nameToNetMap.get(id);
|
||||||
if (net == null) {
|
if (net == null) { // We've never seen this net before
|
||||||
// We've never seen this net before
|
int openBracket = netName.indexOf('[');
|
||||||
if(stripNetWidth){
|
if(stripNetWidth){
|
||||||
int openBracket = netName.indexOf('[');
|
|
||||||
if (openBracket != -1) netName = netName.substring(0, openBracket);
|
if (openBracket != -1) netName = netName.substring(0, openBracket);
|
||||||
|
openBracket = -1;
|
||||||
|
}
|
||||||
|
if(replaceColon) {
|
||||||
|
if (openBracket != -1) {
|
||||||
|
netName = netName.substring(0, openBracket).replaceAll(":", ".")+netName.substring(openBracket);
|
||||||
|
} else
|
||||||
|
netName=netName.replaceAll(":", ".");
|
||||||
}
|
}
|
||||||
nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
|
nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
|
||||||
} else {
|
} else {
|
||||||
@@ -86,6 +97,17 @@ class VCDFileParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void parseComment() throws Exception {
|
||||||
|
nextToken();
|
||||||
|
String s = tokenizer.sval;
|
||||||
|
nextToken();
|
||||||
|
while(!tokenizer.sval.equals("$end")){
|
||||||
|
s+=" "+tokenizer.sval;
|
||||||
|
nextToken();
|
||||||
|
}
|
||||||
|
replaceColon|=s.contains("ARTERIS Architecture");
|
||||||
|
}
|
||||||
|
|
||||||
private void parseTimescale() throws Exception {
|
private void parseTimescale() throws Exception {
|
||||||
nextToken();
|
nextToken();
|
||||||
String s = tokenizer.sval;
|
String s = tokenizer.sval;
|
||||||
@@ -129,6 +151,8 @@ class VCDFileParser {
|
|||||||
parseUpscope();
|
parseUpscope();
|
||||||
else if (tokenizer.sval.equals("$timescale"))
|
else if (tokenizer.sval.equals("$timescale"))
|
||||||
parseTimescale();
|
parseTimescale();
|
||||||
|
else if (tokenizer.sval.equals("$comment"))
|
||||||
|
parseComment();
|
||||||
else if (tokenizer.sval.equals("$enddefinitions")) {
|
else if (tokenizer.sval.equals("$enddefinitions")) {
|
||||||
match("$end");
|
match("$end");
|
||||||
return false;
|
return false;
|
||||||
@@ -153,7 +177,8 @@ class VCDFileParser {
|
|||||||
} while (!tokenizer.sval.equals("$end"));
|
} while (!tokenizer.sval.equals("$end"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end")) return true;
|
if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end"))
|
||||||
|
return true;
|
||||||
String value, id;
|
String value, id;
|
||||||
if (tokenizer.sval.charAt(0) == 'b') {
|
if (tokenizer.sval.charAt(0) == 'b') {
|
||||||
// Multiple value net. Value appears first, followed by space,
|
// Multiple value net. Value appears first, followed by space,
|
||||||
@@ -161,6 +186,12 @@ class VCDFileParser {
|
|||||||
value = tokenizer.sval.substring(1);
|
value = tokenizer.sval.substring(1);
|
||||||
nextToken();
|
nextToken();
|
||||||
id = tokenizer.sval;
|
id = tokenizer.sval;
|
||||||
|
}else if (tokenizer.sval.charAt(0) == 'r') {
|
||||||
|
// Multiple value net. Value appears first, followed by space,
|
||||||
|
// then identifier
|
||||||
|
value = tokenizer.sval.substring(1);
|
||||||
|
nextToken();
|
||||||
|
id = tokenizer.sval;
|
||||||
} else {
|
} else {
|
||||||
// Single value net. identifier first, then value, no space.
|
// Single value net. identifier first, then value, no space.
|
||||||
value = tokenizer.sval.substring(0, 1);
|
value = tokenizer.sval.substring(0, 1);
|
||||||
@@ -174,39 +205,50 @@ class VCDFileParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int netWidth = traceBuilder.getNetWidth(net);
|
int netWidth = traceBuilder.getNetWidth(net);
|
||||||
BitVector decodedValues = new BitVector(netWidth);
|
if(netWidth==0) {
|
||||||
if (value.equals("z") && netWidth > 1) {
|
if("nan".equals(value))
|
||||||
for (int i = 0; i < netWidth; i++)
|
traceBuilder.appendTransition(net, currentTime, Double.NaN);
|
||||||
decodedValues.setValue(i, BitVector.VALUE_Z);
|
else
|
||||||
} else if (value.equals("x") && netWidth > 1) {
|
traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value));
|
||||||
for (int i = 0; i < netWidth; i++)
|
|
||||||
decodedValues.setValue(i, BitVector.VALUE_X);
|
|
||||||
} else {
|
} else {
|
||||||
int stringIndex = 0;
|
BitVector decodedValues = new BitVector(netWidth);
|
||||||
for (int convertedIndex = netWidth - value.length(); convertedIndex < netWidth; convertedIndex++) {
|
if (value.equals("z") && netWidth > 1) {
|
||||||
switch (value.charAt(stringIndex++)) {
|
for (int i = 0; i < netWidth; i++)
|
||||||
case 'z':
|
decodedValues.setValue(i, BitValue.Z);
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_Z);
|
} else if (value.equals("x") && netWidth > 1) {
|
||||||
break;
|
for (int i = 0; i < netWidth; i++)
|
||||||
|
decodedValues.setValue(i, BitValue.X);
|
||||||
|
} else {
|
||||||
|
int stringIndex = 0;
|
||||||
|
for (int convertedIndex = netWidth -1; convertedIndex >=0; convertedIndex--) {
|
||||||
|
if(convertedIndex<value.length()) {
|
||||||
|
switch (value.charAt(stringIndex++)) {
|
||||||
|
case 'z':
|
||||||
|
decodedValues.setValue(convertedIndex, BitValue.Z);
|
||||||
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_1);
|
decodedValues.setValue(convertedIndex, BitValue.ONE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '0':
|
case '0':
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_0);
|
decodedValues.setValue(convertedIndex, BitValue.ZERO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_X);
|
decodedValues.setValue(convertedIndex, BitValue.X);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
decodedValues.setValue(convertedIndex, BitVector.VALUE_X);
|
decodedValues.setValue(convertedIndex, BitValue.X);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
decodedValues.setValue(convertedIndex, BitValue.ZERO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
||||||
}
|
}
|
||||||
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-10
@@ -10,17 +10,17 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import com.minres.scviewer.database.HierNode;
|
import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
|
||||||
public class VCDSignal<T extends ISignalChange> extends HierNode implements ISignal<T> {
|
public class VCDSignal<T> extends HierNode implements ISignal<T> {
|
||||||
|
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
@@ -29,10 +29,12 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
|
|||||||
private final String kind = "signal";
|
private final String kind = "signal";
|
||||||
|
|
||||||
private final int width;
|
private final int width;
|
||||||
|
|
||||||
|
private final T dummy = null;
|
||||||
|
|
||||||
private IWaveformDb db;
|
private IWaveformDb db;
|
||||||
|
|
||||||
TreeMap<Long, T> values;
|
private TreeMap<Long, T> values;
|
||||||
|
|
||||||
public VCDSignal(IWaveformDb db, String name) {
|
public VCDSignal(IWaveformDb db, String name) {
|
||||||
this(db, 0, name, 1);
|
this(db, 0, name, 1);
|
||||||
@@ -52,7 +54,7 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public VCDSignal(IWaveform<? extends ISignalChange> other, int id, String name) {
|
public VCDSignal(ISignal<T> other, int id, String name) {
|
||||||
super(name);
|
super(name);
|
||||||
fullName=name;
|
fullName=name;
|
||||||
this.id=id;
|
this.id=id;
|
||||||
@@ -90,8 +92,8 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
|
|||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSignalChange(T change){
|
public void addSignalChange(Long time, T value){
|
||||||
values.put(change.getTime(), change);
|
values.put(time, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -100,20 +102,29 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T getWaveformEventsAtTime(Long time) {
|
public T getWaveformValueAtTime(Long time) {
|
||||||
return values.get(time);
|
return values.get(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T getWaveformEventsBeforeTime(Long time) {
|
public T getWaveformValueBeforeTime(Long time) {
|
||||||
return values.floorEntry(time).getValue();
|
Entry<Long, T> e = values.floorEntry(time);
|
||||||
|
if(e==null)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
return values.floorEntry(time).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
|
public Boolean equals(IWaveform other) {
|
||||||
return(other instanceof VCDSignal<?> && this.getId()==other.getId());
|
return(other instanceof VCDSignal<?> && this.getId()==other.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> getType() {
|
||||||
|
return dummy.getClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
-43
@@ -1,43 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package com.minres.scviewer.database.vcd;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
|
||||||
import com.minres.scviewer.database.SignalChange;
|
|
||||||
|
|
||||||
public class VCDSignalChangeMulti extends SignalChange implements ISignalChangeMulti, Cloneable {
|
|
||||||
|
|
||||||
private BitVector value;
|
|
||||||
|
|
||||||
public VCDSignalChangeMulti(Long time) {
|
|
||||||
super(time);
|
|
||||||
}
|
|
||||||
|
|
||||||
public VCDSignalChangeMulti(Long time, BitVector decodedValues) {
|
|
||||||
super(time);
|
|
||||||
this.value=decodedValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BitVector getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(BitVector value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return value.toHexString()+"@"+getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-37
@@ -1,37 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package com.minres.scviewer.database.vcd;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
|
||||||
import com.minres.scviewer.database.SignalChange;
|
|
||||||
|
|
||||||
public class VCDSignalChangeSingle extends SignalChange implements ISignalChangeSingle, Cloneable {
|
|
||||||
|
|
||||||
private char value;
|
|
||||||
|
|
||||||
public VCDSignalChangeSingle(Long time, char value) {
|
|
||||||
super(time);
|
|
||||||
this.value=value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(char value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return value+"@"+getTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ Bundle-Name: Waveform database
|
|||||||
Bundle-SymbolicName: com.minres.scviewer.database
|
Bundle-SymbolicName: com.minres.scviewer.database
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database
|
Export-Package: com.minres.scviewer.database
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
||||||
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.minres.scviewer.database;
|
||||||
|
public enum BitValue {
|
||||||
|
ZERO,
|
||||||
|
ONE,
|
||||||
|
X,
|
||||||
|
Z;
|
||||||
|
|
||||||
|
private static final BitValue[] ORDINAL_TABLE = BitValue.values();
|
||||||
|
|
||||||
|
public static BitValue fromChar(char c) {
|
||||||
|
switch (c) {
|
||||||
|
case '0':
|
||||||
|
return ZERO;
|
||||||
|
case '1':
|
||||||
|
return ONE;
|
||||||
|
case 'x':
|
||||||
|
case 'X':
|
||||||
|
return X;
|
||||||
|
case 'z':
|
||||||
|
case 'Z':
|
||||||
|
return Z;
|
||||||
|
default:
|
||||||
|
throw new NumberFormatException("unknown digit " + c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public char toChar() {
|
||||||
|
switch (this) {
|
||||||
|
case ZERO:
|
||||||
|
return '0';
|
||||||
|
case ONE:
|
||||||
|
return '1';
|
||||||
|
case X:
|
||||||
|
return 'x';
|
||||||
|
case Z:
|
||||||
|
return 'z';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ' '; // Unreachable?
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BitValue fromInt(int i) {
|
||||||
|
if (i == 0) {
|
||||||
|
return ZERO;
|
||||||
|
} else {
|
||||||
|
return ONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int toInt() {
|
||||||
|
return (this == ONE) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BitValue fromOrdinal(int ord) {
|
||||||
|
return ORDINAL_TABLE[ord];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int compare(BitValue other) {
|
||||||
|
if (this == ONE && other == ZERO) {
|
||||||
|
return 1;
|
||||||
|
} else if (this == ZERO && other == ONE) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
// Either these are equal, or there is an X and Z, which match everything.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,31 +12,53 @@ package com.minres.scviewer.database;
|
|||||||
|
|
||||||
public class BitVector {
|
public class BitVector {
|
||||||
|
|
||||||
public static final char VALUE_X = 'X';
|
|
||||||
public static final char VALUE_Z = 'Z';
|
|
||||||
public static final char VALUE_1 = '1';
|
|
||||||
public static final char VALUE_0 = '0';
|
|
||||||
|
|
||||||
private final int width;
|
private final int width;
|
||||||
|
|
||||||
private char[] value;
|
private int[] packedValues;
|
||||||
|
|
||||||
public BitVector(int netWidth) {
|
public BitVector(int netWidth) {
|
||||||
this.width=netWidth;
|
this.width=netWidth;
|
||||||
value = new char[netWidth];
|
packedValues = new int[(netWidth+15)/16];
|
||||||
for(int i=0; i<netWidth; i++) value[i]='0';
|
for(int i=0; i<packedValues.length; i++) packedValues[i]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(int i, char value) {
|
public void setValue(int i, BitValue value) {
|
||||||
this.value[i]=value;
|
int bitIndex = i*2;
|
||||||
|
int wordOffset = bitIndex >> 5;
|
||||||
|
int bitOffset = bitIndex & 31;
|
||||||
|
packedValues[wordOffset] &= ~(3 << bitOffset);
|
||||||
|
packedValues[wordOffset] |= value.ordinal() << bitOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public char[] getValue() {
|
public char[] getValue() {
|
||||||
return value;
|
int bitOffset = 0;
|
||||||
|
int wordOffset = 0;
|
||||||
|
char[] res = new char[width];
|
||||||
|
// Copy values out of packed array
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
int currentWord = (packedValues[wordOffset] >> bitOffset)&3;
|
||||||
|
res[width-i-1]=BitValue.fromInt(currentWord).toChar();
|
||||||
|
bitOffset += 2;
|
||||||
|
if (bitOffset == 32) {
|
||||||
|
wordOffset++;
|
||||||
|
bitOffset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(char[] value) {
|
public void setValue(char[] value) {
|
||||||
this.value = value;
|
int bitIndex = width;
|
||||||
|
int wordOffset = bitIndex >> 4;
|
||||||
|
int bitOffset = (bitIndex * 2) % 32;
|
||||||
|
for (int i = Math.min(value.length, width) - 1; i >= 0; i--) {
|
||||||
|
packedValues[wordOffset] |= BitValue.fromChar(value[i]).ordinal() << bitOffset;
|
||||||
|
bitOffset += 2;
|
||||||
|
if (bitOffset == 32) {
|
||||||
|
wordOffset++;
|
||||||
|
bitOffset = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWidth() {
|
public int getWidth() {
|
||||||
@@ -44,23 +66,104 @@ public class BitVector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return new String(value);
|
return new String(getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toHexString(){
|
public String toHexString(){
|
||||||
int resWidth=(width-1)/4+1;
|
int resWidth=(width-1)/4+1;
|
||||||
|
char[] value=getValue();
|
||||||
char[] res = new char[resWidth];
|
char[] res = new char[resWidth];
|
||||||
for(int i=resWidth-1; i>=0; i--){
|
for(int i=resWidth-1; i>=0; i--){
|
||||||
int digit=0;
|
int digit=0;
|
||||||
for(int j=3; j>=0; j--){
|
for(int j=3; j>=0; j--){
|
||||||
if(value[4*i+j]==VALUE_X ||value[4*i+j]==VALUE_Z ){
|
BitValue val = BitValue.fromChar(value[4*i+j]);
|
||||||
res[i]=VALUE_X;
|
switch(val) {
|
||||||
}
|
case X:
|
||||||
if(value[4*i+j]==VALUE_1)
|
case Z:
|
||||||
|
res[i]=val.toChar();
|
||||||
|
continue;
|
||||||
|
case ONE:
|
||||||
digit+=1<<(3-j);
|
digit+=1<<(3-j);
|
||||||
res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10)
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10)
|
||||||
}
|
}
|
||||||
return new String(res);
|
return new String(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long toUnsignedValue() {
|
||||||
|
long res = 0;
|
||||||
|
int bitOffset = 0;
|
||||||
|
int wordOffset = 0;
|
||||||
|
int currentWord = 0;
|
||||||
|
// Copy values out of packed array
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
if(bitOffset==0) currentWord = packedValues[wordOffset];
|
||||||
|
switch (currentWord & 3) {
|
||||||
|
case 1:
|
||||||
|
res|=1<<i;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bitOffset += 2;
|
||||||
|
if (bitOffset == 32) {
|
||||||
|
wordOffset++;
|
||||||
|
bitOffset = 0;
|
||||||
|
} else {
|
||||||
|
currentWord >>= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long toSignedValue() {
|
||||||
|
long res = 0;
|
||||||
|
int bitOffset = 0;
|
||||||
|
int wordOffset = 0;
|
||||||
|
int currentWord = 0;
|
||||||
|
int lastVal=0;
|
||||||
|
// Copy values out of packed array
|
||||||
|
for (int i = 0; i < width; i++) {
|
||||||
|
if(bitOffset==0) currentWord = packedValues[wordOffset];
|
||||||
|
lastVal=0;
|
||||||
|
switch (currentWord & 3) {
|
||||||
|
case 1:
|
||||||
|
res|=1<<i;
|
||||||
|
lastVal=1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
bitOffset += 2;
|
||||||
|
if (bitOffset == 32) {
|
||||||
|
wordOffset++;
|
||||||
|
bitOffset = 0;
|
||||||
|
} else {
|
||||||
|
currentWord >>= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int i=width; i<64; i++) {
|
||||||
|
if(bitOffset==0) currentWord = packedValues[wordOffset];
|
||||||
|
res|=lastVal<<i;
|
||||||
|
bitOffset += 2;
|
||||||
|
if (bitOffset == 32) {
|
||||||
|
wordOffset++;
|
||||||
|
bitOffset = 0;
|
||||||
|
} else {
|
||||||
|
currentWord >>= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ package com.minres.scviewer.database;
|
|||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
|
|
||||||
public interface ISignal<T extends ISignalChange> extends IWaveform<T>{
|
public interface ISignal<T> extends IWaveform{
|
||||||
|
|
||||||
public NavigableMap<Long, T> getEvents();
|
public NavigableMap<Long, T> getEvents();
|
||||||
|
|
||||||
public T getWaveformEventsAtTime(Long time);
|
public T getWaveformValueAtTime(Long time);
|
||||||
|
|
||||||
public T getWaveformEventsBeforeTime(Long time);
|
public T getWaveformValueBeforeTime(Long time);
|
||||||
|
|
||||||
|
public Class<?> getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
|
||||||
* All rights reserved. This program and the accompanying materials
|
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
|
||||||
* which accompanies this distribution, and is available at
|
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
|
||||||
*
|
|
||||||
* Contributors:
|
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
package com.minres.scviewer.database;
|
|
||||||
|
|
||||||
public interface ISignalChange extends IWaveformEvent {
|
|
||||||
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user