Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sealed class DiffOp {
- data class Insert(val oldPos: Int, val newPos: Int) : DiffOp()
- data class Delete(val oldPos: Int) : DiffOp()
- }
- fun <T> diff(list1: MutableList<T>, list2: MutableList<T>, i: Int = 0, j: Int = 0): List<DiffOp> {
- val N = list1.size
- val M = list2.size
- val L = N + M
- val Z = 2 * min(N, M) + 2
- when {
- N > 0 && M > 0 -> {
- val w = N - M
- val g = ArrayList<Int>(Z).also {
- for (x in 0 until Z) {
- it.add(0)
- }
- }
- val p = ArrayList<Int>(Z).also {
- for (x in 0 until Z) {
- it.add(0)
- }
- }
- for (h in 0..(L / 2 + if (L % 2 != 0) 1 else 0) + 1) {
- for (r in 0..2) {
- val (c, d, o, m) = if (r == 0) Tuple4(g, p, 1, 1) else Tuple4(p, g, 0, -1)
- for (k in (-(h - 2 * max(0, h - M))..(h - 2 * max(0, h - N) + 1)) step 2) {
- var a = if (k == -h or k != h and c.cyclicAt((k - 1) % Z) < c.cyclicAt(k + 1 % Z))
- c.cyclicAt((k + 1) % Z)
- else
- c.cyclicAt((k - 1) % Z) + 1
- var b = a - k
- val s = a
- val t = b
- while (a < N && b < M &&
- list1.cyclicAt((1 - o) * N + m * a + (o - 1)) == list2.cyclicAt((1 - o) * M + m * b + (o - 1))) {
- a += 1
- b += 1
- }
- c.cyclicSet(k % Z, a)
- val z = -(k - w)
- if (L % 2 == o && z >= -(h - o) && z <= h - o && c.cyclicAt(k % Z) + d.cyclicAt(z % Z) >= N) {
- val (D, x, y, u, v) = if (o == 1)
- Tuple5(2 * h - 1, s, t, a, b)
- else
- Tuple5(2 * h, N - a, M - b, N - s, M - t)
- return when {
- D > 1 || x != u && y != v -> diff(
- list1.subList(0, x),
- list2.subList(0, y), i, j) +
- diff(
- list1.subList(u, N),
- list2.subList(v, M), i + u, j + v)
- M > N -> diff(mutableListOf(), list2.subList(N, M), i + N, j + N)
- M < N -> diff(list1.subList(M, N), mutableListOf(), i + M, j + M)
- else -> emptyList()
- }
- }
- }
- }
- }
- }
- N > 0 -> return (0..N).map { n ->
- DiffOp.Delete(i + n)
- }
- else -> return (0..M).map { n ->
- DiffOp.Insert(i, j + n)
- }
- }
- return emptyList()
- }
- <div class="method">
- <div>
- <h3 class="method-title">Mathod</h3>
- <hr class="line-method">
- </div>
- <mat-tab-group animationDuration="6ms">
- <mat-tab label="First">
- <ng-template mat-tab-label>
- <button type="button" class="btn btn-white active">Personal Info</button>
- </ng-template>
- <div class="container tab-padd">
- <div class="row">
- <div class="col-md-6">
- <div class="form-group">
- <div class="sub-form">
- <label for="firstName">First Name</label>
- <input type="text" class="form-control shot" name="firstName"
- required />
- </div>
- <div class="sub-form">
- <label class="right-inline" for="lastName">Last Name</label>
- <input value="" class="form-control shot" name="lastName"
- required />
- </div>
- </div>
- </div>
- </div>
- </div>
- </mat-tab>
- <mat-tab label="Second">
- <ng-template mat-tab-label>
- <button type="button" class="btn btn-white active">Another Info</button>
- </ng-template>
- <div class="container tab-padd">
- <div class="row">
- <div class="col-md-6"> </div>
- </div>
- </div>
- </mat-tab>
- </mat-tab-group>
- .method-title{
- padding: 12px 84px;
- width: max-content;
- }
- .line-title{
- margin-top: 4rem !important;
- /* margin-bottom: 3rem !important; */
- width: 22%;
- margin-left:-14px;
- text-align:left;
- }
- .justify-content-left{
- padding-left: 85px;
- }
- .radio-group{
- display: flex;
- flex-direction: row;
- margin: 15px 0;
- }
- .justify-content-between{
- justify-content: space-between;
- display: flex;
- }
- .border{
- width: calc(100% - 46rem);
- text-align: left;
- margin-left: 4px;
- }
- #container {
- display: flex;
- justify-content: space-between; /* Can be changed in the live sample */
- width: 40%;
- padding-left: 1rem;
- }
- .space-bottom-2{
- padding-bottom: 2rem;
- }
- .custome-row{
- display: contents !important;
- line-height: 6px;
- }
- .method{
- display: flex;
- }
- .line-method{
- margin-top: -1.8rem !important;
- width: 78%;
- margin-left: -12px;
- text-align: left;
- }
- .mat-tab-label::ng-deep {
- width: 900rem !important;
- }
- /* form specific formatting */
- .tab-padd{
- padding-top: 24px !important;
- column-span: all;
- }
- .form-group {
- display: flex;
- flex-direction: row;
- }
- .sub-form{
- flex-direction: column;
- }
- .form-group label {
- flex: none;
- display: block;
- width: 125px;
- font-weight: bold;
- font-size: 1em;
- white-space: nowrap;
- }
- .form-group label.left-inline {
- text-align: left;
- padding-right: 8px;
- padding-left: 10px;
- width: auto;
- }
- .form-group .shot{
- width: 20rem
- }
- .form-group .long{
- width: 40rem
- }
- 2019-07-10 15:02:57.410 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:261] Processing CHPortlets.war
- 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
- 2019-07-10 15:03:05.473 INFO [fileinstall-/Users/dnebinger/liferay/71ee/bundle/osgi/war][BaseDeployer:877] Deploying CHPortlets.war
- 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
- 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
- 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]
- at org.eclipse.osgi.container.Module.start(Module.java:444)
- at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1258)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1230)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1218)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:507)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
- 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
- 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]
- at org.eclipse.osgi.container.Module.start(Module.java:444)
- at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1258)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1230)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
- at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement