-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optical circuit experimenter changes
- Loading branch information
Praseed Balakrishnan
committed
Oct 9, 2014
1 parent
7f71878
commit 2ed6da0
Showing
10 changed files
with
181 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/CircuitSignalID.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
package org.projectfloodlight.openflow.types; | ||
|
||
import com.google.common.collect.ComparisonChain; | ||
import org.jboss.netty.buffer.ChannelBuffer; | ||
import org.projectfloodlight.openflow.exceptions.OFParseError; | ||
|
||
import com.google.common.hash.PrimitiveSink; | ||
|
||
|
||
public class CircuitSignalID implements OFValueType<CircuitSignalID> { | ||
static final int length = 6; | ||
|
||
private byte gridType; | ||
private byte channelSpacing ; | ||
private short channelNumber; | ||
private short spectralWidth; | ||
|
||
public static final CircuitSignalID NONE = new CircuitSignalID((byte)0, | ||
(byte)0, | ||
(short)0, | ||
(short)0); | ||
|
||
|
||
public CircuitSignalID(byte gridType, byte channelSpacing, | ||
short channelNumber, | ||
short spectralWidth) | ||
{ | ||
this.gridType = gridType; | ||
this.channelSpacing = channelSpacing; | ||
this.channelNumber = channelNumber; | ||
this.spectralWidth = spectralWidth; | ||
|
||
} | ||
|
||
@Override | ||
public int getLength() { | ||
return length; | ||
} | ||
|
||
|
||
public void write6Bytes(ChannelBuffer c) { | ||
c.writeByte(gridType); | ||
c.writeByte(channelSpacing); | ||
c.writeShort(channelNumber); | ||
c.writeShort(spectralWidth); | ||
} | ||
|
||
public static CircuitSignalID read6Bytes(ChannelBuffer c) throws OFParseError { | ||
return new CircuitSignalID((byte)c.readUnsignedByte(), | ||
(byte)c.readUnsignedByte(), | ||
(short)c.readUnsignedShort(), | ||
(short)c.readUnsignedShort()); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
CircuitSignalID that = (CircuitSignalID) o; | ||
|
||
if (channelNumber != that.channelNumber) return false; | ||
if (channelSpacing != that.channelSpacing) return false; | ||
if (gridType != that.gridType) return false; | ||
if (spectralWidth != that.spectralWidth) return false; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = (int) gridType; | ||
result = 31 * result + (int) channelSpacing; | ||
result = 31 * result + (int) channelNumber; | ||
result = 31 * result + (int) spectralWidth; | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CircuitSignalID{" + | ||
"gridType=" + gridType + | ||
", channelSpacing=" + channelSpacing + | ||
", channelNumber=" + channelNumber + | ||
", spectralWidth=" + spectralWidth + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public CircuitSignalID applyMask(CircuitSignalID mask) { | ||
return new CircuitSignalID((byte) (this.gridType & mask.gridType), | ||
(byte) (this.channelSpacing & mask | ||
.channelSpacing), | ||
(short) (this.channelNumber & mask | ||
.channelNumber), | ||
(short) (this.spectralWidth & mask | ||
.spectralWidth)); | ||
} | ||
|
||
|
||
@Override | ||
public int compareTo(CircuitSignalID o) { | ||
return ComparisonChain.start() | ||
.compare(gridType,o.gridType) | ||
.compare(channelSpacing,o.channelSpacing) | ||
.compare(channelNumber,o.channelNumber) | ||
.compare(spectralWidth,o.spectralWidth) | ||
.result(); | ||
} | ||
|
||
|
||
@Override | ||
public void putTo(PrimitiveSink sink) { | ||
sink.putByte(gridType); | ||
sink.putByte(channelSpacing); | ||
sink.putShort(channelNumber); | ||
sink.putShort(spectralWidth); | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters