You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/01/26 18:33:34 UTC
[3/3] git commit: invert if conditions for clarity
invert if conditions for clarity
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/54d9fbb0
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/54d9fbb0
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/54d9fbb0
Branch: refs/heads/trunk
Commit: 54d9fbb031dced55299133d0e103bd4efcb95c14
Parents: e10eb19
Author: Jonathan Ellis <jb...@apache.org>
Authored: Thu Jan 26 01:44:51 2012 -0600
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Thu Jan 26 11:03:43 2012 -0600
----------------------------------------------------------------------
.../org/apache/cassandra/cql3/CFDefinition.java | 44 +++++++-------
1 files changed, 22 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/54d9fbb0/src/java/org/apache/cassandra/cql3/CFDefinition.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/CFDefinition.java b/src/java/org/apache/cassandra/cql3/CFDefinition.java
index def2d2d..ab1a29c 100644
--- a/src/java/org/apache/cassandra/cql3/CFDefinition.java
+++ b/src/java/org/apache/cassandra/cql3/CFDefinition.java
@@ -61,7 +61,18 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
{
this.isComposite = true;
CompositeType composite = (CompositeType)cfm.comparator;
- if (!cfm.getColumn_metadata().isEmpty())
+ if (cfm.getColumn_metadata().isEmpty())
+ {
+ // "dense" composite
+ this.isCompact = true;
+ for (int i = 0; i < composite.types.size(); i++)
+ {
+ ColumnIdentifier id = getColumnId(cfm, i);
+ this.columns.put(id, new Name(id, Name.Kind.COLUMN_ALIAS, i, composite.types.get(i)));
+ }
+ this.value = new Name(getValueId(cfm), Name.Kind.VALUE_ALIAS, cfm.getDefaultValidator());
+ }
+ else
{
// "sparse" composite
this.isCompact = false;
@@ -79,22 +90,20 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
this.metadata.put(id, new Name(id, Name.Kind.COLUMN_METADATA, def.getValue().getValidator()));
}
}
- else
- {
- // "dense" composite
- this.isCompact = true;
- for (int i = 0; i < composite.types.size(); i++)
- {
- ColumnIdentifier id = getColumnId(cfm, i);
- this.columns.put(id, new Name(id, Name.Kind.COLUMN_ALIAS, i, composite.types.get(i)));
- }
- this.value = new Name(getValueId(cfm), Name.Kind.VALUE_ALIAS, cfm.getDefaultValidator());
- }
}
else
{
this.isComposite = false;
- if (!cfm.getColumn_metadata().isEmpty())
+ if (cfm.getColumn_metadata().isEmpty())
+ {
+ // dynamic CF
+ this.isCompact = true;
+ ColumnIdentifier id = getColumnId(cfm, 0);
+ Name name = new Name(id, Name.Kind.COLUMN_ALIAS, 0, cfm.comparator);
+ this.columns.put(id, name);
+ this.value = new Name(getValueId(cfm), Name.Kind.VALUE_ALIAS, cfm.getDefaultValidator());
+ }
+ else
{
// static CF
this.isCompact = false;
@@ -107,15 +116,6 @@ public class CFDefinition implements Iterable<CFDefinition.Name>
this.metadata.put(id, new Name(id, Name.Kind.COLUMN_METADATA, def.getValue().getValidator()));
}
}
- else
- {
- // dynamic CF
- this.isCompact = true;
- ColumnIdentifier id = getColumnId(cfm, 0);
- Name name = new Name(id, Name.Kind.COLUMN_ALIAS, 0, cfm.comparator);
- this.columns.put(id, name);
- this.value = new Name(getValueId(cfm), Name.Kind.VALUE_ALIAS, cfm.getDefaultValidator());
- }
}
assert value == null || metadata.isEmpty();
}