use of cbit.vcell.parser.AutoCompleteSymbolFilter in project vcell by virtualcell.
the class GeometrySubVolumeTableModel method setGeometry.
/**
* Sets the geometry property (cbit.vcell.geometry.Geometry) value.
* @param geometry The new value for the property.
* @see #getGeometry
*/
public void setGeometry(Geometry geometry) {
if (fieldGeometry == geometry) {
return;
}
Geometry oldValue = fieldGeometry;
if (oldValue != null) {
oldValue.getGeometrySpec().removePropertyChangeListener(this);
for (SubVolume sv : oldValue.getGeometrySpec().getSubVolumes()) {
sv.removePropertyChangeListener(this);
}
}
fieldGeometry = geometry;
if (fieldGeometry != null) {
fieldGeometry.getGeometrySpec().addPropertyChangeListener(this);
for (SubVolume sv : fieldGeometry.getGeometrySpec().getSubVolumes()) {
sv.addPropertyChangeListener(this);
}
autoCompleteSymbolFilter = new AutoCompleteSymbolFilter() {
public boolean accept(SymbolTableEntry ste) {
int dimension = fieldGeometry.getDimension();
if (ste.equals(ReservedVariable.X) || dimension > 1 && ste.equals(ReservedVariable.Y) || dimension > 2 && ste.equals(ReservedVariable.Z)) {
return true;
}
return false;
}
public boolean acceptFunction(String funcName) {
return true;
}
};
}
firePropertyChange("geometry", oldValue, fieldGeometry);
}
use of cbit.vcell.parser.AutoCompleteSymbolFilter in project vcell by virtualcell.
the class ReactionRule method getAutoCompleteSymbolFilter.
public AutoCompleteSymbolFilter getAutoCompleteSymbolFilter() {
AutoCompleteSymbolFilter stef = new AutoCompleteSymbolFilter() {
public boolean accept(SymbolTableEntry ste) {
if (ste instanceof StructureSize) {
if (((StructureSize) ste).getStructure() != structure) {
return false;
}
} else {
if (structure instanceof Membrane) {
Membrane membrane = (Membrane) structure;
StructureTopology structTopology = getModel().getStructureTopology();
if (ste instanceof SpeciesContext) {
Structure entryStructure = ((SpeciesContext) ste).getStructure();
if (entryStructure != membrane && entryStructure != structTopology.getInsideFeature(membrane) && entryStructure != structTopology.getOutsideFeature(membrane)) {
return false;
}
} else if (ste instanceof MembraneVoltage) {
if (((MembraneVoltage) ste).getMembrane() != membrane) {
return false;
}
}
} else {
if (ste instanceof SpeciesContext) {
Structure entryStructure = ((SpeciesContext) ste).getStructure();
if (entryStructure != structure) {
return false;
}
} else if (ste instanceof MembraneVoltage) {
return false;
}
}
}
return true;
}
public boolean acceptFunction(String funcName) {
return true;
}
};
return stef;
}
use of cbit.vcell.parser.AutoCompleteSymbolFilter in project vcell by virtualcell.
the class ReactionStep method getAutoCompleteSymbolFilter.
public AutoCompleteSymbolFilter getAutoCompleteSymbolFilter() {
AutoCompleteSymbolFilter stef = new AutoCompleteSymbolFilter() {
public boolean accept(SymbolTableEntry ste) {
if (ste instanceof StructureSize) {
if (((StructureSize) ste).getStructure() != structure) {
return false;
}
} else {
if (structure instanceof Membrane) {
Membrane membrane = (Membrane) structure;
StructureTopology structTopology = getModel().getStructureTopology();
if (ste instanceof SpeciesContext) {
Structure entryStructure = ((SpeciesContext) ste).getStructure();
if (entryStructure != membrane && entryStructure != structTopology.getInsideFeature(membrane) && entryStructure != structTopology.getOutsideFeature(membrane)) {
// return false;
return true;
}
} else if (ste instanceof MembraneVoltage) {
if (((MembraneVoltage) ste).getMembrane() != membrane) {
return false;
}
}
} else {
// structure is a compartment
if (ste instanceof SpeciesContext) {
Structure entryStructure = ((SpeciesContext) ste).getStructure();
if (entryStructure != structure) {
// return false;
return true;
}
} else if (ste instanceof MembraneVoltage) {
return false;
}
}
}
return true;
}
public boolean acceptFunction(String funcName) {
return true;
}
};
return stef;
}
use of cbit.vcell.parser.AutoCompleteSymbolFilter in project vcell by virtualcell.
the class OutputFunctionContext method getAutoCompleteSymbolFilter.
public AutoCompleteSymbolFilter getAutoCompleteSymbolFilter() {
AutoCompleteSymbolFilter stef = new AutoCompleteSymbolFilter() {
public boolean accept(SymbolTableEntry ste) {
MathDescription math = getSimulationOwner().getMathDescription();
Variable var = math.getVariable(ste.getName());
return (!(var instanceof InsideVariable || var instanceof OutsideVariable));
}
public boolean acceptFunction(String funcName) {
return true;
}
};
return stef;
}
use of cbit.vcell.parser.AutoCompleteSymbolFilter in project vcell by virtualcell.
the class OutputFunctionContext method getAutoCompleteSymbolFilter.
public AutoCompleteSymbolFilter getAutoCompleteSymbolFilter(final Domain functionDomain) {
AutoCompleteSymbolFilter stef = new AutoCompleteSymbolFilter() {
public boolean accept(SymbolTableEntry ste) {
if (simulationOwner.getGeometry().getDimension() > 0) {
if (functionDomain == null) {
return true;
}
if (ste.getName().endsWith(InsideVariable.INSIDE_VARIABLE_SUFFIX) || ste.getName().endsWith(OutsideVariable.OUTSIDE_VARIABLE_SUFFIX)) {
return false;
}
if (ste instanceof ReservedVariable) {
return true;
}
if (ste instanceof AnnotatedFunction) {
return functionDomain.compareEqual(((AnnotatedFunction) ste).getDomain());
}
if (ste instanceof Variable) {
Variable var = (Variable) ste;
if (var.getDomain() == null) {
return true;
}
GeometryClass gc = simulationOwner.getGeometry().getGeometryClass(functionDomain.getName());
GeometryClass vargc = simulationOwner.getGeometry().getGeometryClass(var.getDomain().getName());
if (gc instanceof SurfaceClass && vargc instanceof SubVolume) {
if (((SurfaceClass) gc).isAdjacentTo((SubVolume) vargc)) {
return true;
} else {
return false;
}
} else {
return var.getDomain().compareEqual(functionDomain);
}
}
}
return true;
}
public boolean acceptFunction(String funcName) {
return true;
}
};
return stef;
}
Aggregations