/home/caleb/ASDV-Java/Semester 2/Assignments/MP5_CalebFontenot/src/main/java/com/calebfontenot/mp5_calebfontenot/FD.java |
package com.calebfontenot.mp5_calebfontenot;
public class FD
{
private String lhs;
private String rhs;
lhs
rhs
public FD(String lhs, String rhs)
throws IllegalArgumentException
{
if (lhs == null || rhs == null )
throw new IllegalArgumentException( "the LHS and/or RHS cannot be null.");
if (lhs.length() < 1 || rhs.length() < 1 )
throw new IllegalArgumentException( "the LHS and/or RHS cannot be of lenght less than 1.");
this.lhs = lhs;
this.rhs = rhs;
}
public String getRhs()
{
return rhs;
}
rhs
public void setRhs(String rhs)
{
this.rhs = rhs;
}
public String getLhs()
{
return lhs;
}
lhs
public void setLhs(String lhs)
{
this.lhs = lhs;
}
@Override
public String toString()
{
return lhs + " -> " + rhs;
}
public FD[] decomposeRightHandSide()
{
FD[] fdDecomosition = new FD[this.rhs.length()];
for (int i = 0; i < this.rhs.length(); ++i)
{
fdDecomosition[i] = new FD(this.lhs, Character.toString(rhs.charAt(i)));
}
return fdDecomosition;
}
}