(function(app) {
  'use strict';

  var jCore = require('jcore');
  var helper = app.helper || require('../helper.js');

  var LockRelation = helper.inherits(function(props) {
    this.type = props.type;
    this.unit = props.unit;
    this.wire = props.wire;
  }, jCore.Relation);

  LockRelation.prototype.equal = function(other) {
    return (!!other && Object.keys(this).every(function(key) {
      return helper.equal(this[key], other[key]);
    }.bind(this)));
  };

  LockRelation.prototype.unitPosition = function() {
    var methodName = LockRelation.TYPE_POSITION_TABLE[this.type].methodName;
    return this.unit[methodName]();
  };

  LockRelation.prototype.wirePosition = function(position) {
    var wire = this.wire;
    var positionType = LockRelation.TYPE_POSITION_TABLE[this.type].type;
    wire[positionType + 'X'](position.x);
    wire[positionType + 'Y'](position.y);
  };

  LockRelation.prototype.update = function() {
    this.wirePosition(this.unitPosition());
  };

  LockRelation.TYPE_PLUG = 'plug';
  LockRelation.TYPE_SOCKET = 'socket';

  LockRelation.TYPE_POSITION_TABLE = (function() {
    var table = {};
    table[LockRelation.TYPE_PLUG] = { methodName: 'portPlugPosition', type: 'source' };
    table[LockRelation.TYPE_SOCKET] = { methodName: 'portSocketPosition', type: 'target' };
    return table;
  })();

  if (typeof module !== 'undefined' && module.exports) {
    module.exports = LockRelation;
  } else {
    app.LockRelation = LockRelation;
  }
})(this.app || (this.app = {}));

@@ -527,103 +527,44 @@
     
-var methodName = LockRelation.TYPE_POSITION_TABLE%5Bthis.type%5D.methodName;%0A    return this.unit%5Bm
+return this.unit%5Bthis.type.positionM
 etho
@@ -693,53 +693,27 @@
 e = 
-LockRelation.TYPE_POSITION_TABLE%5Bthis.type%5D.t
+this.type.positionT
 ype;
@@ -931,166 +931,23 @@
 G = 
-'plug';%0A  LockRelation.TYPE_SOCKET = 'socket';%0A%0A  LockRelation.TYPE_POSITION_TABLE = (function() %7B%0A    var table = %7B%7D;%0A    table%5BLockRelation.TYPE_PLUG%5D = %7B m
+%7B%0A    positionM
 etho
@@ -968,26 +968,38 @@
 ugPosition',
- t
+%0A    positionT
 ype: 'source
@@ -1003,22 +1003,18 @@
 rce'
+,%0A 
  %7D;%0A
- 
+%0A
   
- table%5B
 Lock
@@ -1037,15 +1037,26 @@
 CKET
-%5D
  = %7B
- m
+%0A    positionM
 etho
@@ -1087,51 +1087,40 @@
 on',
- type: 'target' %7D;%0A    return table;
+%0A    positionType: 'target',
 %0A  %7D
-)()
 ;%0A%0A 

Modify definition of a type of lock-relation