|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deduced.rule.DeductionRuleLibrary
public abstract class DeductionRuleLibrary
DeductionRuleLibrary offers a set of quick methods to implement deduction rules
Nested Class Summary | |
---|---|
static class |
DeductionRuleLibrary.CompareResult
CompareResult is an utility class to store a collection and a value |
Field Summary | |
---|---|
private static java.text.SimpleDateFormat |
DATE_FORMAT
date format |
private static java.util.logging.Logger |
LOGGER
Logger |
private static java.text.SimpleDateFormat |
TIME_FORMAT
time format |
Constructor Summary | |
---|---|
DeductionRuleLibrary()
|
Method Summary | ||
---|---|---|
static PropertyCollection |
addReferenceToList(PropertyCollection referenceToAdd,
PropertyCollection list,
boolean allowDuplicateReference)
add a reference to a list. |
|
private static void |
addToRemoveListIfNotMatched(boolean removeUnmatchedValues,
java.util.List<PropertyCollection> objectsToRemove,
java.util.Collection valuesToMatchClone,
PropertyCollection currentCollection)
add a collection To the Remove List If Not Matched |
|
private static void |
addToRemoveListIfPropertyNotMatched(boolean removeUnmatchedValues,
java.util.List<PropertyCollection> objectsToRemove,
java.util.Collection valuesToMatchClone,
PropertyCollection currentCollection,
java.lang.Object propertyKey)
add a collection To the Remove List If Not Matched |
|
static Filter |
and(Filter firstFilter,
Filter secondFilter)
create an "and" filter |
|
static Filter |
bigger(java.lang.Object value)
Create a bigger than filter. |
|
static Filter |
biggerOrEqual(java.lang.Object value)
Create a bigger or equal to filter. |
|
static void |
clearPropertyCollection(PropertyCollection<?,?> collectionToClear)
clear a Property Collection by removing all it's children and deleting them if they are owned by this collection. |
|
static java.util.List<java.util.Calendar> |
createDateIncrementList(java.util.Calendar firstDate,
java.util.Calendar secondDate,
long incrementInMilliseconds)
create a Date Increment List starting with the smallest date. |
|
static PropertyCollection |
createObject(PropertyCollection typeToCreate,
RuleExecutionContext context)
create an Object |
|
static PropertyCollection |
createObjectsMatchingAllValues(java.util.List setValuesToMatch,
PropertyCollection listToAddMissingValues,
PropertyCollection instanceToMatch,
PropertyCollection typeToCreate,
boolean deleteUnmatchedValues,
RuleExecutionContext context)
create Objects Matching All Values and add them to the specified list |
|
static PropertyCollection |
createObjectsMatchingAllValues(java.util.List valuesToMatch,
PropertyCollection listToAddMissingValues,
PropertyCollection instanceToMatch,
PropertyCollection typeToCreate,
RuleExecutionContext context)
create Objects Matching All Values and add them to the specified list |
|
static PropertyCollection |
createObjectsMatchingAllValuesInOrderedList(java.util.List setValuesToMatch,
PropertyCollection listToAddMissingValues,
PropertyCollection instanceToMatch,
PropertyCollection typeToCreate,
boolean deleteUnmatchedValues,
RuleExecutionContext context)
create Objects Matching All Values and add them to the specified ordered list |
|
static PropertyCollection |
createObjectsMatchingAllValuesInOrderedList(java.util.List valuesToMatch,
PropertyCollection listToAddMissingValues,
PropertyCollection instanceToMatch,
PropertyCollection typeToCreate,
RuleExecutionContext context)
create Objects Matching All Values and add them to the specified ordered list |
|
static PropertyCollection<?,?> |
createOrReuseListToMatchType(PropertyCollection<?,?> currentList,
PropertyCollection<?,?> requiredListType,
PropertyCollection<?,?> fixedInstance,
ModelFactory factory)
create Or Reuse a List To Match a desired list type. |
|
private static void |
createUnmatchedValues(PropertyCollection listToAddMissingValues,
PropertyCollection<?,?> collectionTypeToCreate,
java.lang.Object instanceKey,
java.util.List valuesToMatchClone,
ModelFactory modelFactory)
createUnmatchedValues |
|
private static void |
createUnmatchedValuesInOrderedList(PropertyCollection listToAddMissingValues,
PropertyCollection<?,?> collectionTypeToCreate,
java.lang.Object instanceKey,
PropertyCollection<?,?> orderingTypeToCreate,
java.lang.Object orderingValueKey,
java.util.List valuesToMatchClone,
ModelFactory modelFactory)
createUnmatchedValuesInOrderedList |
|
static void |
debug(java.lang.String message)
utility method to output messages in the console quickly |
|
static boolean |
equals(java.lang.Object object1,
java.lang.Object object2)
Compares two objects for equality, where either one or both objects may be null . |
|
static Filter |
equalTo(java.lang.Object equalValue)
create a filter to where objects have to equal a specific value |
|
static PropertyCollection |
fillList(PropertyCollection listToFill,
java.util.List objectsToAddToList,
boolean removeUnmatchedValues)
fill a List with a list of objects. |
|
private static void |
fillListCreateUnmatchedValues(PropertyCollection listToFill,
java.util.Collection valuesToMatchClone)
fill List Create Unmatched Values |
|
private static void |
fillListExtractMatchesValues(boolean removeUnmatchedValues,
java.util.List currentValueCollectionList,
java.util.List<PropertyCollection> objectsToRemove,
java.util.Collection valuesToMatchClone)
fill List Extract Matches Values |
|
private static void |
fillListRemoveUnmatchedValues(PropertyCollection listToFill,
boolean isReference,
java.util.List<PropertyCollection> objectsToRemove)
fill List Remove Unmatched Values |
|
static void |
fillListWithSpecifiedTypes(PropertyCollection listToFill,
ModelFactory factory,
boolean deleteUnmatchedValues,
PropertyCollection<?,?>... typesToCreate)
fill a List With the Specified property collection Types by analyzing the list content and creating the missing objects and optionally deleting objects of which the type wasn't matched. |
|
static PropertyCollection |
fillOrderedList(PropertyCollection listToFill,
java.util.List objectsToAddToList,
boolean removeUnmatchedValues,
RuleExecutionContext context)
fill an ordered List with a list of objects. |
|
private static void |
fillOrderedListCreateUnmatchedValues(PropertyCollection listToFill,
java.util.Collection valuesToMatchClone,
java.lang.Object valueKey,
PropertyCollection typeToCreate,
ModelFactory factory)
fill List Create Unmatched Values |
|
protected static void |
fillOrderedListExtractMatchesValues(boolean removeUnmatchedValues,
java.util.List currentValueCollectionList,
java.util.List<PropertyCollection> objectsToRemove,
java.util.Collection valuesToMatchClone,
java.lang.Object valueKey)
fill ordered List Extract Matches Values |
|
static void |
fillOrderedListWithSpecifiedTypes(PropertyCollection listToFill,
ModelFactory factory,
boolean deleteUnmatchedValues,
PropertyCollection<?,?>... typesToCreate)
fill an ordered list with the specified property collection types by analyzing the list content and creating the missing objects and optionally deleting objects of which the type wasn't matched. |
|
static
|
filter(java.util.List<T> listToFilter,
Filter condition)
filter a list based on a filter |
|
static java.lang.Object |
filterList(java.util.Collection listToFilter,
boolean nullOnMultipleResult)
filter a collection to extract a single object from it. |
|
static PropertyCollection<?,?> |
filterList(PropertyCollection<?,?> listToFilter,
boolean nullOnMultipleResult)
filter property collection to extract a single object from it. |
|
static
|
filterList(T[] listToFilter,
boolean nullOnMultipleResult)
filter an array property collection to extract a single object from it. |
|
private static DeductionRuleLibrary.CompareResult |
findMaximumResult(java.util.List collectionList,
PropertyCollection instanceToCompare)
find the maximum result in the list of property collection for the specified instance |
|
private static DeductionRuleLibrary.CompareResult |
findMinimumResult(java.util.List<?> collectionList,
PropertyCollection<?,?> instanceToCompare)
find the minimum result in the list of property collection for the specified instance |
|
static PropertyCollection |
findParentOfType(PropertyCollection searchPoint,
PropertyCollection type,
boolean matchExactType)
find Parent Of Type |
|
static java.lang.String |
formatDate(java.util.Calendar value)
format a date to show the year, month and day |
|
static java.lang.String |
formatDate(java.util.Calendar value,
java.lang.String dateFormat)
format Date to a string with a specific display format |
|
static java.lang.String |
formatTime(java.util.Calendar value)
format Time |
|
static PropertyCollection<?,?> |
getModelFromCollection(PropertyCollection<?,?> collection)
get the Model layer associated with a Collection |
|
static PropertyCollectionController |
getPropertyCollectionController(PropertyCollection<?,?> controlLayer,
PropertyCollection<?,?> collection)
get the Property Collection Controller from the control layer |
|
private static java.lang.String |
getReferenceString(boolean isReference)
get Reference description String |
|
private static java.util.List<PropertyCollection<?,?>> |
getTypeCreationList(PropertyCollection<?,?>[] typesToCreate)
getTypeCreationList : utility method to fetch a modifiable list from a type creation array. |
|
static Filter |
instanceOf(java.lang.Object type)
create a filter to where objects have to be of a specific type |
|
private static boolean |
isContextValid(RuleExecutionContext context)
is Context Valid |
|
private static boolean |
isCreationOptionsValid(java.util.List valuesToMatch,
PropertyCollection listToAddMissingValues,
PropertyCollection instanceToMatch,
PropertyCollection typeToCreate,
RuleExecutionContext context)
test if the options used to create collections are all valid |
|
private static boolean |
isTypeToCreateValid(PropertyCollection<?,?> typeToCreate)
is Type To Create Valid |
|
static PropertyCollection |
maximumCollection(java.util.List collectionList,
PropertyCollection instanceToCompare)
find the property collection in the list that has the maximum value for the specified instance |
|
static java.lang.Object |
maximumValue(java.util.List collectionList,
PropertyCollection instanceToCompare)
find the maximum value in the list of property collection for the specified instance |
|
static java.util.List |
merge(java.util.List firstList,
java.util.List secondList)
merge two list of objects together and return a list that contains the objects of the first list followed by the second list. |
|
static PropertyCollection |
minimumCollection(java.util.List collectionList,
PropertyCollection instanceToCompare)
find the property collection in the list that has the minimum value for the specified instance |
|
static java.lang.Object |
minimumValue(java.util.List collectionList,
PropertyCollection instanceToCompare)
find the minimum value in the list of property collection for the specified instance |
|
static Filter |
not(Filter otherFilter)
Create a reverse filter |
|
static Filter |
or(Filter firstFilter,
Filter secondFilter)
create an "or" filter |
|
static Filter |
property(PropertyCollection<?,?> instance,
Filter propertyValueFilter)
create a filter based on the value of a property and a filter applied to that value |
|
protected static void |
removeAlreadyMatchedOrderedListValues(boolean deleteUnmatchedValues,
java.lang.Object valueKey,
java.lang.Object instanceKey,
java.util.List valuesToMatchClone,
java.util.List<PropertyCollection> valuesToRemove,
java.lang.Object possibleCollection,
PropertyCollection<?,?> objectCreationType)
remove Already Matched Ordered List Values |
|
private static void |
removeAlreadyMatchedValues(boolean deleteUnmatchedValues,
java.lang.Object instanceKey,
java.util.List valuesToMatchClone,
java.util.List<PropertyCollection> valuesToRemove,
java.lang.Object possibleCollection,
PropertyCollection<?,?> objectCreationType)
remove Already Matched Values |
|
static Filter |
same(java.lang.Object sameInstance)
create a filter to where objects have to be the same as a specific value |
|
static Filter |
smaller(java.lang.Object value)
Create a smaller than filter. |
|
static Filter |
smallerOrEqual(java.lang.Object value)
Create a smaller or equal to filter. |
|
static int |
sum(java.lang.Integer first,
java.lang.Integer second)
sum two integers |
|
static double |
sum(java.util.List listOfNumbers)
sum a list of numbers |
|
private static void |
updateMaximumResultBasedOnCollection(DeductionRuleLibrary.CompareResult retVal,
java.lang.Object instanceIdentityKey,
PropertyCollection collection)
update Maximum Result Based On Collection |
|
private static void |
updateMinimumResultWithCollection(DeductionRuleLibrary.CompareResult retVal,
java.lang.Object instanceIdentityKey,
PropertyCollection<?,?> collection)
update Minimum Result With Collection |
|
private static void |
validateAddTypeToList(PropertyCollection list,
PropertyCollection<?,?> typeToAdd,
boolean reference)
validate if an object of the specified property collection type can be added to a property collection |
|
private static void |
validateAddTypeWithInstance(PropertyCollection<?,?> typeToAdd,
boolean reference,
PropertyCollection valueInstance)
validate Add Type With Instance |
|
private static void |
validateTypesToCreate(java.util.List<PropertyCollection<?,?>> createList,
PropertyCollection instance)
validate the Types To Create in the specified instance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.deduced.DeductionRuleAnalyzer |
---|
analyzeRule |
Field Detail |
---|
private static final java.util.logging.Logger LOGGER
private static final java.text.SimpleDateFormat DATE_FORMAT
private static final java.text.SimpleDateFormat TIME_FORMAT
Constructor Detail |
---|
public DeductionRuleLibrary()
Method Detail |
---|
public static java.lang.Object filterList(java.util.Collection listToFilter, boolean nullOnMultipleResult)
listToFilter
- the list to filternullOnMultipleResult
- if this flag is set to true and the list
contains more than 1 object, null will be returned.
public static PropertyCollection<?,?> filterList(PropertyCollection<?,?> listToFilter, boolean nullOnMultipleResult)
listToFilter
- the list to filternullOnMultipleResult
- if this flag is set to true and the list
contains more than 1 object, null will be returned.
public static <T> T filterList(T[] listToFilter, boolean nullOnMultipleResult)
T
- the type of object in the arraylistToFilter
- the list to filternullOnMultipleResult
- if this flag is set to true and the list
contains more than 1 object, null will be returned.
public static int sum(java.lang.Integer first, java.lang.Integer second)
first
- the first integersecond
- the second integer
public static double sum(java.util.List listOfNumbers)
listOfNumbers
- the list of numbers
public static PropertyCollection minimumCollection(java.util.List collectionList, PropertyCollection instanceToCompare)
collectionList
- the collection list to search ininstanceToCompare
- the instance to look for in the comparison of
values
public static java.lang.Object minimumValue(java.util.List collectionList, PropertyCollection instanceToCompare)
collectionList
- the collection list to search ininstanceToCompare
- the instance to look for in the comparison of
values
private static DeductionRuleLibrary.CompareResult findMinimumResult(java.util.List<?> collectionList, PropertyCollection<?,?> instanceToCompare)
collectionList
- the collection list to search ininstanceToCompare
- the instance to look for in the comparison of
values
private static void updateMinimumResultWithCollection(DeductionRuleLibrary.CompareResult retVal, java.lang.Object instanceIdentityKey, PropertyCollection<?,?> collection)
retVal
- the compare result to updateinstanceIdentityKey
- the instance key to readcollection
- the collection to readpublic static PropertyCollection maximumCollection(java.util.List collectionList, PropertyCollection instanceToCompare)
collectionList
- the collection list to search ininstanceToCompare
- the instance to look for in the comparison of
values
public static java.lang.Object maximumValue(java.util.List collectionList, PropertyCollection instanceToCompare)
collectionList
- the collection list to search ininstanceToCompare
- the instance to look for in the comparison of
values
private static DeductionRuleLibrary.CompareResult findMaximumResult(java.util.List collectionList, PropertyCollection instanceToCompare)
collectionList
- the collection list to search ininstanceToCompare
- the instance to look for in the comparison of
values
private static void updateMaximumResultBasedOnCollection(DeductionRuleLibrary.CompareResult retVal, java.lang.Object instanceIdentityKey, PropertyCollection collection)
retVal
- the result to updateinstanceIdentityKey
- the instance key to readcollection
- the collection to readpublic static java.lang.String formatDate(java.util.Calendar value)
value
- the value to format
public static java.lang.String formatTime(java.util.Calendar value)
value
- the time to format in a string
public static java.lang.String formatDate(java.util.Calendar value, java.lang.String dateFormat)
value
- the value to formatdateFormat
- the date format
public static PropertyCollection fillList(PropertyCollection listToFill, java.util.List objectsToAddToList, boolean removeUnmatchedValues)
listToFill
- the list to fillobjectsToAddToList
- objects to add to the listremoveUnmatchedValues
- if this option is set to true, all the
objects in the original list that don't match the list of
objects to add will be removed.
public static PropertyCollection fillOrderedList(PropertyCollection listToFill, java.util.List objectsToAddToList, boolean removeUnmatchedValues, RuleExecutionContext context)
listToFill
- the ordered list to fillobjectsToAddToList
- objects to add to the listremoveUnmatchedValues
- if this option is set to true, all the
objects in the original list that don't match the list of
objects to add will be removed.context
- the rule execution context
private static void fillListExtractMatchesValues(boolean removeUnmatchedValues, java.util.List currentValueCollectionList, java.util.List<PropertyCollection> objectsToRemove, java.util.Collection valuesToMatchClone)
removeUnmatchedValues
- the option to remove unmatched valuescurrentValueCollectionList
- the list of all the values that need to
be matchedobjectsToRemove
- the list of objects to potentially removevaluesToMatchClone
- the values to matchprotected static void fillOrderedListExtractMatchesValues(boolean removeUnmatchedValues, java.util.List currentValueCollectionList, java.util.List<PropertyCollection> objectsToRemove, java.util.Collection valuesToMatchClone, java.lang.Object valueKey)
removeUnmatchedValues
- the option to remove unmatched valuescurrentValueCollectionList
- the list of all the values that need to
be matchedobjectsToRemove
- the list of objects to potentially removevaluesToMatchClone
- the values to matchvalueKey
- the value key from which to fetch the value on the
ordering typeprivate static void fillListCreateUnmatchedValues(PropertyCollection listToFill, java.util.Collection valuesToMatchClone)
listToFill
- the list to fillvaluesToMatchClone
- the values to addprivate static void fillOrderedListCreateUnmatchedValues(PropertyCollection listToFill, java.util.Collection valuesToMatchClone, java.lang.Object valueKey, PropertyCollection typeToCreate, ModelFactory factory)
listToFill
- the list to fillvaluesToMatchClone
- the values to addvalueKey
- the value key to usetypeToCreate
- the type to createfactory
- the model factory to use to create the ordering typeprivate static void fillListRemoveUnmatchedValues(PropertyCollection listToFill, boolean isReference, java.util.List<PropertyCollection> objectsToRemove)
listToFill
- the list to fillisReference
- is the value to remove by referenceobjectsToRemove
- the list of values to removeprivate static void addToRemoveListIfPropertyNotMatched(boolean removeUnmatchedValues, java.util.List<PropertyCollection> objectsToRemove, java.util.Collection valuesToMatchClone, PropertyCollection currentCollection, java.lang.Object propertyKey)
removeUnmatchedValues
- option to remove unmatched valuesobjectsToRemove
- the object to remove listvaluesToMatchClone
- the values to matchcurrentCollection
- the current collectionpropertyKey
- the property key used to extract the value on the
ordering typeprivate static void addToRemoveListIfNotMatched(boolean removeUnmatchedValues, java.util.List<PropertyCollection> objectsToRemove, java.util.Collection valuesToMatchClone, PropertyCollection currentCollection)
removeUnmatchedValues
- option to remove unmatched valuesobjectsToRemove
- the object to remove listvaluesToMatchClone
- the values to matchcurrentCollection
- the current collectionpublic static PropertyCollection createObject(PropertyCollection typeToCreate, RuleExecutionContext context)
typeToCreate
- the type of object to createcontext
- the rule execution context
public static PropertyCollection createObjectsMatchingAllValues(java.util.List valuesToMatch, PropertyCollection listToAddMissingValues, PropertyCollection instanceToMatch, PropertyCollection typeToCreate, RuleExecutionContext context)
valuesToMatch
- the values to matchlistToAddMissingValues
- the list to fillinstanceToMatch
- the instance where to set the value on each
created objecttypeToCreate
- the type of object to createcontext
- the rule execution context
public static PropertyCollection createObjectsMatchingAllValuesInOrderedList(java.util.List valuesToMatch, PropertyCollection listToAddMissingValues, PropertyCollection instanceToMatch, PropertyCollection typeToCreate, RuleExecutionContext context)
valuesToMatch
- the values to matchlistToAddMissingValues
- the ordered list to fillinstanceToMatch
- the instance where to set the value on each
created objecttypeToCreate
- the type of object to createcontext
- the rule execution context
public static PropertyCollection createObjectsMatchingAllValuesInOrderedList(java.util.List setValuesToMatch, PropertyCollection listToAddMissingValues, PropertyCollection instanceToMatch, PropertyCollection typeToCreate, boolean deleteUnmatchedValues, RuleExecutionContext context)
setValuesToMatch
- the values to matchlistToAddMissingValues
- the ordered list to fillinstanceToMatch
- the instance where to set the value on each
created objecttypeToCreate
- the type of object to createdeleteUnmatchedValues
- if this option is set to true, all the
objects in the original list that don't match the list of
values to add will be removed.context
- the rule execution context
public static PropertyCollection createObjectsMatchingAllValues(java.util.List setValuesToMatch, PropertyCollection listToAddMissingValues, PropertyCollection instanceToMatch, PropertyCollection typeToCreate, boolean deleteUnmatchedValues, RuleExecutionContext context)
setValuesToMatch
- the values to matchlistToAddMissingValues
- the list to fillinstanceToMatch
- the instance where to set the value on each
created objecttypeToCreate
- the type of object to createdeleteUnmatchedValues
- if this option is set to true, all the
objects in the original list that don't match the list of
values to add will be removed.context
- the rule execution context
private static boolean isCreationOptionsValid(java.util.List valuesToMatch, PropertyCollection listToAddMissingValues, PropertyCollection instanceToMatch, PropertyCollection typeToCreate, RuleExecutionContext context)
valuesToMatch
- the list of values to matchlistToAddMissingValues
- the list on which to add the missing valuesinstanceToMatch
- the instance to matchtypeToCreate
- the type to createcontext
- the context. The context must have a valid model factory
private static boolean isTypeToCreateValid(PropertyCollection<?,?> typeToCreate)
typeToCreate
- the type to create
private static boolean isContextValid(RuleExecutionContext context)
context
- the context
private static void createUnmatchedValues(PropertyCollection listToAddMissingValues, PropertyCollection<?,?> collectionTypeToCreate, java.lang.Object instanceKey, java.util.List valuesToMatchClone, ModelFactory modelFactory)
listToAddMissingValues
- the list on which to add the missing valuescollectionTypeToCreate
- the type of collection to createinstanceKey
- the instance key to setvaluesToMatchClone
- the list of values for which we should create
collectionsmodelFactory
- the model factory used for creationprivate static void createUnmatchedValuesInOrderedList(PropertyCollection listToAddMissingValues, PropertyCollection<?,?> collectionTypeToCreate, java.lang.Object instanceKey, PropertyCollection<?,?> orderingTypeToCreate, java.lang.Object orderingValueKey, java.util.List valuesToMatchClone, ModelFactory modelFactory)
listToAddMissingValues
- the list on which to add the missing valuescollectionTypeToCreate
- the type of collection to createinstanceKey
- the instance key to setorderingTypeToCreate
- the ordering type to createorderingValueKey
- the key to the value property on the created
ordering typevaluesToMatchClone
- the list of values for which we should create
collectionsmodelFactory
- the model factory used for creationprivate static void removeAlreadyMatchedValues(boolean deleteUnmatchedValues, java.lang.Object instanceKey, java.util.List valuesToMatchClone, java.util.List<PropertyCollection> valuesToRemove, java.lang.Object possibleCollection, PropertyCollection<?,?> objectCreationType)
deleteUnmatchedValues
- option to delete unmatched valuesinstanceKey
- the instance key to readvaluesToMatchClone
- the values to match listvaluesToRemove
- the values to remove listpossibleCollection
- the possible collection to removeobjectCreationType
- the type of object that should be created in
the listprotected static void removeAlreadyMatchedOrderedListValues(boolean deleteUnmatchedValues, java.lang.Object valueKey, java.lang.Object instanceKey, java.util.List valuesToMatchClone, java.util.List<PropertyCollection> valuesToRemove, java.lang.Object possibleCollection, PropertyCollection<?,?> objectCreationType)
deleteUnmatchedValues
- option to delete unmatched valuesvalueKey
- the key to fetch the value on the ordering typeinstanceKey
- the instance key to readvaluesToMatchClone
- the values to match listvaluesToRemove
- the values to remove listpossibleCollection
- the possible collection to removeobjectCreationType
- the type of object to createpublic static java.util.List<java.util.Calendar> createDateIncrementList(java.util.Calendar firstDate, java.util.Calendar secondDate, long incrementInMilliseconds)
firstDate
- the first date inclusively. If null, the returned list
will be empty.secondDate
- the second date inclusively. If null, the returned list
will be empty.incrementInMilliseconds
- the increment between each step in
milliseconds. The method will return an empty list if this
value is zero. A negative value will be converted to a
positive value for increment.
public static <T> java.util.List<T> filter(java.util.List<T> listToFilter, Filter condition)
T
- Type of objects in the list to filterlistToFilter
- the list to filtercondition
- the condition filter
public static Filter bigger(java.lang.Object value)
value
- the bigger than value on the filter.
public static Filter smaller(java.lang.Object value)
value
- the smaller than value on the filter.
public static Filter biggerOrEqual(java.lang.Object value)
value
- the bigger or equal to value on the filter.
public static Filter smallerOrEqual(java.lang.Object value)
value
- the smaller or equal to value on the filter.
public static Filter not(Filter otherFilter)
otherFilter
- the filter to reverse
public static Filter equalTo(java.lang.Object equalValue)
equalValue
- the equal value
public static Filter property(PropertyCollection<?,?> instance, Filter propertyValueFilter)
instance
- the property instance to filterpropertyValueFilter
- the filter to apply to the value
public static Filter same(java.lang.Object sameInstance)
sameInstance
- the same value
public static Filter instanceOf(java.lang.Object type)
type
- the type to match
public static Filter and(Filter firstFilter, Filter secondFilter)
firstFilter
- first filtersecondFilter
- second filter
public static Filter or(Filter firstFilter, Filter secondFilter)
firstFilter
- first filtersecondFilter
- second filter
public static PropertyCollection findParentOfType(PropertyCollection searchPoint, PropertyCollection type, boolean matchExactType)
searchPoint
- the collection to search for a parent of the specified
typetype
- the type of the parent we are looking formatchExactType
- if this option is true, the parents must match the
exact specified type to be returned. Otherwise any type that
derives from the specified type will be returned.
public static java.util.List merge(java.util.List firstList, java.util.List secondList)
firstList
- the first list to add. This parameter can be null.secondList
- the second list to add. This parameter can be null.
public static void debug(java.lang.String message)
message
- the message to showpublic static PropertyCollection addReferenceToList(PropertyCollection referenceToAdd, PropertyCollection list, boolean allowDuplicateReference)
referenceToAdd
- the reference to add. If this parameter is null,
nothing occurs.list
- the list to which we are adding the reference. If this
parameter is null, nothing occurs.allowDuplicateReference
- flag indicating if the list is allowed to
contain duplicate references of the same object.
java.lang.IllegalArgumentException
- if the list doesn't allow addition of
references of the specified type or if the list doesn't
contain references.private static void validateAddTypeToList(PropertyCollection list, PropertyCollection<?,?> typeToAdd, boolean reference)
list
- the property collection listtypeToAdd
- the type to addreference
- is the add a reference
java.lang.IllegalArgumentException
- if the type to add can't be added.private static void validateAddTypeWithInstance(PropertyCollection<?,?> typeToAdd, boolean reference, PropertyCollection valueInstance)
typeToAdd
- the type to addreference
- is the type to add by referencevalueInstance
- the instance to validate against
java.lang.IllegalArgumentException
- if the type or the reference flag
doesn't match the instance.private static java.lang.String getReferenceString(boolean isReference)
isReference
- is a reference
public static PropertyCollection<?,?> getModelFromCollection(PropertyCollection<?,?> collection)
collection
- the collection from which to find the model layer
public static PropertyCollectionController getPropertyCollectionController(PropertyCollection<?,?> controlLayer, PropertyCollection<?,?> collection)
controlLayer
- the control layercollection
- the collection from which to fetch the controller
public static void clearPropertyCollection(PropertyCollection<?,?> collectionToClear)
collectionToClear
- the collection to clear.public static PropertyCollection<?,?> createOrReuseListToMatchType(PropertyCollection<?,?> currentList, PropertyCollection<?,?> requiredListType, PropertyCollection<?,?> fixedInstance, ModelFactory factory)
currentList
- the current listrequiredListType
- the required list typefixedInstance
- the list fixed instancefactory
- the factory used to create the new list if necessary
public static void fillListWithSpecifiedTypes(PropertyCollection listToFill, ModelFactory factory, boolean deleteUnmatchedValues, PropertyCollection<?,?>... typesToCreate)
listToFill
- the list to fill. If null, nothing will be done.factory
- the factory used to populate the list. If null, nothing
will be done.deleteUnmatchedValues
- option to delete unmatched values. If set to
true, any objects in the list that has a type that isn't
requested in the creation will be deleted.typesToCreate
- the list of types of objects to create if necessary.
It is possible to specify the same object type multiple times
if necessary. If a type is defined more than once, than this
method will ensure that the list contains the same number of
objects that match that type.
java.lang.IllegalArgumentException
- if the list values are by reference or
if the types to create don't match the list instance type.private static void validateTypesToCreate(java.util.List<PropertyCollection<?,?>> createList, PropertyCollection instance)
createList
- the list of type to createinstance
- the instance to use
java.lang.IllegalArgumentException
- if the instance is by reference or if
the types to create don't match the instance type.public static void fillOrderedListWithSpecifiedTypes(PropertyCollection listToFill, ModelFactory factory, boolean deleteUnmatchedValues, PropertyCollection<?,?>... typesToCreate)
listToFill
- the list to fill. If null, nothing will be done.factory
- the factory used to populate the list. If null, nothing
will be done.deleteUnmatchedValues
- option to delete unmatched values. If set to
true, any objects in the list that has a type that isn't
requested in the creation will be deleted.typesToCreate
- the list of types of objects to create if necessary.
It is possible to specify the same object type multiple times
if necessary. If a type is defined more than once, than this
method will ensure that the list contains the same number of
objects that match that type.
java.lang.IllegalArgumentException
- if the list isn't an ordered list or if
the ordered values are by reference or if the types to create
don't match the ordering value type.private static java.util.List<PropertyCollection<?,?>> getTypeCreationList(PropertyCollection<?,?>[] typesToCreate)
typesToCreate
- the array of types to create
public static boolean equals(java.lang.Object object1, java.lang.Object object2)
Compares two objects for equality, where either one or both objects may
be null
.
ObjectUtils.equals(null, null) = true ObjectUtils.equals(null, "") = false ObjectUtils.equals("", null) = false ObjectUtils.equals("", "") = true ObjectUtils.equals(Boolean.TRUE, null) = false ObjectUtils.equals(Boolean.TRUE, "true") = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE) = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false
object1
- the first object, may be null
object2
- the second object, may be null
true
if the values of both objects are the same
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |