Java Code Examples for skadistats.clarity.model.Entity#getIndex()

The following examples show how to use skadistats.clarity.model.Entity#getIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertyChange.java    From clarity with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
boolean applyInternal(Object[] value) {
    Entity e = (Entity) value[0];
    int eIdx = e.getIndex();
    TriState classMatchState = classMatchesForEntity.get(eIdx);
    if (classMatchState == TriState.UNSET) {
        classMatchState = TriState.fromBoolean(classPattern.matcher(e.getDtClass().getDtName()).matches());
        classMatchesForEntity.set(eIdx, classMatchState);
    }
    if (classMatchState != TriState.YES) {
        return false;
    }
    FieldPath fp = (FieldPath) value[1];
    TriState propertyMatchState = propertyMatchesForEntity[eIdx].get(fp);
    if (propertyMatchState == null) {
        propertyMatchState = TriState.fromBoolean(propertyPattern.matcher(e.getDtClass().getNameForFieldPath(fp)).matches());
        propertyMatchesForEntity[eIdx].put(fp, propertyMatchState);
    }
    if (propertyMatchState != TriState.YES) {
        return false;
    }
    return true;
}
 
Example 2
Source File: ObservableEntityList.java    From clarity-analyzer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@OnEntityCreated
public void onCreate(Entity entity) {
    lock.lock();
    try {
        markChange(CF_LIST);
        int i = entity.getIndex();
        //System.out.println("create " + i);
        changes[i] = new ObservableEntity(entity);
    } finally {
        lock.unlock();
    }
}
 
Example 3
Source File: ObservableEntityList.java    From clarity-analyzer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@OnEntityUpdated
public void onUpdate(Entity entity, FieldPath[] fieldPaths, int num) {
    lock.lock();
    try {
        markChange(CF_PROP);
        int i = entity.getIndex();
        ObservableEntity e = changes[i] == null ? entities[i] : changes[i];
        e.update(fieldPaths, num);
    } finally {
        lock.unlock();
    }
}
 
Example 4
Source File: ObservableEntityList.java    From clarity-analyzer with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@OnEntityDeleted
public void onDelete(Entity entity) {
    lock.lock();
    try {
        markChange(CF_LIST);
        int i = entity.getIndex();
        //System.out.println("delete " + i);
        changes[i] = new ObservableEntity(i);
    } finally {
        lock.unlock();
    }
}
 
Example 5
Source File: ClientFrame.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void setEntity(Entity e) {
    int eIdx = e.getIndex();
    this.entity[eIdx] = e;
    this.lastHandle[eIdx] = e.getHandle();
}
 
Example 6
Source File: ClientFrame.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void removeEntity(Entity e) {
    int eIdx = e.getIndex();
    this.entity[eIdx] = null;
}
 
Example 7
Source File: PropertyChange.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void clear(Entity e) {
    int eIdx = e.getIndex();
    classMatchesForEntity.set(eIdx, TriState.UNSET);
    propertyMatchesForEntity[eIdx].clear();
}