Android Open Source - markj Array J Dhub






From Project

Back to project page markj.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project markj listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.markjmind.mobile.api.hub;
//from w ww .  ja v a  2s  . c o  m
import java.util.ArrayList;

/**
 * 
 * @author ???
 * @email markjmind@gmail.com
 */
//MultyDataHub 
public class ArrayJDhub {
  private StoreList uriList = new StoreList();
  private Store rvList = new Store();
  public final static String type = "mdType";
  ArrayList uriMdType = new ArrayList();
  ArrayList rvMdType = new ArrayList();
  
//  //????? ??? ????? ???? ??? ???????? ?????
//  public String[] getMultyData(Store param,String key){
//    String[] datas = param.getString(key).split(",");
//    for(int i=0;i<datas.length;i++){
//      datas[i]=datas[i].replaceAll("?",",");
//    }
//    return datas;
//  }
//  
//  //????? ??? ????? ???? ??? ???????? ????
//  public String setMultyData(String[] values){
//    String msg ="";
//    for(int i=0;i<values.length;i++){
//      if(i==0){
//        msg = msg+values[i].replaceAll(",", "?");
//      }else{
//        msg = msg+","+values[i].replaceAll(",", "?");
//      }
//    }
//    return msg;
//  }
  
  //GBN?? ???? ??????????? ???? ????. 
  public StoreList getUriMDStoreList(Store param){
    String[] types = new JDhub().getMultyData(param,ArrayJDhub.type);
    Store[] temps = new Store[types.length];
  
    StoreList dataList = new StoreList();
    String[] keys = param.getKeys();
    for(int i=0;i<temps.length;i++){
      temps[i] = new Store();
      temps[i].add(ArrayJDhub.type,types[i]);
      dataList.add(temps[i]);

    }
    
    for(int j=0;j<keys.length;j++){
      String[] result = getUriTypeData(keys[j]);
      if(result==null){
        continue;
      }
      String type = result[0];
      String dataKey = result[1];
      for(int i=0;i<types.length;i++)
      {
        if(types[i].equals(type)){
          temps[i].add(dataKey, param.getString(keys[j]));
          break;
        }
        
      }
    }
    return dataList;
  }
  
  
  public Store getUriMDStore(Store param){
    String[] types = new JDhub().getMultyData(param,ArrayJDhub.type);
    Store[] temps = new Store[types.length];
  
    Store dataList = new Store();
    String[] keys = param.getKeys();
    for(int i=0;i<temps.length;i++){
      temps[i] = new Store();
      dataList.add(types[i], temps[i]);
    }
    
    for(int j=0;j<keys.length;j++){
      String[] result = getUriTypeData(keys[j]);
      if(result==null){
        continue;
      }
      String type = result[0];
      String dataKey = result[1];
      
      for(int i=0;i<types.length;i++)
      {
        if(types[i].equals(type)){
          temps[i].add(dataKey, param.getString(keys[j]));
          break;
        }
        
      }
    }
    return dataList;
  }
  
  private boolean isSameType(String[] types, String type){
    for(int i=0;i<types.length;i++){
      if(types[i].equals(type)){
        return true;
      }
    }
    return false;
  }
  //gbn???? ?????.
  public String[] getUriMDKeys(Store param){
    String[] gbns = new JDhub().getMultyData(param, ArrayJDhub.type);
    return gbns;
  }
  public String[] getUriTypeData(String data){
    String values[] = new String[2];
    int start = data.indexOf("_");
    if(start<0){
      return null;
    }
    values[0] = data.substring(0,start);
    values[1] = data.substring(start+1,data.length()); 
    return values;
  }
  
  public void addUri(String MDhubType_name,Store param){
    String[] keys = param.getKeys();
    Store temp = new Store();
    uriMdType.add(MDhubType_name);
    for(int i=0;i<keys.length;i++){
      String gbnKeys = MDhubType_name+"_"+keys[i];
      temp.add(gbnKeys, param.get(keys[i]));
    }
    uriList.add(temp);
  }
  public String getUriString(){
    
    String[] types = new String[uriMdType.size()];
    for(int i=0;i<types.length;i++){
      types[i] = (String)uriMdType.get(i);
    }
    Store store = new Store();
    JDhub jd = new JDhub();
    store.add(ArrayJDhub.type,jd.setMultyData(types));
    uriList.add(0,store);
    String parameters = "";
    for(int i=0;i<this.uriList.size();i++){
      parameters = parameters+this.sendString(uriList.getStore(i));
      if(i+1!=this.uriList.size()){
        parameters = parameters+"&";
      }
    }
    return parameters;
  }
  private String sendString(Store store){
    String[] keys = store.getKeys();
    String msg = "";
    for(int j=0;j<keys.length;j++){
      msg = msg+keys[j]+"="+store.getString(keys[j]);
      if(j+1!=keys.length){
        msg=msg+"&";
      }
    }
    return msg;
  }
  
  //???? ???????? ??
  public void addRv(String MDhubType_name,Store store){
    StoreList temp = new StoreList();
    temp.add(store);
    rvList.add(MDhubType_name, temp);
  }
  public void addRv(String MDhubType_name,StoreList sl){
    rvList.add(MDhubType_name, sl);
  }
  
  public String getRvString(){
    String msg = "";
    JDhub jd = new JDhub();
    StoreList tempList = new StoreList();
    String[] rvKeys =  rvList.getKeys();
    if(rvList.size()>0){
      Store mdKeys = new Store();
      mdKeys.add("mdKeys",jd.setMultyData(rvKeys));
      tempList.add(mdKeys);
    }else{
      return "";
    }
    for(int i=0;i<rvKeys.length;i++){
      StoreList sl = (StoreList)rvList.get(rvKeys[i]);
      for(int j=0;j<sl.size();j++){
        Store store = new Store();
        store.add(ArrayJDhub.type,rvKeys[i]);
        store.putAll(sl.getStore(j));
        tempList.add(store);
        
      }
    }
    
    msg = jd.sendString(tempList);
    return msg;
  }
  
  public Store getRvStore(String msg){
    JDhub jd = new JDhub();
    StoreList result = jd.receiveStoreList(msg);
    if(result==null || result.size()<=0){
      return null;
    }
    String[] mdKeys = jd.getMultyData(result.getStore(0), "mdKeys");
    StoreList[] slList = new StoreList[mdKeys.length];
    for(int i=0;i<slList.length;i++){
      slList[i]= new StoreList();
    }
    for(int i=1;i<result.size();i++){
      Store temp = result.getStore(i);
      for(int j=0;j<mdKeys.length;j++){
        if(mdKeys[j].equals(temp.getString(ArrayJDhub.type))){
          temp.remove(ArrayJDhub.type);
          slList[j].add(temp);
          break;
        }
      }
    }
    Store returnValue = new Store();
    for(int i=0;i<mdKeys.length;i++){
      returnValue.add(mdKeys[i], slList[i]);
    }
    return returnValue;
  }
  
    
}




Java Source Code List

com.markjmind.mobile.api.android.controller.JwAsyncTask.java
com.markjmind.mobile.api.android.controller.JwMapperException.java
com.markjmind.mobile.api.android.controller.JwMemberMapper.java
com.markjmind.mobile.api.android.controller.JwStringID.java
com.markjmind.mobile.api.android.controller.JwViewController.java
com.markjmind.mobile.api.android.controller.JwViewerCache.java
com.markjmind.mobile.api.android.controller.JwViewer.java
com.markjmind.mobile.api.android.controller.Jwc.java
com.markjmind.mobile.api.android.controller.OnClickListenerReceiver.java
com.markjmind.mobile.api.android.controller.ViewerXmlMapper.java
com.markjmind.mobile.api.android.exception.JwErrorCode.java
com.markjmind.mobile.api.android.exception.JwException.java
com.markjmind.mobile.api.android.json.JSONMsgString.java
com.markjmind.mobile.api.android.json.JwJOSNTreeArray.java
com.markjmind.mobile.api.android.json.JwJSONReader.java
com.markjmind.mobile.api.android.ui.JwAnimation.java
com.markjmind.mobile.api.android.ui.JwGroup.java
com.markjmind.mobile.api.android.ui.JwMenu.java
com.markjmind.mobile.api.android.ui.JwOnGroupSelect.java
com.markjmind.mobile.api.android.ui.JwTabGroup.java
com.markjmind.mobile.api.android.ui.JwTouchGroupListener.java
com.markjmind.mobile.api.android.ui.JwTouchGroup.java
com.markjmind.mobile.api.android.ui.JwTouchMotionGroupLisener.java
com.markjmind.mobile.api.android.ui.JwTouchMotionGroup.java
com.markjmind.mobile.api.android.ui.drawgraph.GraphBoard.java
com.markjmind.mobile.api.android.ui.drawgraph.GraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.HBackLineSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.LineGraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.PieGraph.java
com.markjmind.mobile.api.android.ui.drawgraph.RectGraphSkin.java
com.markjmind.mobile.api.android.ui.drawgraph.SimpleStyle.java
com.markjmind.mobile.api.android.ui.drawgraph.TextArraySkin.java
com.markjmind.mobile.api.android.ui.drawgraph.VBackLineSkin.java
com.markjmind.mobile.api.android.ui.graph.Arc.java
com.markjmind.mobile.api.android.ui.graph.BarElement.java
com.markjmind.mobile.api.android.ui.graph.BarLayout.java
com.markjmind.mobile.api.android.ui.graph.Bar.java
com.markjmind.mobile.api.android.ui.graph.IPieSkin.java
com.markjmind.mobile.api.android.ui.graph.LineLayout.java
com.markjmind.mobile.api.android.ui.graph.MeasureLayout.java
com.markjmind.mobile.api.android.ui.graph.PieArcRoundSkin.java
com.markjmind.mobile.api.android.ui.graph.PieLayout.java
com.markjmind.mobile.api.android.ui.graph.PiePercentSkin.java
com.markjmind.mobile.api.android.ui.view.JwBaseDropDown.java
com.markjmind.mobile.api.android.ui.view.JwDropDown.java
com.markjmind.mobile.api.android.ui.view.JwSlidingLayout.java
com.markjmind.mobile.api.android.ui.view.JwWheelView.java
com.markjmind.mobile.api.android.ui.view.StickerListener.java
com.markjmind.mobile.api.android.ui.view.StickerView.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewAutoScale.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewFonts.java
com.markjmind.mobile.api.android.ui.view.textview.JwTextViewWrapScale.java
com.markjmind.mobile.api.android.ui.wrapper.JwAlertDialog.java
com.markjmind.mobile.api.android.ui.wrapper.JwToast.java
com.markjmind.mobile.api.android.util.JwFile.java
com.markjmind.mobile.api.android.util.JwPreferenceList.java
com.markjmind.mobile.api.android.util.JwPreference.java
com.markjmind.mobile.api.android.util.JwSound.java
com.markjmind.mobile.api.android.util.JwTextUtils.java
com.markjmind.mobile.api.android.util.PhoneInfo.java
com.markjmind.mobile.api.android.util.WebConnection.java
com.markjmind.mobile.api.android.xml.JwDomHandler.java
com.markjmind.mobile.api.android.xml.JwDomLoader.java
com.markjmind.mobile.api.android.xml.JwEditElementHandler.java
com.markjmind.mobile.api.android.xml.JwXmlLoader.java
com.markjmind.mobile.api.android.xml.JwXmlResoure.java
com.markjmind.mobile.api.hub.ArrayJDhub.java
com.markjmind.mobile.api.hub.DBhub.java
com.markjmind.mobile.api.hub.JDhub.java
com.markjmind.mobile.api.hub.Loader.java
com.markjmind.mobile.api.hub.StoreList.java
com.markjmind.mobile.api.hub.Store.java