text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void drawCenteredStringMoveXY(String string, int x, int y, int color, int waveAmount) {
if (string == null) {
return;
}
x -= getTextWidth(string) / 2;
y -= baseHeight;
for (int index = 0; index < string.length(); index++) {
char c = string.charAt(index);
if (c != ' ') {
drawCharacter(chara... | 3 |
private boolean checkRows()
{
boolean deleteThisRow;
boolean retval = false;
for(int i = 0; i < rows; i++)
{
deleteThisRow = false;
for(int h = 0; h < columns; h++)
{
if(bricks[i][h] == null)
... | 5 |
private void geocentreToTopocentre(double time, Vector position,
Vector velocity) {
final double FL = 1.0 / 298.257; /* Flattening of the earth */
final double RE = 6378.14; /* Radius of Earth in km. */
final double OMEGA = 7.2921151467e-5; /*
* Earth's rotation in
* radians/second
... | 3 |
public ArrayList<Integer> traversal(ListNode head){
ArrayList<Integer> res = new ArrayList<Integer>();
ListNode p = head;
while(p != null){
res.add(p.val);
p = p.next;
}
return res;
} | 1 |
public static void printPattern(boolean[] pattern){
System.out.print("|");
for (int i = 0; i < pattern.length; i++){
if (pattern[i]) System.out.print(""+1);
else System.out.print(""+0);
System.out.print("|");
}
} | 2 |
@Basic
@Column(name = "PRP_ID_FUNCIONARIO")
public Integer getPrpIdFuncionario() {
return prpIdFuncionario;
} | 0 |
private void backward(int[] sequence, double[][] bwd, double[] scaling) {
int T = sequence.length;
int S = this.getNumberOfStates();
double[] pi = this.pi;
double[][] a = this.a;
double[][] b = this.b;
// 1. Initialization
double sc = 1.0d / scaling[T - 1];
... | 4 |
public boolean equals (Time t) {
this.format();
t.format();
return this.day == t.day && this.hour == t.hour && this.min == t.min;
} | 2 |
@Override
public Piece createPiece(Position pos, PieceType pieceType,
final ChessColor color, ChessCoord initialCoord) {
Piece result;
switch (pieceType) {
case PAWN:
result = new Pawn(pos, color, initialCoord);
break;
case ROOK:
/*
* At the moment we assign kingside rooks to be the on... | 6 |
@Override
public void deserialize(Buffer buf) {
questId = buf.readUShort();
if (questId < 0 || questId > 65535)
throw new RuntimeException("Forbidden value on questId = " + questId + ", it doesn't respect the following condition : questId < 0 || questId > 65535");
stepId = buf.re... | 4 |
public String[] listClasses(String packageName, boolean recurse) {
List<String> ret = new LinkedList<String>();
// scan dirs
final String fileSystemPackagePath = packageName.replace('.', File.separatorChar);
for (File dir : dirs) {
File subfolder = new File(dir, fileSystemPackagePath);
if (subfolder.ex... | 9 |
Vector<Integer> crossCheck(Vector<Integer> possibilities, Vector<Integer> confirmations) {
Vector<Integer> result = new Vector<>(6);
if (possibilities.size() == 0) {
for (int cellId : confirmations) {
if (cellId >= 0) {
result.add(cellId);
... | 9 |
protected Behaviour getNextStep() {
if (beginTime == -1) beginTime = actor.world().currentTime() ;
final float elapsed = actor.world().currentTime() - beginTime ;
if (elapsed > WAIT_TIME / 2) {
final Behaviour nextJob = venue.jobFor(actor) ;
if (elapsed > WAIT_TIME || ! (nextJob instanceof Super... | 4 |
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (isVisible()
&& (e.getSource() == optionPane)
&& (JOptionPane.VALUE_PROPERTY.equals(prop)
|| JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
Object val... | 7 |
private boolean valid(int x, int y, int width, int height) {
if(x < 0 || width <= x) { return false; }
if(y < 0 || height <= y) { return false; }
return true;
} | 4 |
public void checkPurchase()
{
if(BackerGS.storeVisible)
{
if(CurrencyCounter.currencyCollected < 100)
{
if(Greenfoot.mouseClicked(this))
{
NotEnoughMoney.fade = 200;
boop.play();
}
... | 8 |
static final public void paramForms() throws ParseException {
jj_consume_token(52);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case BOOLEEN:
case ENTIER:
paramForm();
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 53:
;
break;
... | 6 |
public String getFormattedDatetime() {
return formattedDatetime;
} | 0 |
public String toString() {
// TODO: move strings to Strings
String str = "Select ";
if (exactly) str += "exactly ";
else str += "up to ";
str += count + " ";
str += "cards ";
switch (from) {
case HAND:
str += Strings.fromHand;
break;
case VILLAGE:
str += Strings.fromVillage;
b... | 9 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if((affected instanceof MOB)&&(invoker()!=null))
{
final MOB mob=(MOB)affected;
if((mob!=null)
&&(!mob.amDead())
&&(CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints())<... | 7 |
public static void merge(int startIndex, int endIndex){
System.out.println("startj: "+startIndex+" endj:"+ endIndex);
Long[] arr = new Long[endIndex-startIndex+1];
int i=startIndex;
int j=((endIndex+startIndex)/2)+1;
int k=0;
for(k=0; k<arr.length; k++){
if (i == ((endIndex+startIndex)/2)+1 || j> endInde... | 9 |
private void calculateRoughPageSize(Rectangle pageSize) {
// use a ratio to figure out what the dimension should be a after
// a specific scale.
float width = defaultPageSize.width;
float height = defaultPageSize.height;
float totalRotation = documentViewModel.getViewRotation();... | 4 |
protected void optimize2() throws Exception {
//% main routine for modification 2 procedure main
int nNumChanged = 0;
boolean bExamineAll = true;
// while (numChanged > 0 || examineAll)
// numChanged = 0;
while (nNumChanged > 0 || bExamineAll) {
nNumChanged = 0;
// if (examin... | 9 |
@Override
public boolean isSameElementAs(Element<?> element) {
NoteElement other = element.adaptTo(NoteElement.class);
if(other==null) {
return false;
}
return other.getText().equals(other);
} | 2 |
public void updateStudents() throws ClientException{
if (logger.isDebugEnabled()){
logger.debug("Called updating student");
}
String firstName = tb.getModel().getValueAt(tb.getSelectedRow(), 0).toString();
String lastName = tb.getModel().getValueAt(tb.getSelectedRow(), 1).to... | 7 |
private static void printPersons(List<Person> persons) {
for (Person person : persons) {
System.out.println("Name :" + person.getName());
System.out.println("Gender :" + person.getGender());
System.out.println("Marital Status :" + person.getMaritalStatus());
System.out.println();
}
} | 1 |
public Chest(PlaceableManager pm, Registry rg, String sm, String am, int x, int y, Placeable.State cs) {
super(pm, rg, sm, am, x, y, cs, 8);
type = "Chest";
totalBuildTime = 1;
totalHitPoints = 625;
powerRequired = 0;
powerGenerated = 0;
hitPoints = totalHitPoi... | 3 |
private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... | 8 |
private void connectTo(String name, String password, String server) throws ConnectionFailure, ClassNotFoundException {
try {
GameNetworkInterface gnet = Guice.createInjector(new GuiceConfig()).getInstance(GameNetworkInterface.class);
gnet.connectTo(server);
pfactory.sendJoinG... | 4 |
public static Keyword meanOfNumbersSpecialist(ControlFrame frame, Keyword lastmove) {
{ Proposition proposition = frame.proposition;
Stella_Object listarg = (proposition.arguments.theArray)[0];
Stella_Object listskolem = Logic.argumentBoundTo(listarg);
Stella_Object meanarg = (proposition.argument... | 6 |
public void setAllParticipantsOffline() {
Iterator<String> participantsIter = participants.keySet().iterator();
Participant partp;
while(participantsIter.hasNext()) {
partp = participants.get(participantsIter.next());
partp.setOffline();
}
setChanged();
notifyObservers(ModelNotification.LIST_OF_PARTIC... | 1 |
static int maxFlow(int[][] cap,int[][] cost,int[][] r,int s,int t,int C) {
Arrays.fill(ants, -1);
Arrays.fill(vals, MAX);
Arrays.fill(visitados, false);
visitados[s]=true;
int c=0,p=0;
cola[c++]=s;
for(int u;p<c;) {
u=cola[p++];
for(int v=0;v<cap.length;v++)
if(!visitados[v]&&cost[u][v]<=C&&cap[... | 8 |
public void mouseClicked(MouseEvent e) {
setState(getState() == ENABLED ? DISABLED : ENABLED);
InputBox.this.fireEvent(new ActionEvent());
} | 1 |
public Molecule getFromMoleculeID(int[] MoleculeID, int size, int val){
if(this.getID()==0){
return this;
}
if (size!=0){
//System.out.printf(""+this.toStringf()+"\t\t\t");
val = MoleculeID[MoleculeID.length-size];
//System.out.printf("%d\t%d\t%d\n", val, MoleculeID.length,... | 2 |
private Token nextSymbol() throws IOException {
StringBuilder builder = new StringBuilder();
int ich = this.reader.read();
int nchars = 0;
while (ich != -1) {
char ch = (char)ich;
if (Character.isSpaceChar(ch) || Character.isISOControl(ch))
break;
// Case #(
if (ch == '(' && nchars ==... | 6 |
public static float pcaAngle(Collection<Vector2f> points) {
//
final float size = points.size();
if (size < 2) return 0.0f;
//
// determin mean vector.
//
final Vector2f mean = mean(points);
//
double cov00 = 0.0;
double cov01 = 0.0;
... | 4 |
public static boolean estPositionValide(Position position){
if(position.travee >= 0 && position.travee < Parametres.NB_TRAVEES && position.rangee >= 0 && position.rangee < Parametres.NB_RANGEES){
return true ;
}
else {
return false ;
}
} | 4 |
private ArrayList<TunnusPari> kokoaParit(ArrayList<ArrayList<String>> tunnusParit, ArrayList<Tunnus> tunnukset) {
ArrayList<TunnusPari> parit = new ArrayList<TunnusPari>();
for (ArrayList<String> lista : tunnusParit) {
if (lista.size() < 9) {
continue;
}
... | 7 |
public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
try {
T version = (T) start.get().newVersion;
final Method method = version.getClass().getMethod(methodName);
return new Adapter.Getter<V>() {
public V call() {
try {
Transaction me = Thre... | 8 |
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting() == false && solvingList.getSelectedIndex() > -1) {
int wordIndex = solvingList.getSelectedIndex();
// Compute the grid state at that letter
Grid tempGrid = solvingGrid.clone();
for (int i = 0; i < wordIndex; i++) {
tempGrid.r... | 7 |
public static String formatFilePath(String realpath) {
if (StringUtil.isEmpty(realpath))
return null;
realpath = realpath.replace('\\', '/');
return realpath;
} | 1 |
@Basic
@Column(name = "PCA_ID_ELEMENTO")
public Integer getPcaIdElemento() {
return pcaIdElemento;
} | 0 |
public String ask(String sentence) {
String response = defaultResponses[(int) (Math.random() * defaultResponses.length)];
if (sentence == null || sentence.length() == 0)
return response;
// Removing the punctuation if it is there.
char punctuation = sentence.charAt(sentence.length() - 1);
if (punctuation =... | 7 |
public String parentRow(){
return "<tr class=\"parent\" data-level=\"0\">"+
"<td>"+this.instance_id+"</td>"+
"<td>"+this.txid+"</td>"+
"<td>"+this.BPEL+"</td>"+
"<td>"+this.course_id+"</td>"+
"<td>"+this.course_provider+"</td>"+
... | 0 |
public void setHealth(int newHealth) {
if (newHealth < health) {
int scaleX = Level.getScaledX(level.getXPosition(), x);
int width = Level.getScaledX(level.getXPosition(), x + 1) - scaleX;
float scale = 1.0f / Constants.TILE_WIDTH * width;
addEffect(new PlayerDamageEffect(getRenderCentreX(),
getRend... | 2 |
public void setName(String name) {
this.name = name;
} | 0 |
public Class getTypeClass() {
switch (((IntegerType) getHint()).possTypes) {
case IT_Z:
return Boolean.TYPE;
case IT_C:
return Character.TYPE;
case IT_B:
return Byte.TYPE;
case IT_S:
return Short.TYPE;
case IT_I:
default:
return Integer.TYPE;
}
} | 5 |
private void deletePair(Person man, Person woman) {
//System.out.println("deleting: " + man.getName() + "," + woman.getName());
for(List<Person> list : man.getPreferences()) {
List<Person> listAux = list;
if(listAux.contains(woman)) {
listAux.remove(woman);
... | 8 |
@EventHandler(priority = EventPriority.NORMAL)
public void onBlockBreak(BlockBreakEvent event) {
if (event.getBlock() != null) { //Will prevent an NPE if the user right-clicks air.
if (event.getBlock().getState() != null) {
if (event.getBlock().getState() instanceof Sign) {
Sign sign = (Sign) event.getBl... | 7 |
private static boolean rulesEq(boolean[] r1, boolean[] r2) {
if(r1 != null && r2 != null) {
if(r1.length == r2.length) {
for(int i = 0; i < r1.length; i++) {
if(r1[i] != r2[i]) {
return false;
}
}
... | 7 |
public static void main(String[] argv) {
try {
File index = new File("index");
boolean create = false;
File root = null;
String usage = "IndexHTML [-create] [-index <index>] <root_directory>";
if (argv.length == 0) {
System.err.println("Usage: " + usage);
return;
... | 8 |
String entrance(List<Milk> milks){
Collections.sort(milks);
return milks.get(0).brand;
} | 0 |
public float getValueAt(int row, int column) throws
ElementOutOfRangeException{
if(row<0 || column<0){
throw new ElementOutOfRangeException(" The vlaues provided for row or " +
" column are negative");
}
if(row > this.rows || column > this.columns){
throw new ElementOutOfR... | 4 |
private void init() {
dialog.setSize(WIDTH, HEIGHT);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
button = new JButton("Cancel");
progressBar = new JProgressBar();
textArea = new JLabel("Calculating");
progressBar.setStringPainted(true);
progres... | 0 |
public AncestorIterator(T child, Selector<T, T> selector)
{
this._next = child;
this._selector = selector;
} | 0 |
public int reverse(int x) {
if (x == 0) {
return 0;
}
boolean isNegative = x < 0;
x = x > 0 ? x : -x;
long i = 0;
while (x > 0) {
i = i * 10 + (x % 10);
x = x / 10;
}
if ((!isNegative && i > Integer.MAX_VALUE) || (isNeg... | 8 |
private void CheckIfAllPlayerHaveOneCountry(List<MapChange> map, Player player1, Player player2) {
boolean error = false;
if (map.size() != 2)
error = true;
if (map.get(0).OwnedByPlayerId == player1.ID && map.get(1).OwnedByPlayerId == player1.ID)
error = true;
if... | 6 |
public void addCountry(Country cnt) {
int id;
Connection con = null;
PreparedStatement pstmt = null;
Statement idstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnec... | 7 |
public void cmdCollect(CommandSender sender, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
List<EEItemStack> stacks = getDeliveries(player.getName());
double revenue = getRevenue(player.getName());
if(stacks.size() == 0 && revenue == 0 ) {
se... | 8 |
private Byte[] buildPacket() {
ArrayList<Byte> p = new ArrayList<Byte>();
// Add timestamp to the first 8 bits.
long timestamp = new Date().getTime();
lastSentPacketTimestamp = timestamp;
byte[] timestampBytes = ByteBuffer.allocate(8).putLong(timestamp).array();
for(byte b : timestampBytes) {
p.add((B... | 3 |
public CustomTemplate getCopy()
{
try {
CustomTemplate template = (CustomTemplate) clone();
List<CustomElement> elements = new ArrayList<CustomElement>();
for (CustomElement e : template.elements)
{
elements.add(e.getCopy());
}
for (CustomElement e : elements)
{
if (e.childElements != nu... | 8 |
public void TimeStep() {
if (turnsRemaining > 0) {
--turnsRemaining;
} else {
turnsRemaining = 0;
}
} | 1 |
private void paintAntsB(Graphics2D g2d, int id, Map<Integer, Ant> ants, Color b, Color f) {
for (int i : ants.keySet()) {
Ant a = ants.get(i);
g2d.setColor(b);
if (a.isSweet()) {
g2d.setColor(Color.white);
g2d.drawOval(a.getX()-5, a.getY()-5, 10, 10);
}
g2d.setColor(b);
if (id == w.getId()) ... | 7 |
public void copyBlock(int distance, int len) throws IOException {
int pos = _pos - distance - 1;
if (pos < 0) {
pos += _windowSize;
}
for (; len != 0; len--) {
if (pos >= _windowSize) {
pos = 0;
}
_buffer[_pos++] = _buffer[p... | 4 |
@Override
public boolean activate() {
return (Game.getClientState() != Game.INDEX_MAP_LOADED
|| (Game.getClientState() != Game.INDEX_MAP_LOADED && ItemCombiner.stop == 1000)
|| ItemCombiner.client != Bot.client()
|| Widgets.get(640, 30).isOnScreen()
);
} | 4 |
private Map<Integer, Double> getLastUsages(List<Bookmark> bookmarks, double timestamp, boolean categories) {
Map<Integer, Double> usageMap = new LinkedHashMap<Integer, Double>();
for (Bookmark data : bookmarks) {
List<Integer> keys = (categories ? data.getCategories() : data.getTags());
double targetTimestamp... | 8 |
private static double getMeanPixel(Image image, ChannelType color, int x,
int y, int maskWidth, int maskHeight) {
List<Double> pixelsAffected = new ArrayList<Double>();
for (int i = -maskWidth / 2; i <= maskWidth / 2; i++) {
for (int j = -maskHeight / 2; j <= maskHeight / 2; j++) {
if (image.validPixel(x ... | 4 |
public ArrayList<AnyType> Merge(ArrayList<AnyType> list1, ArrayList<AnyType> list2)
{
int i=0;
int j=0;
ArrayList<AnyType> merged = new ArrayList<AnyType>();
while(i<list1.size() || j<list2.size())
{
if(i<list1.size() && j<list2.size())
{
if(list1.get(i).compareTo(list2.get(j))<=0)
{
me... | 9 |
public static void sort(SimpleTrain train,
Comparator<AbstractCarriage> comparator) {
if(train == null){
LOG.error("Train is null");
throw new IllegalArgumentException("Train is null");
}
Collections.sort(train, comparator);
} | 1 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
public void randomFillMap() {
int mapmiddle = 0;
for (int row = 0; row < mapheight; row++) {
for (int col = 0; col < mapwidth; col++) {
if (col == 0)
{
map[col][row] = 1;
}
else if (row == 0)
{
map[col][row] = 1;
}
else if (col == mapwidth -1){
map[col][row] = 1... | 7 |
private void btn_ContinueActionPerformed(java.awt.event.ActionEvent evt) {
System.out.println("Iniciando configuraciones");
sys_productores = (Integer) jSpinnerProductores.getValue();
System.out.print(sys_productores+" sys_productores");
... | 3 |
public void addOsoba(Osoba osoba) {
data.addElement(osoba);
int updatedRow = data.indexOf(data.lastElement());
fireTableRowsInserted(updatedRow, updatedRow);
} | 0 |
public String[] getOptions() {
Vector<String> options = new Vector<String>();
if ( (getUrl() != null) && (getUrl().length() != 0) ) {
options.add("-url");
options.add(getUrl());
}
if ( (getUser() != null) && (getUser().length() != 0) ) {
options.add("-user");
options... | 9 |
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 |
public void setDepotlegal(String oui) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} | 0 |
public static void main(String[] args) {
//TODO interpret arguments, for example random seed and number of cities, and brute force or genetic algorithm could be
TravelingSalesman salesman = new TravelingSalesman(10, random);
salesman.printCosts();
//uncomment for brute force:
if(RUN_BRUTE_FORCE){
S... | 2 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
public static int[][] replaceMatrixElements(int a[][]) {
int rows[] = new int[a.length];
int columns[] = new int [a[0].length];
for (int i=0; i<a.length; i++) {
for(int j=0; j<a[i].length; j++) {
if(a[i][j] == 0) {
rows[i] = 1;
... | 9 |
public boolean isTileAlreadyOccupied(PieceCoordinate coordinate) {
Iterator<Entry<PieceCoordinate, HantoPiece>> pieces = board.entrySet().iterator();
PieceCoordinate next;
while(pieces.hasNext()) {
Entry<PieceCoordinate, HantoPiece> entry = pieces.next();
next = entry.getKey();
// if there is already a p... | 2 |
public void visitAttribute(final Attribute attr) {
super.visitAttribute(attr);
if (fv != null) {
fv.visitAttribute(attr);
}
} | 1 |
public void makeShake() {
if (this.calculateChances(10))
{
this.setEffMult(1);
}
else
{
this.addEffMult(0.1);
}
} | 1 |
public void renderSprite(int xPos, int yPos, Sprite sprite) {
int spriteWidth = sprite.getWidth();
int spriteHeight = sprite.getHeight();
if (sprite.isFixed()) {
xPos -= xOffset;
yPos -= yOffset;
}
for (int y = 0; y < spriteHeight; y++) {
int y... | 8 |
public Value naryOperation(final AbstractInsnNode insn, final List values) {
int size;
if (insn.getOpcode() == MULTIANEWARRAY) {
size = 1;
} else {
size = Type.getReturnType(((MethodInsnNode) insn).desc).getSize();
}
return new SourceValue(size, insn);
} | 1 |
@Override
public Object getValueAt(Object object, int row, int col) {
Usuario u = (Usuario) object;
try {
if (col == 0) {
return u.getDNI();
} else if (col == 1) {
return u.getNombre();
} else if (col... | 9 |
private static void contraction(Map<Integer, List<Integer>> expData, Integer key1, Integer key2) {
List<Integer> adj1 = expData.get(key1);
List<Integer> adj2 = expData.get(key2);
for (Iterator<Integer> it = adj2.iterator(); it.hasNext();) {
Integer current = it.next();
if... | 7 |
private boolean availableArea(int southWestRowID,
int southWestColID, int span) {
int rowCount = this.realMap.getRowCount();
int colCount = this.realMap.getColumnCount();
for(int rowID = 0;rowID < span;rowID++){
if(!(0 <= rowID && rowID < rowCount)){
return false;
}
for(int colID = 0;colID < s... | 7 |
@Test
public void opiskelunLisaaminenToimiiKunEriKuinEnnen(){
//kirjoitaOikeanmuotoinenSyote();
tiedot.LueTiedotTiedostosta();
tiedot.lisaaUusiOpiskelu("uusiopiskelu", 5);
String mappiinTallennetutTiedot = "";
HashMap<String, Integer> kartta = tiedot.getOpiskelut();
f... | 1 |
public static void getDifficultyVariables() {
if(isEasy && !isMedium && !isHard){
mobWalkSpeeds[0] = 30;
mobWalkSpeeds[1] = 20;
mobWalkSpeeds[2] = 60;
killReward[0] = 5;
killReward[1] = 2;
killReward[2] = 20;
}
if(!isEasy && isMedium && !isHard){
mobWalkSpeeds[0] =... | 9 |
public void splitNode(BallNode node, int numNodesCreated) throws Exception {
correctlyInitialized();
double maxDist = Double.NEGATIVE_INFINITY, dist = 0.0;
Instance furthest1=null, furthest2=null, pivot=node.getPivot(), temp;
double distList[] = new double[node.m_NumInstances];
for(int i=node.m... | 8 |
public static void main(String args[]) {
Cue bigQ = new Cue(100);
Cue smallQ = new Cue(4);
char ch;
int i;
System.out.println("Using bigQ to store the alphabet.");
for(i=0; i<26;i++)
bigQ.put((char) ('A' + i ));
System.out.println("Contents of bigQ: ")... | 6 |
public static void modifyNames(ArrayList<Journal> journalList, Journals journals) {
for(Journal journal : journalList){
String oldName = journal.getName();
boolean retry = true;
while(retry){
String newName = JOptionPane.showInputDialog(getBundle("BusinessActi... | 6 |
private void printLinks(StringBuilder sb, List<Link> links) throws IOException {
for (Link link : appendPhantomLink(links)) {
final IEntity entity1 = link.getEntity1();
final IEntity entity2 = link.getEntity2();
if (entity1 == entity2 && entity1.getType() == EntityType.GROUP) {
continue;
}
if (enti... | 9 |
public void initiate() {
System.out.println("\u001b[1;44m *** INITIATED *** \u001b[m");
/* Identify to server */
connection.sendln("NICK " + botN);
// connection.sendln("PASS " + botP);
connection.sendln("USER RTFM 0 * :Microsoft Exterminator!");
// /*
// * Give the server 4 seconds to ident... | 7 |
public static void main(String[] args) {
// create the object
DB db = new DB();
// open the database
if (!db.open("casket.kch", DB.OWRITER | DB.OCREATE)){
System.err.println("open error: " + db.error());
}
// store records
if (!db.set("foo", "hop") ||
!db.set("bar", "step") ... | 7 |
void compress( int init_bits, OutputStream outs ) throws IOException
{
int fcode;
int i /* = 0 */;
int c;
int ent;
int disp;
int hsize_reg;
int hshift;
// Set up the globals: g_init_bits - initial number of bits
g_... | 9 |
@Test
public void testPeekAndPopOperand(){
calculator.pushOperand(4.0);
calculator.pushOperand(7.0);
calculator.pushPlusOperator();
calculator.evaluateStack();
assertEquals(11.0, calculator.peekOperand(), 0);
assertFalse(calculator.isStackEmpty());
calculator.pushOperand(3.0);
calculator.pushTime... | 0 |
private void siftUp(int start, int end ) {
int child = end;
while (child > start) {
int parent = (int) Math.floor((child-1)/2);
if(array.get(parent).compareTo(array.get(child)) > 0 ) {
return;
}
T t = array.get(parent);
array.set(parent, array.get(child));
array.set(child, t);
}
} | 2 |
public void merge(Player.Ids rhs) throws IdConflictException {
ObjectNode root = (ObjectNode) id;
for(String key : rhs.all()) {
JsonNode lhs = root.path(key);
if (lhs.isMissingNode()) {
root.put(key, rhs.get(key));
} else {
... | 3 |
public static String reverseWords(char[] s) {
reverseSentence(s, 0, s.length - 1);
int start = 0;
int end = 0;
while(start <s.length && end < s.length) {
while(start < s.length && s[start] == ' ') {
start ++;
}
end = start;
... | 6 |
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.