Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangLong


   */
  public static OtpErlangObject stringToList(OtpErlangObject obj) {
    String str = ((OtpErlangString) obj).stringValue();
    OtpErlangObject[] listOfNumbers = new OtpErlangObject[str.length()];
    for (int num = 0; num < str.length(); ++num)
      listOfNumbers[num] = new OtpErlangLong(str.charAt(num));
    return new OtpErlangList(listOfNumbers);
  }
View Full Code Here


      return singleton;
    }

    @Override
    public void dump(OtpErlangObject arg, StringBuffer resultHolder) {
      OtpErlangLong longValue = (OtpErlangLong) arg;
      resultHolder.append(longValue.longValue());
    }
View Full Code Here

      if (partB == null && partExp == null) {// integer/long
        if (partA.startsWith("+"))
          partA = partA.substring(1);
        long outcome = Long.parseLong(partA);
        if (outcome > Integer.MAX_VALUE || outcome < Integer.MIN_VALUE)
          result = new OtpErlangLong(outcome);
        else
          result = new OtpErlangInt((int) outcome);
      } else {// floating - point number.
        String textToParse = partA + "."
            + (partB == null ? "0" : partB)
View Full Code Here

          else if (outcome.getClass().equals(String.class))
            value = new OtpErlangAtom((String) outcome);
          else if (outcome.getClass().equals(Integer.class))
            value = new OtpErlangInt(((Integer) outcome).intValue());
          else if (outcome.getClass().equals(Long.class))
            value = new OtpErlangLong(((Long) outcome).longValue());
          else
            value = new OtpErlangAtom(outcome.toString());

          nameToValue.add(new OtpErlangTuple(new OtpErlangObject[] {
              new OtpErlangAtom(varName), value }));
View Full Code Here

          OtpErlangObject stateNamesAsObject = message.elementAt(startFrom+1);
          setStateNamesToBeIgnored(((LayoutOptions)fsmPicture.getUserDatum(JUConstants.LAYOUTOPTIONS)),stateNamesAsObject);
        }
        if (message.arity() > startFrom+2)
        {
          OtpErlangLong windowNum = ((OtpErlangLong)message.elementAt(startFrom+2));windowNumber = windowNum.intValue();
        }
        if (message.arity() > startFrom+3)
        {
          OtpErlangLong abstraction = ((OtpErlangLong)message.elementAt(startFrom+3));
          ((LayoutOptions)fsmPicture.getUserDatum(JUConstants.LAYOUTOPTIONS)).componentsToPick=abstraction.intValue();
        }
      }
      return windowNumber;
    }
View Full Code Here

* @version $Rev$ $Date$
*/
public class LongTypeHelper implements TypeHelper {

  public OtpErlangObject toErlang(Object object) {
    return new OtpErlangLong((Long) object);
  }
View Full Code Here

            break;
        case STRING:
            result = new OtpErlangString(text);
            break;
        case INTEGER:
            result = new OtpErlangLong(Long.parseLong(text));
            break;
        case PLACEHOLDER:
            result = new OtpFormatPlaceholder(text);
            break;
        case TUPLESTART:
View Full Code Here

        StringBuilder sb = sb0;
        if (sb.length() >= maxLength) {
            return sb;
        }
        if (o instanceof OtpErlangLong) {
            final OtpErlangLong l = (OtpErlangLong) o;
            try {
                sb.append(l.charValue());
            } catch (final OtpErlangRangeException e) {
            }
        } else if (o instanceof OtpErlangString) {
            final OtpErlangString s = (OtpErlangString) o;
            sb.append(s.stringValue());
        } else if (o instanceof OtpErlangList) {
            final OtpErlangList l = (OtpErlangList) o;
            for (final OtpErlangObject i : l) {
                if (sb.length() < maxLength) {
                    ioListToStringBuilder(i, sb, maxLength);
                }
            }
            if (sb.length() < maxLength) {
                ioListToStringBuilder(l.getLastTail(), sb, maxLength);
            }
        } else if (o instanceof OtpErlangBinary) {
            final OtpErlangBinary b = (OtpErlangBinary) o;
            String s = decode(b.binaryValue(), Charsets.UTF_8);
            if (s == null) {
View Full Code Here

        return sb;
    }

    public static int getIntegerValue(final OtpErlangObject object, final int defaultValue) {
        if (object instanceof OtpErlangLong) {
            final OtpErlangLong l = (OtpErlangLong) object;
            try {
                return l.intValue();
            } catch (final OtpErlangRangeException e) {
            }
        }
        if (object instanceof OtpErlangInt) {
            final OtpErlangInt l = (OtpErlangInt) object;
            try {
                return l.intValue();
            } catch (final OtpErlangRangeException e) {
            }
        }
        return defaultValue;
    }
View Full Code Here

            final OtpErlangString erlangString = (OtpErlangString) o;
            final int[] codePoints = OtpErlangString.stringToCodePoints(erlangString
                    .stringValue());
            final OtpErlangObject elements[] = new OtpErlangObject[codePoints.length];
            for (int i = 0; i < codePoints.length; i++) {
                elements[i] = new OtpErlangLong(codePoints[i]);
            }
            return new OtpErlangList(elements);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangLong

Copyright © 2018 www.massapicom. 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.