当前位置: 首页>>代码示例>>Java>>正文


Java IDataCursor.insertAfter方法代码示例

本文整理汇总了Java中com.wm.data.IDataCursor.insertAfter方法的典型用法代码示例。如果您正苦于以下问题:Java IDataCursor.insertAfter方法的具体用法?Java IDataCursor.insertAfter怎么用?Java IDataCursor.insertAfter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.wm.data.IDataCursor的用法示例。


在下文中一共展示了IDataCursor.insertAfter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetAllDocValuesForKey

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetAllDocValuesForKey() {
	IData idata = IDataFactory.create();
	IDataCursor cursor = idata.getCursor();
	cursor.insertAfter("something", newIDataWithValue("x"));
	cursor.insertAfter("item", newIDataWithValue("a"));
	cursor.insertAfter("item", newIDataWithValue("b"));
	cursor.insertAfter("somethingElse", newIDataWithValue("y"));
	cursor.insertAfter("item", newIDataWithValue("c"));
	cursor.insertAfter("somethingDifferent", newIDataWithValue("z"));

	Document res = docFactory.wrap(idata);
	Collection<Document> actual = res.docsSplitEntry("item").getValOrEmpty();
	List<Document> actualList = Lists.newArrayList(actual);

	assertEquals(3, actual.size());
	assertEquals("a", actualList.get(0).entry("value1").getVal());
	assertEquals("b", actualList.get(1).entry("value1").getVal());
	assertEquals("c", actualList.get(2).entry("value1").getVal());
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:21,代码来源:SplitEntryTest.java

示例2: testGetAllValuesForKey

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetAllValuesForKey() {
	List<String> expected = Lists.newArrayList("a", "b", "c");

	IData idata = IDataFactory.create();
	IDataCursor cursor = idata.getCursor();
	cursor.insertAfter("something", "x");
	cursor.insertAfter("item", "a");
	cursor.insertAfter("item", "b");
	cursor.insertAfter("somethingElse", "y");
	cursor.insertAfter("item", "c");
	cursor.insertAfter("somethingDifferent", "z");

	Document res = docFactory.wrap(idata);
	Collection<String> actual = res.stringsSplitEntry("item").getValOrEmpty();
	assertTrue(CollectionUtils.isEqualCollection(expected, actual));
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:18,代码来源:SplitEntryTest.java

示例3: testGetNonEmptyVal_WithValue

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetNonEmptyVal_WithValue() {
	IData idata = IDataFactory.create();
	IDataCursor cursor = idata.getCursor();
	cursor.insertAfter("something", newIDataWithValue("x"));
	cursor.insertAfter("item", newIDataWithValue("a"));
	cursor.insertAfter("item", newIDataWithValue("b"));
	cursor.insertAfter("somethingElse", newIDataWithValue("y"));
	cursor.insertAfter("item", newIDataWithValue("c"));
	cursor.insertAfter("somethingDifferent", newIDataWithValue("z"));

	Document res = docFactory.wrap(idata);
	Collection<Document> actual = res.docsSplitEntry("item").getNonEmptyVal();
	List<Document> actualList = Lists.newArrayList(actual);

	assertEquals(3, actual.size());
	assertEquals("a", actualList.get(0).entry("value1").getVal());
	assertEquals("b", actualList.get(1).entry("value1").getVal());
	assertEquals("c", actualList.get(2).entry("value1").getVal());
	
	
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:23,代码来源:SplitEntryTest.java

示例4: testGetNonEmptyVal_WithoutValue

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetNonEmptyVal_WithoutValue() {
	IData idata = IDataFactory.create();
	IDataCursor cursor = idata.getCursor();
	cursor.insertAfter("something", newIDataWithValue("x"));

	Document res = docFactory.wrap(idata);
	try {
		res.docsSplitEntry("item").getNonEmptyVal();
		fail();
	}
	catch (InexistentEntryException e) {
		// success
	}
	
	
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:18,代码来源:SplitEntryTest.java

示例5: testRemoveFailed

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testRemoveFailed() {
	IData iData = IDataFactory.create();
	{
	IDataCursor cursor = iData.getCursor();
	cursor.insertAfter("first", "A");
	cursor.insertAfter("words", "Word to replace");
	cursor.insertAfter("middle", "M");
	cursor.insertAfter("words", "Another word to replace");
	cursor.insertAfter("last", "Z");
	}
	
	Document document = docFactory.wrap(iData);

	try {
		document.splitEntry("nonExistingKey").remove();
		fail();
	} catch (InexistentEntryException e) {
		// success
	}

	assertEquals(5, IDataUtil.size(document.getIData().getCursor()));
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:24,代码来源:SplitEntryTest.java

示例6: testRemoveFailedIgnore

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testRemoveFailedIgnore() {
	IData iData = IDataFactory.create();
	{
		IDataCursor cursor = iData.getCursor();
		cursor.insertAfter("first", "A");
		cursor.insertAfter("words", "Word to replace");
		cursor.insertAfter("middle", "M");
		cursor.insertAfter("words", "Another word to replace");
		cursor.insertAfter("last", "Z");
		}
	Document document = docFactory.wrap(iData);

	document.entry("nonExistingKey").remove(RemoveEntryOption.LENIENT);

	// confirm no value has been removed
	assertEquals(5, IDataUtil.size(document.getIData().getCursor()));
}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:19,代码来源:SplitEntryTest.java

示例7: testGetAsArrayWithQualifiedKeyAndMultipleArrays

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetAsArrayWithQualifiedKeyAndMultipleArrays() throws Exception {
    Object[] expected = new String[] { "1", "2", "3", "4", "5", "6", "7" };

    Object[] array1 = new String[] { "1", "2", "3" };
    Object[] array2 = new String[] { "4", "5", "6" };

    IData child = IDataFactory.create();
    IDataCursor cursor = child.getCursor();
    cursor.insertAfter("b", "1");
    cursor.insertAfter("c", array1);
    cursor.insertAfter("c", array2);
    cursor.insertAfter("c", "7");

    cursor.destroy();

    IDataMap parent = new IDataMap();
    parent.put("a", child);

    Object[] actual = IDataHelper.getAsArray(parent, "a/c");

    assertArrayEquals(expected, actual);
    assertTrue(actual instanceof String[]);
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:25,代码来源:IDataHelperTest.java

示例8: clone

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
/**
 * Returns a new IData document which is a shallow copy of the given IData document.
 *
 * @param document  An IData document to be cloned.
 * @param excluding Optional set of keys which will be excluded from the clone.
 * @return          A new IData document which is a shallow copy of the given IData document.
 */
public static IData clone(IData document, Set<String> excluding) {
    if (document == null) return null;
    if (excluding == null) excluding = Collections.emptySet();

    IData output = IDataFactory.create();
    IDataCursor inputCursor = document.getCursor();
    IDataCursor outputCursor = output.getCursor();

    while(inputCursor.next()) {
        String key = inputCursor.getKey();
        Object value = inputCursor.getValue();

        if (!excluding.contains(key)) {
            outputCursor.insertAfter(key, value);
        }
    }

    inputCursor.destroy();
    outputCursor.destroy();

    return output;
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:30,代码来源:IDataHelper.java

示例9: testGetAsArrayWithMultipleOccurrence

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetAsArrayWithMultipleOccurrence() throws Exception {
    Object[] expected = new String[] { "1", "2", "3" };

    IData document = IDataFactory.create();
    IDataCursor cursor = document.getCursor();
    cursor.insertAfter("a", "1");
    cursor.insertAfter("a", "2");
    cursor.insertAfter("a", "3");
    cursor.insertAfter("b", "4");
    cursor.destroy();

    Object[] actual = IDataHelper.getAsArray(document, "a");

    assertArrayEquals(expected, actual);
    assertTrue(actual instanceof String[]);
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:18,代码来源:IDataHelperTest.java

示例10: testDropKeyWithPathAndIndex

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testDropKeyWithPathAndIndex() throws Exception {
    IData child = IDataFactory.create();
    IDataCursor cursor = child.getCursor();
    cursor.insertAfter("b", "1");
    cursor.insertAfter("b", "2");
    cursor.insertAfter("b", "3");
    cursor.insertAfter("b", "4");
    cursor.destroy();

    IDataMap parent = new IDataMap();
    parent.put("a", child);

    IDataHelper.drop(parent, "a/b(2)");
    assertEquals(3, IDataHelper.size(child));
    assertEquals("4", IDataHelper.get(parent, "a/b(2)"));
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:18,代码来源:IDataHelperTest.java

示例11: testGetAsArrayWithNthKeyAndMultipleOccurrence

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetAsArrayWithNthKeyAndMultipleOccurrence() throws Exception {
    Object[] expected = new String[] { "2" };

    IData document = IDataFactory.create();
    IDataCursor cursor = document.getCursor();
    cursor.insertAfter("a", "1");
    cursor.insertAfter("a", "2");
    cursor.insertAfter("a", "3");
    cursor.insertAfter("b", "4");
    cursor.destroy();

    Object[] actual = IDataHelper.getAsArray(document, "a(1)");

    assertArrayEquals(expected, actual);
    assertTrue(actual instanceof String[]);
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:18,代码来源:IDataHelperTest.java

示例12: testGetKeyWithPathAndIndex

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetKeyWithPathAndIndex() throws Exception {
    IData child = IDataFactory.create();
    IDataCursor cursor = child.getCursor();
    cursor.insertAfter("b", "1");
    cursor.insertAfter("b", "2");
    cursor.insertAfter("b", "3");
    cursor.insertAfter("b", "4");
    cursor.destroy();

    IDataMap parent = new IDataMap();
    parent.put("a", child);

    assertEquals("1", IDataHelper.get(parent, "a/b"));
    assertEquals("1", IDataHelper.get(parent, "a/b(0)"));
    assertEquals("2", IDataHelper.get(parent, "a/b(1)"));
    assertEquals("3", IDataHelper.get(parent, "a/b(2)"));
    assertEquals("4", IDataHelper.get(parent, "a/b(3)"));
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:20,代码来源:IDataHelperTest.java

示例13: testArrayify

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testArrayify() throws Exception {
    Object[] expected = new String[] { "2", "3", "4" };

    IData child = IDataFactory.create();
    IDataCursor cursor = child.getCursor();
    cursor.insertAfter("b", "1");
    cursor.insertAfter("c", "2");
    cursor.insertAfter("c", "3");
    cursor.insertAfter("c", "4");
    cursor.destroy();

    IDataMap parent = new IDataMap();
    parent.put("a", child);

    IDataHelper.arrayify(parent, "a/c");

    assertArrayEquals(expected, (Object[])IDataHelper.get(parent, "a/c"));
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:20,代码来源:IDataHelperTest.java

示例14: testGetAsArrayWithQualifiedKeyAndSingleOccurrence

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
@Test
public void testGetAsArrayWithQualifiedKeyAndSingleOccurrence() throws Exception {
    Object[] expected = new String[] { "1" };

    IData child = IDataFactory.create();
    IDataCursor cursor = child.getCursor();
    cursor.insertAfter("b", "1");
    cursor.insertAfter("c", "2");
    cursor.insertAfter("c", "3");
    cursor.insertAfter("c", "4");
    cursor.destroy();

    IDataMap parent = new IDataMap();
    parent.put("a", child);

    Object[] actual = IDataHelper.getAsArray(parent, "a/b");

    assertArrayEquals(expected, actual);
    assertTrue(actual instanceof String[]);
}
 
开发者ID:Permafrost,项目名称:Tundra.java,代码行数:21,代码来源:IDataHelperTest.java

示例15: doPut

import com.wm.data.IDataCursor; //导入方法依赖的package包/类
private void doPut(Iterable<?> values) {

		IDataCursorResource cursorRes = newCursorResource();
		try {
			IDataCursor cursor = cursorRes.getCursor();

			boolean continueLoop;

			/* Remove previous entries */
			do {
				boolean hasValWithKey = cursor.first(getKey());

				if (hasValWithKey) {
					continueLoop = cursor.delete();
				} else {
					continueLoop = false;
				}
			} while (continueLoop);

			cursor.last();

			for (Object individualVal : values) {
				Object normalisedIndividualVal = convertAndNormaliseValForPut(individualVal, mutatorType);
				cursor.insertAfter(getKey(), normalisedIndividualVal);
			}
		} finally {
			cursorRes.close();
		}
	}
 
开发者ID:innodev-au,项目名称:wmboost-data,代码行数:30,代码来源:SplitEntryImpl.java


注:本文中的com.wm.data.IDataCursor.insertAfter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。