/** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.example.sequences.impl; import com.example.sequences.MixedQuote; import commonj.sdo.Sequence; import commonj.sdo.Type; import commonj.sdo.helper.TypeHelper; import java.math.BigDecimal; import java.util.Collection; import java.util.List; import org.apache.tuscany.sdo.impl.DataObjectBase; import org.apache.tuscany.sdo.util.BasicSequence; /** * * An implementation of the model object 'Mixed Quote'. * *

* The following features are implemented: *

*

* * @generated */ public class MixedQuoteImpl extends DataObjectBase implements MixedQuote { /** * The feature id for the 'Mixed' attribute list. * * * @generated * @ordered */ public final static int MIXED = 0; /** * The cached value of the '{@link #getMixed() Mixed}' attribute list. * * * @see #getMixed() * @generated * @ordered */ // How to get BasicSequence from Sequence? protected BasicSequence mixed = null; /** * The feature id for the 'Symbol' attribute. * * * @generated * @ordered */ public final static int SYMBOL = 1; /** * The default value of the '{@link #getSymbol() Symbol}' attribute. * * * @see #getSymbol() * @generated * @ordered */ protected static final String SYMBOL_DEFAULT_ = null; /** * The feature id for the 'Company Name' attribute. * * * @generated * @ordered */ public final static int COMPANY_NAME = 2; /** * The default value of the '{@link #getCompanyName() Company Name}' attribute. * * * @see #getCompanyName() * @generated * @ordered */ protected static final String COMPANY_NAME_DEFAULT_ = null; /** * The feature id for the 'Price' attribute. * * * @generated * @ordered */ public final static int PRICE = 3; /** * The default value of the '{@link #getPrice() Price}' attribute. * * * @see #getPrice() * @generated * @ordered */ protected static final BigDecimal PRICE_DEFAULT_ = null; /** * The feature id for the 'Open1' attribute. * * * @generated * @ordered */ public final static int OPEN1 = 4; /** * The default value of the '{@link #getOpen1() Open1}' attribute. * * * @see #getOpen1() * @generated * @ordered */ protected static final BigDecimal OPEN1_DEFAULT_ = null; /** * The feature id for the 'High' attribute. * * * @generated * @ordered */ public final static int HIGH = 5; /** * The default value of the '{@link #getHigh() High}' attribute. * * * @see #getHigh() * @generated * @ordered */ protected static final BigDecimal HIGH_DEFAULT_ = null; /** * The feature id for the 'Low' attribute. * * * @generated * @ordered */ public final static int LOW = 6; /** * The default value of the '{@link #getLow() Low}' attribute. * * * @see #getLow() * @generated * @ordered */ protected static final BigDecimal LOW_DEFAULT_ = null; /** * The feature id for the 'Volume' attribute. * * * @generated * @ordered */ public final static int VOLUME = 7; /** * The feature id for the 'Change1' attribute. * * * @generated * @ordered */ public final static int CHANGE1 = 8; /** * The feature id for the 'Quotes' containment reference list. * * * @generated * @ordered */ public final static int QUOTES = 9; /** * * * @generated */ protected MixedQuoteImpl() { super(); } /** * * * @generated */ public Type getType() { return TypeHelper.INSTANCE.getType(MixedQuote.class); //TBD Generate a more efficient implementation } /** * * * @generated */ public Sequence getMixed() { if (mixed == null) { mixed = createSequence(MIXED); } return mixed; } /** * * * @generated */ public String getSymbol() { return (String)get(getMixed(), getType(), SYMBOL); } /** * * * @generated */ public void setSymbol(String newSymbol) { set(getMixed(), getType(), SYMBOL, newSymbol); } /** * * * @generated */ public String getCompanyName() { return (String)get(getMixed(), getType(), COMPANY_NAME); } /** * * * @generated */ public void setCompanyName(String newCompanyName) { set(getMixed(), getType(), COMPANY_NAME, newCompanyName); } /** * * * @generated */ public BigDecimal getPrice() { return (BigDecimal)get(getMixed(), getType(), PRICE); } /** * * * @generated */ public void setPrice(BigDecimal newPrice) { set(getMixed(), getType(), PRICE, newPrice); } /** * * * @generated */ public BigDecimal getOpen1() { return (BigDecimal)get(getMixed(), getType(), OPEN1); } /** * * * @generated */ public void setOpen1(BigDecimal newOpen1) { set(getMixed(), getType(), OPEN1, newOpen1); } /** * * * @generated */ public BigDecimal getHigh() { return (BigDecimal)get(getMixed(), getType(), HIGH); } /** * * * @generated */ public void setHigh(BigDecimal newHigh) { set(getMixed(), getType(), HIGH, newHigh); } /** * * * @generated */ public BigDecimal getLow() { return (BigDecimal)get(getMixed(), getType(), LOW); } /** * * * @generated */ public void setLow(BigDecimal newLow) { set(getMixed(), getType(), LOW, newLow); } /** * * * @generated */ public double getVolume() { return ((Double)get(getMixed(), getType(), VOLUME)).doubleValue(); } /** * * * @generated */ public void setVolume(double newVolume) { set(getMixed(), getType(), VOLUME, new Double(newVolume)); } /** * * * @generated */ public void unsetVolume() { unset(getMixed(), getType(), VOLUME); } /** * * * @generated */ public boolean isSetVolume() { return isSet(getMixed(), getType(), VOLUME); } /** * * * @generated */ public double getChange1() { return ((Double)get(getMixed(), getType(), CHANGE1)).doubleValue(); } /** * * * @generated */ public void setChange1(double newChange1) { set(getMixed(), getType(), CHANGE1, new Double(newChange1)); } /** * * * @generated */ public void unsetChange1() { unset(getMixed(), getType(), CHANGE1); } /** * * * @generated */ public boolean isSetChange1() { return isSet(getMixed(), getType(), CHANGE1); } /** * * * @generated */ public List getQuotes() { return getList(getMixed(), getType(), QUOTES); } /** * * * @generated */ public ChangeContext inverseRemove(Object otherEnd, int propertyIndex, ChangeContext changeContext) { switch (propertyIndex) { case MIXED: return removeFromSequence(getMixed(), otherEnd, changeContext); case QUOTES: return removeFromList(getQuotes(), otherEnd, changeContext); } return super.inverseRemove(otherEnd, propertyIndex, changeContext); } /** * * * @generated */ public Object get(int propertyIndex, boolean resolve) { switch (propertyIndex) { case MIXED: // XXX query introduce coreType as an argument? -- semantic = if true -- coreType - return the core EMF object if value is a non-EMF wrapper/view //if (coreType) return getMixed(); case SYMBOL: return getSymbol(); case COMPANY_NAME: return getCompanyName(); case PRICE: return getPrice(); case OPEN1: return getOpen1(); case HIGH: return getHigh(); case LOW: return getLow(); case VOLUME: return new Double(getVolume()); case CHANGE1: return new Double(getChange1()); case QUOTES: return getQuotes(); } return super.get(propertyIndex, resolve); } /** * * * @generated */ public void set(int propertyIndex, Object newValue) { switch (propertyIndex) { case MIXED: setSequence(getMixed(), newValue); return; case SYMBOL: setSymbol((String)newValue); return; case COMPANY_NAME: setCompanyName((String)newValue); return; case PRICE: setPrice((BigDecimal)newValue); return; case OPEN1: setOpen1((BigDecimal)newValue); return; case HIGH: setHigh((BigDecimal)newValue); return; case LOW: setLow((BigDecimal)newValue); return; case VOLUME: setVolume(((Double)newValue).doubleValue()); return; case CHANGE1: setChange1(((Double)newValue).doubleValue()); return; case QUOTES: getQuotes().clear(); getQuotes().addAll((Collection)newValue); return; } super.set(propertyIndex, newValue); } /** * * * @generated */ public void unset(int propertyIndex) { switch (propertyIndex) { case MIXED: unsetSequence(getMixed()); return; case SYMBOL: setSymbol(SYMBOL_DEFAULT_); return; case COMPANY_NAME: setCompanyName(COMPANY_NAME_DEFAULT_); return; case PRICE: setPrice(PRICE_DEFAULT_); return; case OPEN1: setOpen1(OPEN1_DEFAULT_); return; case HIGH: setHigh(HIGH_DEFAULT_); return; case LOW: setLow(LOW_DEFAULT_); return; case VOLUME: unsetVolume(); return; case CHANGE1: unsetChange1(); return; case QUOTES: getQuotes().clear(); return; } super.unset(propertyIndex); } /** * * * @generated */ public boolean isSet(int propertyIndex) { switch (propertyIndex) { case MIXED: // KDK - should this be !isSequenceEmpty? return mixed != null && !isSequenceEmpty(getMixed()); case SYMBOL: return SYMBOL_DEFAULT_ == null ? getSymbol() != null : !SYMBOL_DEFAULT_.equals(getSymbol()); case COMPANY_NAME: return COMPANY_NAME_DEFAULT_ == null ? getCompanyName() != null : !COMPANY_NAME_DEFAULT_.equals(getCompanyName()); case PRICE: return PRICE_DEFAULT_ == null ? getPrice() != null : !PRICE_DEFAULT_.equals(getPrice()); case OPEN1: return OPEN1_DEFAULT_ == null ? getOpen1() != null : !OPEN1_DEFAULT_.equals(getOpen1()); case HIGH: return HIGH_DEFAULT_ == null ? getHigh() != null : !HIGH_DEFAULT_.equals(getHigh()); case LOW: return LOW_DEFAULT_ == null ? getLow() != null : !LOW_DEFAULT_.equals(getLow()); case VOLUME: return isSetVolume(); case CHANGE1: return isSetChange1(); case QUOTES: return !getQuotes().isEmpty(); } return super.isSet(propertyIndex); } /** * * * @generated */ public String toString() { if (isProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (mixed: "); result.append(mixed); result.append(')'); return result.toString(); } } //MixedQuoteImpl