Home | History | Annotate | Download | only in layout
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.ide.common.layout;
     17 
     18 import com.android.annotations.NonNull;
     19 import com.android.ide.common.api.IDragElement.IDragAttribute;
     20 import com.android.ide.common.api.INode.IAttribute;
     21 import com.android.ide.common.xml.XmlAttributeSortOrder;
     22 
     23 /** Test/mock implementation of {@link IAttribute} and {@link IDragAttribute} */
     24 public class TestAttribute implements IAttribute, IDragAttribute {
     25     private String mUri;
     26 
     27     private String mName;
     28 
     29     private String mValue;
     30 
     31     public TestAttribute(String mUri, String mName, String mValue) {
     32         super();
     33         this.mName = mName;
     34         this.mUri = mUri;
     35         this.mValue = mValue;
     36     }
     37 
     38     @Override
     39     public @NonNull String getName() {
     40         return mName;
     41     }
     42 
     43     @Override
     44     public @NonNull String getUri() {
     45         return mUri;
     46     }
     47 
     48     @Override
     49     public @NonNull String getValue() {
     50         return mValue;
     51     }
     52 
     53     @Override
     54     public String toString() {
     55         return "TestAttribute [name=" + mName + ", uri=" + mUri + ", value=" + mValue + "]";
     56     }
     57 
     58     public int compareTo(IDragAttribute o) {
     59         return XmlAttributeSortOrder.compareAttributes(mName, o.getName());
     60     }
     61 }