Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.49 KB | None | 0 0
  1. sealed class DiffOp {
  2.  
  3. data class Insert(val oldPos: Int, val newPos: Int) : DiffOp()
  4. data class Delete(val oldPos: Int) : DiffOp()
  5.  
  6. }
  7.  
  8. fun <T> diff(list1: MutableList<T>, list2: MutableList<T>, i: Int = 0, j: Int = 0): List<DiffOp> {
  9.  
  10. val N = list1.size
  11. val M = list2.size
  12. val L = N + M
  13. val Z = 2 * min(N, M) + 2
  14.  
  15. when {
  16. N > 0 && M > 0 -> {
  17. val w = N - M
  18. val g = ArrayList<Int>(Z).also {
  19. for (x in 0 until Z) {
  20. it.add(0)
  21. }
  22. }
  23. val p = ArrayList<Int>(Z).also {
  24. for (x in 0 until Z) {
  25. it.add(0)
  26. }
  27. }
  28. for (h in 0..(L / 2 + if (L % 2 != 0) 1 else 0) + 1) {
  29. for (r in 0..2) {
  30. val (c, d, o, m) = if (r == 0) Tuple4(g, p, 1, 1) else Tuple4(p, g, 0, -1)
  31. for (k in (-(h - 2 * max(0, h - M))..(h - 2 * max(0, h - N) + 1)) step 2) {
  32. var a = if (k == -h or k != h and c.cyclicAt((k - 1) % Z) < c.cyclicAt(k + 1 % Z))
  33. c.cyclicAt((k + 1) % Z)
  34. else
  35. c.cyclicAt((k - 1) % Z) + 1
  36. var b = a - k
  37. val s = a
  38. val t = b
  39. while (a < N && b < M &&
  40. list1.cyclicAt((1 - o) * N + m * a + (o - 1)) == list2.cyclicAt((1 - o) * M + m * b + (o - 1))) {
  41. a += 1
  42. b += 1
  43. }
  44. c.cyclicSet(k % Z, a)
  45. val z = -(k - w)
  46. if (L % 2 == o && z >= -(h - o) && z <= h - o && c.cyclicAt(k % Z) + d.cyclicAt(z % Z) >= N) {
  47. val (D, x, y, u, v) = if (o == 1)
  48. Tuple5(2 * h - 1, s, t, a, b)
  49. else
  50. Tuple5(2 * h, N - a, M - b, N - s, M - t)
  51. return when {
  52. D > 1 || x != u && y != v -> diff(
  53. list1.subList(0, x),
  54. list2.subList(0, y), i, j) +
  55. diff(
  56. list1.subList(u, N),
  57. list2.subList(v, M), i + u, j + v)
  58. M > N -> diff(mutableListOf(), list2.subList(N, M), i + N, j + N)
  59. M < N -> diff(list1.subList(M, N), mutableListOf(), i + M, j + M)
  60. else -> emptyList()
  61. }
  62. }
  63. }
  64. }
  65. }
  66. }
  67. N > 0 -> return (0..N).map { n ->
  68. DiffOp.Delete(i + n)
  69. }
  70. else -> return (0..M).map { n ->
  71. DiffOp.Insert(i, j + n)
  72. }
  73. }
  74.  
  75. return emptyList()
  76.  
  77. }
  78. <div class="method">
  79. <div>
  80. <h3 class="method-title">Mathod</h3>
  81. <hr class="line-method">
  82. </div>
  83. <mat-tab-group animationDuration="6ms">
  84. <mat-tab label="First">
  85. <ng-template mat-tab-label>
  86. <button type="button" class="btn btn-white active">Personal Info</button>
  87. </ng-template>
  88. <div class="container tab-padd">
  89. <div class="row">
  90. <div class="col-md-6">
  91. <div class="form-group">
  92. <div class="sub-form">
  93. <label for="firstName">First Name</label>
  94. <input type="text" class="form-control shot" name="firstName"
  95. required />
  96. </div>
  97. <div class="sub-form">
  98. <label class="right-inline" for="lastName">Last Name</label>
  99. <input value="" class="form-control shot" name="lastName"
  100. required />
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </mat-tab>
  107. <mat-tab label="Second">
  108. <ng-template mat-tab-label>
  109. <button type="button" class="btn btn-white active">Another Info</button>
  110. </ng-template>
  111. <div class="container tab-padd">
  112. <div class="row">
  113. <div class="col-md-6"> </div>
  114. </div>
  115. </div>
  116. </mat-tab>
  117. </mat-tab-group>
  118.  
  119. .method-title{
  120. padding: 12px 84px;
  121. width: max-content;
  122. }
  123.  
  124. .line-title{
  125. margin-top: 4rem !important;
  126. /* margin-bottom: 3rem !important; */
  127. width: 22%;
  128. margin-left:-14px;
  129. text-align:left;
  130. }
  131.  
  132. .justify-content-left{
  133. padding-left: 85px;
  134. }
  135.  
  136. .radio-group{
  137. display: flex;
  138. flex-direction: row;
  139. margin: 15px 0;
  140. }
  141.  
  142. .justify-content-between{
  143. justify-content: space-between;
  144. display: flex;
  145. }
  146.  
  147. .border{
  148. width: calc(100% - 46rem);
  149. text-align: left;
  150. margin-left: 4px;
  151. }
  152.  
  153. #container {
  154. display: flex;
  155. justify-content: space-between; /* Can be changed in the live sample */
  156. width: 40%;
  157. padding-left: 1rem;
  158. }
  159.  
  160. .space-bottom-2{
  161. padding-bottom: 2rem;
  162. }
  163.  
  164. .custome-row{
  165. display: contents !important;
  166. line-height: 6px;
  167. }
  168.  
  169. .method{
  170. display: flex;
  171.  
  172. }
  173.  
  174. .line-method{
  175. margin-top: -1.8rem !important;
  176. width: 78%;
  177. margin-left: -12px;
  178. text-align: left;
  179. }
  180.  
  181. .mat-tab-label::ng-deep {
  182. width: 900rem !important;
  183. }
  184.  
  185. /* form specific formatting */
  186. .tab-padd{
  187. padding-top: 24px !important;
  188. column-span: all;
  189. }
  190. .form-group {
  191. display: flex;
  192. flex-direction: row;
  193. }
  194.  
  195. .sub-form{
  196. flex-direction: column;
  197. }
  198.  
  199. .form-group label {
  200. flex: none;
  201. display: block;
  202. width: 125px;
  203. font-weight: bold;
  204. font-size: 1em;
  205. white-space: nowrap;
  206. }
  207. .form-group label.left-inline {
  208. text-align: left;
  209. padding-right: 8px;
  210. padding-left: 10px;
  211. width: auto;
  212. }
  213.  
  214. .form-group .shot{
  215. width: 20rem
  216. }
  217.  
  218. .form-group .long{
  219. width: 40rem
  220. }
  221. 2019-07-10 15:02:57.410 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:261] Processing CHPortlets.war
  222. 2019-07-10 15:03:05.352 INFO [fileinstall-/Users/dnebinger/liferay/71ee/bundle/osgi/war][BaseAutoDeployListener:43] Copying portlets for /Users/dnebinger/liferay/71ee/bundle/tomcat-9.0.6/temp/20190710150305329VPNFBPNZ/CHPortlets.war
  223. 2019-07-10 15:03:05.473 INFO [fileinstall-/Users/dnebinger/liferay/71ee/bundle/osgi/war][BaseDeployer:877] Deploying CHPortlets.war
  224. 2019-07-10 15:03:06.527 INFO [fileinstall-/Users/dnebinger/liferay/71ee/bundle/osgi/war][BaseAutoDeployListener:50] Portlets for /Users/dnebinger/liferay/71ee/bundle/tomcat-9.0.6/temp/20190710150305329VPNFBPNZ/CHPortlets.war copied successfully
  225. 2019-07-10 15:03:08.802 ERROR [fileinstall-/Users/dnebinger/liferay/71ee/bundle/osgi/war][org_apache_felix_fileinstall:97] Error while starting bundle: webbundle:/Users/dnebinger/liferay/71ee/bundle/osgi/war/CHPortlets.war?Bundle-SymbolicName=CHPortlets&Web-ContextPath=/CHPortlets&protocol=file
  226. org.osgi.framework.BundleException: Could not resolve module: CHPortlets [966]_ Unresolved requirement: Import-Package: com.liferay.portal.osgi.web.servlet.jsp.compiler; resolution:="optional"_ Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9))"_ [Sanitized]
  227. at org.eclipse.osgi.container.Module.start(Module.java:444)
  228. at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
  229. at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1258)
  230. at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1230)
  231. at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1218)
  232. at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:507)
  233. at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
  234. at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
  235. 2019-07-10 15:03:08.804 ERROR [fileinstall-/Users/dnebinger/liferay/71ee/bundle/osgi/war][org_apache_felix_fileinstall:97] Error while starting bundle: webbundle:/Users/dnebinger/liferay/71ee/bundle/osgi/war/CHPortlets.war?Bundle-SymbolicName=CHPortlets&Web-ContextPath=/CHPortlets&protocol=file
  236. org.osgi.framework.BundleException: Could not resolve module: CHPortlets [966]_ Unresolved requirement: Import-Package: com.liferay.portal.osgi.web.servlet.jsp.compiler; resolution:="optional"_ Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9))"_ [Sanitized]
  237. at org.eclipse.osgi.container.Module.start(Module.java:444)
  238. at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
  239. at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1258)
  240. at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1230)
  241. at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
  242. at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
  243. at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement