Skip to content
Snippets Groups Projects
Commit 27f7ec37 authored by Peter Wagenhuber's avatar Peter Wagenhuber
Browse files

Mal die ersten Klassen gehackt

parent c80f811c
No related branches found
No related tags found
No related merge requests found
images/*
tags
<project name="nloc" default="show" basedir=".">
<project name="nloc" default="compile" basedir=".">
<description>
build file for droplet sequence generator
</description>
......@@ -19,6 +19,7 @@
<tstamp/>
<mkdir dir="${docdir}"/>
<mkdir dir="${build}"/>
<mkdir dir="${build}/META-INF"/>
</target>
<target name="compile" depends="init,ctags"
......@@ -27,9 +28,13 @@
<javac srcdir="${src}" destdir="${build}" classpathref="classpath"
debug="true"/>
<property name = "build.compiler.emacs" value = "true"/>
<jar destfile="${build}/dgen.jar"
basedir="${build}"
includes="**/*.class"/>
<jar destfile="${build}/dsgen.jar"
basedir = "${build}"
includes="**/*.class">
<manifest>
<attribute name="Main-Class" value="nloc.Nloc"/>
</manifest>
</jar>
</target>
<target name="clean"
......
File added
File added
File added
File added
File added
File added
package nloc;
import java.util.SortedSet;
import java.util.TreeSet;
public class Bifurcation extends NlocEntity {
private Channel inChan;
private SortedSet<Channel> outChans;
public Bifurcation(Channel inChan) {
super();
this.inChan = inChan;
this.outChans = new TreeSet<Channel>();
}
public Channel getInChan() {
return inChan;
}
public SortedSet<Channel> getOutChans() {
return outChans;
}
public void addOutChan(Channel outChan) {
outChans.add(outChan);
}
}
package nloc;
import java.util.ArrayList;
import java.util.List;
public class Channel extends NlocEntity implements Comparable<Channel> {
private int pSteps, hSteps;
private List<Channel> parents, children;
// private List<Droplet> dropletList;
public Channel(int pSteps, int hSteps) {
super();
this.pSteps = pSteps;
this.hSteps = hSteps;
this.parents = new ArrayList<Channel>();
this.children = new ArrayList<Channel>();
}
public int getPSteps() {
return pSteps;
}
public int getHSteps() {
return hSteps;
}
public void addChild(Channel child) {
if (!children.contains(child)) {
children.add(child);
child.addParent(this);
}
}
public void addParent(Channel parent) {
if (!parents.contains(parent)) {
parents.add(parent);
parent.addChild(this);
}
}
public List<Channel> getChildren() {
return children;
}
public List<Channel> getParents() {
return parents;
}
public int compareTo(Channel other) {
if (this.getPSteps() < other.getPSteps()) {
return -1;
} else if (this.getPSteps() == other.getPSteps()) {
return 0;
} else {
return 1;
}
}
}
package nloc;
public class Module extends Channel {
private String moduleName;
public Module (String moduleName, int pSteps, int hSteps) {
super(pSteps, hSteps);
this.moduleName = moduleName;
}
public String getModuleName() {
return moduleName;
}
}
package nloc;
public class Nloc {
public static void main(String[] args) {
Channel chan0 = new Channel(7,6);
Channel chan1 = new Channel(16,15);
Channel chan2 = new Channel(17,16);
Channel chan3 = new Channel(8,7);
chan0.addChild(chan1);
chan0.addChild(chan2);
chan1.addChild(chan3);
chan2.addChild(chan3);
for(Channel ch : chan0.getChildren()) {
System.out.println("ID: " + ch.getID() + " pSteps: " + ch.getPSteps());
}
for(Channel ch : chan1.getChildren()) {
System.out.println("ID: " + ch.getID() + " pSteps: " + ch.getPSteps());
}
for(Channel ch : chan2.getChildren()) {
System.out.println("ID: " + ch.getID() + " pSteps: " + ch.getPSteps());
}
}
}
package nloc;
public class NlocEntity {
private static int nofEntities = 0;
private int ID;
public NlocEntity() {
this.ID = nofEntities++;
}
public int getID() {
return ID;
}
}
package nloc;
import java.util.List;
import java.util.ArrayList;
public class TeeIntersection extends NlocEntity {
private Channel outChan;
private List<Channel> inChans;
public TeeIntersection(Channel outChan) {
super();
this.outChan = outChan;
this.inChans = new ArrayList<Channel>();
}
public Channel getOutChan() {
return inChan;
}
public List<Channel> getInChans() {
return outChans;
}
public void addInChan(Channel inChan) {
inChans.add(inChan);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment