text stringlengths 14 410k | label int32 0 9 |
|---|---|
static final void method3716(boolean bool, int i, boolean bool_11_, int i_12_, IComponentDefinitions[] widgets, int i_13_) {
anInt8286++;
int i_14_ = 0;
if (bool == true) {
for (/**/; (widgets.length ^ 0xffffffff) < (i_14_ ^ 0xffffffff); i_14_++) {
IComponentDefinitions widget = widgets[i_14_];
if (wid... | 9 |
@Override
public IDecimal round(final IDecimal decimal, final double layout, final int scale)
{
final PreciseDecimal pd = (PreciseDecimal) decimal;
final int layoutDigits = DPU.getFractionalDigitsCount(layout);
final int droppedDigits = pd.getFactor() - (scale + layoutDigits);
final int layoutBase = (int) (DPU.... | 4 |
@Override
public void performOperation(String name, ArgParser args) {
String referencePath = null;
String inputBAMPath = null;
try {
referencePath = getRequiredStringArg(args, "-R", "Missing required argument for reference file, use -R");
inputBAMPath = getRequiredStringArg(args, "-B", "Missing required ar... | 8 |
@Override
public O_02_MultipleAddressCallInput deserialize(ByteBuf packetPDU) {
String npl = Serialization.getString(packetPDU);
String rads = Serialization.getString(packetPDU);
String oadc = Serialization.getString(packetPDU);
String ac = Serialization.getString(packetPDU);
char mt = Serialization.getCh... | 2 |
public void analyze() {
if (GlobalOptions.verboseLevel > 1)
GlobalOptions.err.println("Analyze: " + this);
String type = getType();
int index = type.indexOf('L');
while (index != -1) {
int end = type.indexOf(';', index);
Main.getClassBundle().reachableClass(
type.substring(index + 1, end).replace... | 5 |
@Override
public void actionPerformed(ActionEvent ae) {
//Notify all listeners that a comboBox has changed
if (ae.getSource().equals(comboBox)) {
if (!listeners.isEmpty()) {
for (ActionListener thisListener : listeners) {
thisListener.actionPerformed(n... | 3 |
@Override
public boolean accept(final File path) {
if ((path != null)
&& path.getName().equalsIgnoreCase(
JSocksProxy.CONFIGURATION_XML)
&& path.isFile()) {
return true;
} else if ((path != null) && path.isDirectory()) {
return true;
}
return false;
} | 5 |
private void waitForSlaveUpdates(
List<Future<ReplicationResult>> replicatedSlaveFutures) {
List<ReplicationResult> slaveServers = new ArrayList<ReplicationResult>();
for (Future<ReplicationResult> slaveServer : replicatedSlaveFutures) {
try {
// block until the future result is available
slaveServer... | 5 |
private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {
double[][] inputValues = this.learning.getInputValues();
double[][] outputValues =this.learning.getOutputValues();
currentScenario++;
if (currentScenario==inputValues.length){
cu... | 3 |
public void run(){
try {
InputStream inputStream = mainSocket.getInputStream();
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
OutputStream outputStream = mainSocket.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);
Strin... | 2 |
public void setGraph(Graph g) {
this.graph = g;
} | 0 |
public static boolean isUniqueChars(String s){
if(s == null)
return false;
HashSet<Character> chars = new HashSet<Character>();
for(int i = 0; i < s.length(); i++ ) {
if(chars.contains(s.charAt(i)))
return false;
else
chars.add(s.charAt(i));
}
return true;
} | 3 |
public boolean isNull(String key) {
return JSONObject.NULL.equals(this.opt(key));
} | 0 |
public QuaternionPFDPanel() {
super();
projection = new LambertAzimutalEqualAreaProjection();
// projection = PerspectiveProjection.GNOMONIC_PROJECTION;
orientation = new Quaternion().fromAxis(0, 0, 0, 1);
orientation.normalize();
momentum = new Quaternion(0.01, new Vec3d(0, 1, 0));
objects = new Ar... | 9 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static HireFacilityEnumeration fromValue(String v) {
for (HireFacilityEnumeration c: HireFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} | 2 |
private RealMatrixExt computeStatisticalSpectrumDescriptor(RealMatrix sonogram, int bandLimit) {
double[][] matrixSSD = new double[bandLimit][N_STATISTICAL_DESCRIPTORS];
int nRows = sonogram.getRowDimension();
if (nRows < bandLimit) { // requested number of bands is > than actual # of bands -> ... | 3 |
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
// game loop
while (true) {
List<Enemy> enemies = new ArrayList<Enemy>();
int count = in.nextInt(); // The number of current enemy ships within range
in.nextLine();
for... | 3 |
public static Digit fromLong(final long i) {
final long x = Math.abs(i) % 10L;
return x == 0L ? _0 :
x == 1L ? _1 :
x == 2L ? _2 :
x == 3L ? _3 :
x == 4L ? _4 :
x == 5L ? _5 :
x == 6L ? _6 :
... | 9 |
final int getSize(final ClassWriter cw, final byte[] code, final int len,
final int maxStack, final int maxLocals) {
Attribute attr = this;
int size = 0;
while (attr != null) {
cw.newUTF8(attr.type);
size += attr.write(cw, code, len, maxStack, maxLocals).length + 6;
attr = attr.next;
}
return size... | 1 |
private static int isHappy(String str)
{
int num;
ArrayList<Integer> numbersSeen;
num = Integer.parseInt(str);
numbersSeen = new ArrayList<Integer>();
while(num != 1)
{
int q;
int r;
q = num;
r = 0;
while(q > 0) //Loop through each digit.
{
r += q%10 * (q%10); //Add the squares of eac... | 3 |
public final boolean remove(final K key) {
boolean r;
if (pruned) { r = removeP(key); }
else { r = removeB(key); }
if (r) { size--; }
return r;
} | 2 |
public QReadMaze(String filePath, double nonTerminalReward) {
try {
FileReader f = new FileReader(filePath);
BufferedReader b = new BufferedReader(f);
Pattern pattern = Pattern.compile("(\\w|[\\+|\\-]\\d+|\\%)");
Matcher matcher;
String s = null;
Str... | 7 |
private void loadID3v2(InputStream in)
{
int size = -1;
try
{
// Read ID3v2 header (10 bytes).
in.mark(10);
size = readID3v2Header(in);
header_pos = size;
}
catch (IOException e)
{}
finally
{
try
{
// Unread ID3v2 header (10 bytes).
in.reset();
}
catch (IOExcepti... | 4 |
public synchronized void beginThreadAccess() {
Object requestingUser = Thread.currentThread();
while (true) {
if (m_oCurrentUser == null) {
m_oCurrentUser = requestingUser;
break;
} else if (m_oCurrentUser == requestingUser) {
brea... | 4 |
private void Escola_ComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Escola_ComboBoxItemStateChanged
Equipa_ComboBox.removeAllItems();
Escola escola = a.getDAOEscola().get(Escola_ComboBox.getSelectedItem().toString());
if (escola != null) {
for (Equipa equipa... | 2 |
public int getY() {
return y;
} | 0 |
protected String decodePercent(String str) {
String decoded = null;
try {
decoded = URLDecoder.decode(str, "UTF8");
} catch (UnsupportedEncodingException ignored) {
}
return decoded;
} | 1 |
public static long read32bitUnsignedInt(RandomAccessFile f) throws IOException {
Integer d0,d1,d2,d3;
d0=0xff & read_sure(f);
d1=0xff & read_sure(f);
d2=0xff & read_sure(f);
d3=0xff & read_sure(f);
return (d0<<24) + (d1<<16) + (d2<<8) + d3;
} | 0 |
public static void main(String[] args) {
RollTracker roll = new RollTracker(new DevelopmentList());
ArrayList<Die> dice = new ArrayList<Die>();
for (int i = 0; i < 6; i++) {
dice.add(new Die());
}
roll.rollDice(dice);
System.out.println("Here are the dice rolled:");
for (int i = 0; i < dice.size(); i+... | 5 |
public Combination<Colors> getAttempt() {
return attempt;
} | 0 |
private CacheResult compareVersionKey(CacheDefinition cacheDefinition, CacheResult cacheResult,
CacheObject oldItem, Object[] args) {
long itemVersion = oldItem.getVersion();
Object cachedItem = oldItem.getCacheObject();
Object[] params;
boolean isReturnCollection = cacheDefinition.isReturnCollection();
/... | 8 |
public void performMovement() {
if (this.rover == null) {
System.out.println("Please land the rover first");
} else {
String[] instructions = this.movementPlanned.toUpperCase().split("(?!^)");
for (String instruction : instructions) {
if (instruction.equals("M")) {
this.rover... | 5 |
public Step playPC(){ //CALCOLO MOSSA MIGLIORE
blackSteps_Move = new TreeSet<Step>();
blackSteps_Eat = new TreeSet<Step>();
for(int i = 0; i < 8; i++)
for(int j = 0; j < 8; j++){
if (!board.getCell(i, j).getColor() && !board.getCell(i, j).isEmpty() && !board.getCell(i, j).getColorPawn()){
... | 8 |
private void appendMethod(StringBuilder builder, String className, String methodName) {
if (lastClass == null || !lastClass.equals(className)
|| !lastMethodForClass.containsKey(className)
|| !lastMethodForClass.get(className).equals(methodName)) {
builder.append('\t')... | 4 |
public void setInstances(Instances inst) {
m_Instances = inst;
m_ignoreKeyModel.removeAllElements();
String [] attribNames = new String [m_Instances.numAttributes()];
for (int i = 0; i < m_Instances.numAttributes(); i++) {
String name = m_Instances.attribute(i).name();
m_ignoreKeyM... | 7 |
public void createPlayer(KrakenState statePlayer,int typeOfPlayer){
switch (typeOfPlayer) {
case 0:
player1 = new MachinePlayer(statePlayer,this,KrakenColor.WHITE_PLAYER);
player2 = new MachinePlayer(statePlayer,this,KrakenColor.BLACK_PLAYER);
break;
case 1:
player1 = new MachinePlayer(statePlayer,thi... | 4 |
@Override
public void validate(Object target, Errors errors) {
PriceIncrease pi = (PriceIncrease) target;
if (pi == null) {
errors.rejectValue("percentage", "error.not-sprcified", null, "value required");
} else {
if (pi.getPercentage() > maxPercentage) {
... | 3 |
private void initSeatTypes() {
this._seatTypes = new SeatType[] {
new SeatType(UUID.randomUUID(), "硬座", 1L),
new SeatType(UUID.randomUUID(), "软座", 2L),
new SeatType(UUID.randomUUID(), "硬卧", 4L),
new SeatType(UUID.randomUUID(), "二级软卧", 8L),
new SeatType(UUID.randomUUID(), "一级软卧 ", 0x10L)
};
} | 0 |
public JPanel getCommandBtnChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.commandBtnPanel;
} | 1 |
@Override
public boolean execute(RuleExecutorParam param) {
Rule rule = param.getRule();
List<String> values = Util.getValue(param, rule);
if (values == null || values.isEmpty()) {
return false;
}
boolean retValue = true;
for (String value : values) {
String compareValue = rule.getValue();
if (rul... | 6 |
public int getHoeveelGoed() {
int score = 0;
for (GekozenAntwoord gk : _antwoorden)
if (gk.isGoed()) score++;
return score;
} | 2 |
public Memory(int speed, Queue []inputBuffers, Queue []outputBuffers)
{
//passes the constructor values to the base class SwitchingFabric
super(speed, inputBuffers, outputBuffers, VERTICALBUSES);
//indicate has no memory
hasMemory = true;
//set the recent bus, because it neve... | 0 |
private void checkEntities() {
for (Entity entity : entityChangeBuffer) {
boolean interested = true;
boolean contains = entity.getSystemBits().get(
world.getSystemId(this.getClass()));
BitSet entityComponentBits = entity.getComponentBits();
for (int i = componentBits.nextSetBit(0); i >= 0; i = compo... | 7 |
public OutConnectionHandler(ObjectOutputStream out) { this.out = out; } | 0 |
public static void vuelcaFicheroAVentas(HashMap<Integer, Ventas> tablaVentas)
{
String linea;
FileReader ficheroVentasRead = null;
BufferedReader br = null;
StringTokenizer orden = null;
int[] arrayLinea = null;
Ventas venta = null;
arrayLinea = new int[3]; // Guarda los 3 valores de la linea
try... | 5 |
public static ArrayList<Platform> getPlatformSectors(Rectangle2D r) {
ArrayList<Platform> platforms = new ArrayList<Platform>();
Point p = new Point((int) (r.getX() / tileSize), (int) (r.getY() / tileSize));
if(platformMap.containsKey(p)) {
platforms.addAll(platformMap.get(p));
}
Point p2 = new Point... | 9 |
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event) {
if (HyperPVP.getSpectators().containsKey(event.getPlayer().getName()) || HyperPVP.isCycling() && !event.getPlayer().isOp()) {
event.setCancelled(true);
return;
}
Item drop = event.getItemDrop();
if (drop.getItemStack().getType() =... | 7 |
@Test
public void viewUpdateTest() {
propertyChangeSupport.firePropertyChange(MainWindowController.NUMBER_OF_POINTS, 0, 100);
assertEquals(view.getNumberOfPointsTextField().getText(), "100");
propertyChangeSupport.firePropertyChange(MainWindowController.INTEGRATION_METHOD, 0, IntegrationMeth... | 0 |
public void setRZAxisDeadZone(float zone) {
setDeadZone(rzaxis,zone);
} | 0 |
public void render(Screen screen) {
// double open = Math.sin(System.currentTimeMillis() % 1000 / 1000.0*Math.PI*2)*0.5+0.5;
double open = openness * 0.47;
List<Sprite> doorSprites = ((Door) sprites).doorSprites;
if (level.getTile(x, y - 1).isWall() && level.getTile(x, y + 1).isWa... | 6 |
private synchronized void evenIncrement() {
i++;
Thread.yield();
i++;
} | 0 |
public static File createFolder(String currentDir, String folderName)
{
if (currentDir == null)
return null;
File newFolder = new File (currentDir + File.separator + folderName);
if (newFolder.exists ())
return null;
if (newFolder.mkdir ())
return newFolder;
return null;
} | 3 |
@Override
public void deleteUser(User user) throws SQLException {
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(user);
session.getTransaction().commit();
}catch(Exception e){
e.printStackTrace();
}finally{
if(ses... | 3 |
public static ListNode mergeKLists(List<ListNode> lists) {
if (lists.size() == 0)
return null;
ListNode result = null;
Boolean complete = false;
ListNode head = null;
while (!complete) {
complete = true;
ListNode minNode = null;
for (ListNode n : lists) {
if (n == null)
continue;
comp... | 9 |
public static boolean defaultInteract(EntityType type) {
boolean b = false;
switch (type) {
case OBJ_TREE:
break;
case OBJ_DOOR_WOOD:
b = true;
break;
}
return b;
} | 2 |
public int getUsersNumber(){
int number=0;
String requete= "select count(*) from user";
try {
Statement statement = MyConnection.getInstance().createStatement();
ResultSet resultat = statement.executeQuery(requete);
while(resultat.next()){
numb... | 2 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
@Override
public SquareMatrix exponentiation(int exponent) {
int row = this.getRowsNumber();
for (int i = 0; i < row; i++) {
for (int j = 0; j < row; j++) {
double sum = 0;
for (int k = 0; k < row; k++) {
try {
sum += this.getElementAt(i + 1, k + 1)
* this.getElementAt(k + 1, j + 1)... | 5 |
public static int get(int addr) {
if (Util.inRange(addr, 0, 0x00EF)) { // Zero page
return mem[addr];
} else if (Util.inRange(addr, 0x00F0, 0x00FF)) { // Function registers
return readReg(addr);
} else if (Util.inRange(addr, 0x0100, 0x7FFF)) { // Sound RAM
return mem[addr];
} else if (Util.inRange(addr... | 6 |
public boolean hasNext() {
if (++pos >= bucket.sizes[arrayIndex]) {
// end of array, next array
pos = 0;
do {
++arrayIndex;
} while (arrayIndex < bucket.data.length && bucket.sizes[arrayIndex] == 0);
if (arrayIndex == bucket.data.length) {
// end of bucket, next bucket
while ... | 9 |
public void setMaxRound(int maxRound)
{
this.maxRound = maxRound;
notifyListeners();
} | 0 |
@Override
public Product readObject() throws IOException {
Product readObject = null;
if (!connectionInStatus) {
startInputConnection();
}
if (connectionInStatus) {
try {
readObject = (Product) xmlDecoder.readObject();
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
}
return... | 3 |
public BufferedReaderIterator()
{
try {
if ( maxLines != 0 ) {
nextline = reader.readLine();
}
} catch ( IOException ex ) {
throw new IllegalArgumentException( ex );
}
} | 2 |
private static boolean isItPalindrome(Integer integer) {
Integer reversedInt = reverseInt(integer);
if (reversedInt.equals(integer)) {
return true;
} else {
return false;
}
} | 1 |
@Override
public void tick(LinkedList<GameObject> object) {
if (currentHP <= 0) {
t.setDuration(0); // Stops timed event
Event.enemyKilled(type);
handler.removeObject(this);
}
x += velX;
y += velY;
if (falling || jumping) {
vel... | 4 |
public void writeCompares() {
String path = output.toString() + "/" + measurementName
+ "_comparingOperations.txt";
comparingOperations = new File(path);
if (comparingOperations.exists()) {
try {
fr = new FileReader(path);
br = new BufferedReader(fr);
StringBuffer buffer = new StringBuffer(... | 5 |
protected static void drawRoom(ByteChunk chunk, Room[][][] rooms, int floor, boolean topFloor, int x, int z,
int roomOffsetX, int roomOffsetZ, int baseY, byte matFloor, byte matWall, byte matRoof) {
//TODO I think this function suffers from the North = West problem
// which room?
Room room = rooms[floor][x][z... | 9 |
public IconPanel() {
this.setPreferredSize(new Dimension(50, 50));
this.setMaximumSize(new Dimension(50, 50));
} | 0 |
public void afficherMenuPrincipal() {
scan = scan.reset();
System.out.println("Bienvenue dans votre université !");
System.out.println("Veuillez vous connecter ");
do {
System.out.print("login : ");
String login = scan.nextLine();
System.out.print("mot... | 5 |
public void setIdEntrada(Integer idEntrada) {
this.idEntrada = idEntrada;
} | 0 |
private Content createContent(String line, int set)
{
line = Utils.formatString(line);
switch(set){
case Types.VGDL_GAME_DEF:
return new GameContent(line);
case Types.VGDL_SPRITE_SET:
return new SpriteContent(line);
//
... | 5 |
public void visit_ishr(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} | 1 |
public boolean globalReSearchAction() {
TreeItem[] selection = vermilionCascadeNotebook.getTree().getSelection();
if (selection.length == 1 && currentItem == selection[0]) {
lastFoundItem = currentItem;
return searchAction();
}
if (selection.length == 1 && currentItem != selection[0]) {
lastFou... | 4 |
public entity(float x, float y, float width, float height, String texturePath, boolean visible) {
this.x = x;
this.y = y;
total_width = width;
total_height = height;
this.width = total_width*start.zoom;
this.height = total_height*start.zoom;
this.visible = visible;
try {
this.texture = TextureLoader.... | 2 |
public void searchLogradouro() {
facesContext = FacesContext.getCurrentInstance();
requestContext = RequestContext.getCurrentInstance();
List<Logradouro> listLogradouro;
try {
logradouro.setLog_bairro_id(this.bairro);
listLogradouro = genericDAO.searchObject(Logradouro.class,"... | 3 |
static private String toString(Class type) {
if (type == Dictionary.class) {
return "dictionary";
} else if (type == ZemArray.class) {
return "array";
} else if (type == ZemBoolean.class) {
return "boolean";
} else if (type == ZemNumber.class) {
... | 5 |
@Override
protected void paintComponent(Graphics gc) {
Rectangle bounds = gc.getClipBounds();
if (bounds == null) {
bounds = new Rectangle(0, 0, getWidth(), getHeight());
}
gc.setColor(getBackground());
gc.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
drawDividers(gc, getLayout(), bounds);
... | 1 |
int getVotingResult()
{
int result = 0;
for(int i=0; i<committerByRowsList.length;i++)
result += committerByRowsList[i];
for(int i=0; i<committerByColumnsList.length;i++)
result += committerByColumnsList[i];
for(int i=0; i<committerBySquaresList.length;i++)
result += committerBySquaresList[i]... | 4 |
public int popNPCFromCoords(int areaX, int areaY, int x, int y) {
int[] wh;
NPC npc;
for (SpriteEntry e : spriteAreas[areaY][areaX]) {
npc = npcs[e.npcID];
wh = spriteGroupDims[npc.sprite];
if ((e.x >= x - wh[0] / 2) && (e.x <= x + wh[0] / 2)
&& (e.y >= y - wh[1] / 2) && (e.y <= y + wh[1] / 2... | 5 |
static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... | 9 |
public void updateLobby(Map<String, String[]> lobbyGames) {
// Keep track of whether the user is currently in a game
boolean isAlreadyInGame = false;
DefaultTableModel model = (DefaultTableModel) lobby_table.getModel();
// Delete previous data
model.setR... | 6 |
private void fullFillConditionBeans()
throws CorrespondingDimensionNotExistsException {
for (ConditionBean conditionBean : conditionBeans) {
String dimensionName = conditionBean.getDimensionName();
SortedSet<Dimension> dimensions = fromSchema.getDimensions();
Dime... | 7 |
private static void printHelper(LinkSetNode n, int indent) {
if (n == null) {
System.out.print("<empty tree>");
return;
}
if (n.right != null) {
printHelper(n.right, indent + INDENT_STEP);
}
for (int i = 0; i < indent; i++)
System.o... | 5 |
public GPSOffice(String[] args) throws IOException, NotBoundException {
// Parse command line arguments
if (args.length != 5) {
throw new IllegalArgumentException(
"Usage: java Start GPSOffice <hostName> <portNumber> <officeName> <X> <Y>");
}
hostName = args[0];
portNumber = parseInt(args[1], "portNum... | 6 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Role other = (Role) obj;
if (roleID == null) {
if (other.roleID != null)
return false;
} else if (!roleID.equals(other.roleID))
retur... | 9 |
public static Hashtable<Long,Boolean> categories() throws SQLException {
PreparedStatement s = null;
Hashtable<Long,Boolean> table = new Hashtable<Long,Boolean>();
try {
currentCon = DriverManager.getConnection(dbName);
String query = "SELECT cid FROM products";
s = currentCon.prepareStatement(query);
... | 7 |
public void setEntradasIdEntrada(Entradas entradasIdEntrada) {
this.entradasIdEntrada = entradasIdEntrada;
} | 0 |
public ImageGenerator(int bitsPerChannel, String fileName, Random rng, Evaluator evaluator, boolean strictFrame)
{
this.bitsPerChannel = bitsPerChannel;
this.fileName = fileName;
this.evaluator = evaluator;
this.rng = rng;
int length = 3 * bitsPerChannel;
int shorter... | 1 |
private void generateRockOre() {
switch (new Random().nextInt(2)) { // Switch a random int, 0 or 1 for a Rock
case 0:
setHasRock(true);
break;
case 1:
setHasRock(false);
break;
}
if (isHasRock()) {
switch (new Random().nextInt(2)) { // Switch a random int, 0 or 1 for Ore
case 0:
setHasO... | 6 |
protected boolean isFinished() {
return false;
} | 0 |
public static <GItem> Iterator<GItem> limitedIterator(final int count, final Iterator<? extends GItem> iterator)
throws NullPointerException, IllegalArgumentException {
if (count < 0) throw new IllegalArgumentException("count < 0");
if (iterator == null) throw new NullPointerException("iterator = null");
if (co... | 6 |
private void ekskey(byte data[], byte key[]) {
int i;
int koffp[] = { 0 }, doffp[] = { 0 };
int lr[] = { 0, 0 };
int plen = P.length, slen = S.length;
for (i = 0; i < plen; i++)
P[i] = P[i] ^ streamtoword(key, koffp);
for (i = 0; i < plen; i += 2) {
lr[0] ^= streamtoword(data, doffp);
lr[1] ^= st... | 3 |
public static boolean hasNulls(Pair<?> p)
{
return p.getFirst() == null || p.getSecond() == null;
} | 2 |
@Test
public void testPublish() throws Exception {
l1.info("Test Message:1");
l2.info("Test Message:2");
StringBuilder sb = new StringBuilder();
for(int i = 1; i <= 10; i++) {
sb.append("Test Line ").append(i).append("!");
sb.append("\n");
}
l1.info(sb.toString()+1);
l2.info(sb.toString()+2);
} | 1 |
public static Path convertRGBToJPEG(File fileEntry) {
try {
MediaType type = getFileType(fileEntry);
if (type != MediaType.Video && fileEntry.toString().endsWith(".rgb")) {
String outputFileName = getFileNameWithoutExtension(fileEntry.toString()) + ".jpg";
File outputFile = new File(outputFileName);
... | 5 |
public synchronized void releaseConnection(DBConnection dbc) {
boolean ok = used.remove(dbc);
if (ok) {
if (free.size() >= minsize) {
dbc.close();
System.out.println("Deleting 1 connection...");
} else {
free.add(dbc);
... | 2 |
@Override
public com.flickr4java.flickr.Response get(String path, Map<String, Object> parameters, String sharedSecret) {
OAuthRequest request = new OAuthRequest(Verb.GET, API_HOST + path);
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
request.addQuerystringParameter(en... | 9 |
protected void recursiveBalance(TreeNode currentNode) {
setBalance(currentNode);
int balance = currentNode.balance;
if (balance == -2) {
if (height(currentNode.left.left) >= height(currentNode.left.right)) {
currentNode = rotateRight(currentNode);
} else {
currentNode = doubleRotateLeftRight(c... | 5 |
public void mouseClick(Point p){
if(clicked)return;
if(headingLbl.getBounds() == null
|| helpBtn.getLabel().getBounds() == null){
return;
}
if(prevGame){
if(loadGameBtn.getLabel().getBounds().contains(p)){
//handler.objects.add(null);
handler.objects.remove(this);
}
}else{
if(new... | 7 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.