Package fb.xml.mgt

Source Code of fb.xml.mgt.FBMECC

// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name:   FBMECC.java

package fb.xml.mgt;

import fb.datatype.ANY;
import fb.xml.FBElementImpl;
import fb.xml.XMLException;
import cip.StringTokenizerTCS;

public class FBMECC extends FBElementImpl
{

    public FBMECC()
    {
    }

    public FBMECC(String name, String type, String value)
        throws XMLException
    {
        try { setAttribute("Name", name); } catch (Exception e) {}
        try { setAttribute("Type", type); } catch (Exception e) {}
        try { setAttribute("Value", value); } catch (Exception e) {}
    }

    protected boolean checkAttribute(int i, String aname, String value)
    {
        if(aname.equals("Name"))
            return isHierName(value);
        if(aname.equals("Type"))
            return value.equals("*") || ANY.isIECidentifier(value);
        return aname.equals("Value");
    }

    public String elementName()
    {
        return "ECCState";
    }

    public String[] getAttributeNames()
    {
        String ans[] = {
            "Name", "Type", "Value"
        };
        return ans;
    }

    public String getType()
    {
        try {
            return getAttribute("Type");
        } catch (Exception ex){
            return null;
        }
    }

    public void setType(String s)
    {
        try {
            setAttribute("Type", s);
        } catch (Exception ex){
        }
    }

    public String getEccValue()
    {
        try {
            return getAttribute("Value");
        } catch (Exception ex){
            return null;
        }
    }

    public void getEccValue(String s)
    {
        try {
            setAttribute("Value", s);
        } catch (Exception ex){
        }
    }

    public String getName()
    {
        try {
            return getAttribute("Name");
        } catch (Exception ex){
            return null;
        }
    }

    public void setName(String s)
    {
        try {
            setAttribute("Name", s);
        } catch (Exception ex){
        }
    }

    public static boolean isHierName(String value)
    {
        if(value.equals("*"))
            return true;
        for(StringTokenizerTCS toker = new StringTokenizerTCS(value, ".", true); toker.hasMoreTokens();)
        {
            String t = toker.nextToken();
            if(t.startsWith("$") || t.startsWith("_"))
                return true;
            if(!ANY.isIECidentifier(t))
                return false;
            if(toker.hasMoreTokens())
            {
                if(!toker.nextToken().equals("."))
                    return false;
                if(!toker.hasMoreTokens())
                    return false;
            }
        }

        return true;
    }

    public String toString()
    {
        return "ECCState "+getName()+" : "+getType()+" : "+getEccValue();
    }
}
TOP

Related Classes of fb.xml.mgt.FBMECC

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.