text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Test
public void testGetSaldo() {
System.out.println("getSaldo");
Cuenta instance = new Cuenta();
float expResult = 0.0F;
float result = instance.getSaldo();
assertEquals(expResult, result, 0.0);
// TODO review the generated test code and remove the default call to f... | 0 |
private void checkKeyboardInput(Input input,GameContainer gc) {
if(input.isKeyPressed(Keyboard.KEY_1)){
drawInventorySelector2X = (gc.getWidth()/2 - OutventoryWidth/2);
drawInventorySelector2 = true;
}
if(input.isKeyPressed(Keyboard.KEY_2)){
drawInventorySelector2X = (gc.getWidth()/2 - OutventoryWidth/... | 8 |
public boolean isFinished()
{
boolean finished = true;
for (int i = 0; finished && i < squares.length; i++)
{
for (int h = 0; h < squares[1].length; h++)
{
if (squares[i][h] == null)
{
finished = false;
break;
}
}
}
return finished;
} | 4 |
public synchronized void dropBomb(TimerTask dt) {
System.out.println("bomb dropped");
synchronized (this) {
if (bombsAllowance == 0) {
return;
}
bombsDeployed++;
bombsAllowance--;
new Timer().schedule(dt, this.detonationDelay);
... | 1 |
@SuppressWarnings("unchecked")
@Override
public <K> Map<K, E> toResultMap(ResultSet resultSet, boolean sorted) throws ResultMapException {
Map<K,E> resultMap = null;
if( sorted ) {
resultMap = new TreeMap<K,E>();
} else {
resultMap = new HashMap<K,E>();
}
if(resultSet == null) {
return resultMap;
... | 7 |
private boolean compatibleWithHand(Board b, String word, PosibleWord pw) {
List<Character> handCopy = new ArrayList<Character>(letters);
int i = pw.i;
int j = pw.j;
for (int index = 0; index<word.length(); index++) {
Character c = word.charAt(index);
if (b.charAt(i, j) != c) {
if (!handCopy.remove(c))... | 7 |
private ProvinceType provinceTypeFor(int provinceId) {
if(seaProvinceIds.contains(provinceId))
return ProvinceType.SEA;
if(lakeProvinceIds.contains(provinceId))
return ProvinceType.LAKE;
if(wastelandProvinceIds.contains(provinceId))
return ProvinceType.WASTELA... | 3 |
public boolean hasAltitude()
{
return !Double.isNaN(altitude);
} | 0 |
public boolean removeEdgeTile(int x, int y) {
for (int i = 0; i < edgeTiles.size(); i++) {
Tile t = edgeTiles.get(i);
if (t.getX() == x && t.getY() == y) {
edgeTiles.remove(i);
return true;
}
}
return false;
} | 3 |
@Override
protected boolean parseCliValue() {
boolean status = false;
for (String allowedValue : allowedValues) {
if (allowedValue.equals(cliValue)) {
status = true;
value = cliValue;
}
}
if (!status) {
errorMessa... | 4 |
protected void init() {
grid = new Object[HEIGHT][WIDTH];
for (int i = 0; i < WIDTH; i++) {
for (int j = 0; j < HEIGHT; j++) {
grid[j][i] = null;
}
}
// add the droid
grid[(int) mDroid.getY()][(int) mDroid.getX()] = mDroid;
// add ... | 5 |
public boolean containsPortal(final Location check){
if(check.getBlock().equals(one.getBlock()) || check.getBlock().equals(one.getBlock())) return true;
else return false;
} | 2 |
public String getData(String artistName) throws IOException {
File eventFile = FileUtil.getEventsFile(artistName);
if(!eventFile.exists()) {
return "";
}
String data = readFile(eventFile);
return data;
} | 1 |
@Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
if(!mob.isMonster())
{
if((commands!=null)
&&(commands.size()>1)
&&(commands.get(1).toUpperCase().equals("OFF")))
{
final Command C=CMClass.getCommand("NOANSI");
if(C!=null)
{
... | 8 |
static double det(double[][] A){
double det = 0;
if(A.length == 1){
det = A[0][0];
}else{
for(int i = 0; i < A.length; i++){
det += Math.pow(-1,i)*det(minor(A,i,0))*A[i][0];
}
}
return det;
} | 2 |
public ItemType getItemType(String name) {
if (itemTypes.containsKey(name)) {
return (ItemType) itemTypes.get(name);
}
return null;
} | 1 |
private static RoutingTable createLocalRT(Host host, Case CASE) throws UnknownHostException {
// the following are stored in the LOCAL host
RoutingTable localRT = new RoutingTable();
localRT.setLocalhost(host);
if (CASE.compareTo(Case.BOOTSTRAP_1) == 0) {
return localRT;
... | 3 |
public static boolean libraryCompatible() {
if (AL.isCreated()) {
return true;
}
try {
AL.create();
} catch (java.lang.Exception e) {
return false;
}
try {
AL.destroy();
} catch (java.lang.Exception e) {
}
... | 3 |
@Test
public void test() {
int[][] array = new int[M][N];
int row = M;
boolean isUp = true;
for (int i = 0; i < N; i++) {
if (isUp) {
array[--row][i] = i + 1;
if (row == 0) {
isUp = false;
}
} else {
array[++row][i] = i + 1;
if (row == M - 1) {
isUp = true;
}
}
}
... | 4 |
public List<AcidSequence> parseChunk() {
ArrayList<AcidSequence> list = new ArrayList<AcidSequence>();
// Begin with an initial sequence
// TODO: assumes file is not empty
AcidSequence sequence = new AcidSequence();
// While the file is not finished and we have not reached the
// total number of sequenc... | 7 |
private void handleInferenceInitializationResult(CycList data) {
if (data.size() != 3) {
throw new RuntimeException("Got wrong number of arguments " + "from inference result (expected 3): " + data);
}
Object problemStoreObj = data.get(1);
Object inferenceObj = data.get(2);
if ((problemStoreObj... | 8 |
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
} | 0 |
public boolean test(GoogleDocs googleDocs)
{
try
{
this.getUserMetadata(googleDocs);
return true;
}
catch (ApiException e)
{
return false;
}
catch (ServiceException e)
{
return false;
}
} | 2 |
public static boolean useItemTeleport(IClientContext ctx, String destination, int tries, int... ids) {
if (itemTeleport(ctx, ctx.combatBar.select().id(ids).poll(), destination, tries)) {
return true;
}
if (ctx.hud.opened(Hud.Window.WORN_EQUIPMENT)) {
return itemTeleport(ctx, ctx.equipment.select().id(ids).... | 4 |
public int getLow(int symbol) {
if (symbol < 0 || symbol >= frequencies.length)
throw new IllegalArgumentException("Symbol out of range");
if (cumulative == null)
initCumulative();
return cumulative[symbol];
} | 3 |
public void setFunNombres(String funNombres) {
this.funNombres = funNombres;
} | 0 |
protected Method getMethod(Object obj, String methodname, Class[] params)
{
Class<?> type = obj.getClass();
while (type != null)
{
try
{
Method method = type.getDeclaredMethod(methodname, params);
if (method != null)
{
return method;
}
}
catch (Exception e)
{
// ignore
... | 4 |
public static void main(String[] args) throws IOException {
ByteArrayOutputStream f = new ByteArrayOutputStream();
String str = "hello world welcome";
byte[] buffer = str.getBytes();
f.write(buffer);
byte[] result = f.toByteArray();
for(int i = 0; i < result.length; i ++ )
{
System.ou... | 1 |
public void diminuirDebito(String nomeCliente, double valor)throws ExceptionGerentePessoa{
Cliente c = getCliente(nomeCliente);
if(valor<=c.getDebito()){
c.diminuirDebito(valor);
}else{
throw new ExceptionPessoa("Tentativa de diminuir d��bito acima do valor existente");
}
... | 1 |
public void playAudio() {
// add file chooser
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(audioFile);
// JLabel resultLabel = new JLabel("");
int returnVal = chooser.showOpenDialog(chooser);
// retrieve chosen file
if (returnVal == JFileChooser.APPROVE_OPTION) {
// create t... | 2 |
public int checkDataType(String str){
int res = -1;
char[] c = new char[]{'0','1','2','3','4','5','6','7','8','9'};
char[] str_array = str.toCharArray();
char symbol;
boolean numberOcurrence = false;
boolean letterOcurrence = false;
int size = str_array.... | 9 |
public void printArray(Node array[]){
for (Node item: array){
String output = item.toPlainTextString();
output = output.trim();
Node c = item.getFirstChild();
while( c!=null ) {
if( c instanceof Div ) {
output += "\t \t" + ((Div) c).g... | 3 |
static private int jjMoveStringLiteralDfa9_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(7, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0, 0L);
return 9;
}
switch(curChar)
{
... | 7 |
@Test
public void testServerSetQueueTimeoutDisconnectIndividualHashEx() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerSetQueueTimeoutDisconnectIndividualHashEx -----");
boolean exception_other = false;
String client_hash = "";
try {
server2.setUseMessageQueues(t... | 5 |
public void mouseReleased(MouseEvent me) {
if (gameOn == true) {
myImages.set(0, doodleRImg);
}
} | 1 |
public void AllStateCharCollapse(int inTarget){
int inRole = CharacterCollapse(inTarget);
Iterator<GameState> i = AllStates.iterator();
while(i.hasNext()){
GameState a = i.next();
if(a.SurviveCollapse(inTarget, inRole)){
// do nothing, state is allowed.
} else {
i.remove();
}
}
} | 2 |
public int findMagicIndex(int a[], int start, int end) {
if (end < start) {
return -1;
} else if (end == start && a[start] == start) {
return start;
} else if (end == start && a[start] != start) {
return -1;
} else {
int mid = ((end - star... | 7 |
public void readSpecificObj(int[] data, int offset, DwgObject dwgObj) throws RuntimeException, CorruptedDwgEntityException {
if(! (dwgObj instanceof DwgBlockHeader))
throw new RuntimeException("DwgBlockHeaderReader15 solo puede leer DwgBlockControl");
DwgBlockHeader hdr = (DwgBlockHeader) dwgObj;
int bitP... | 9 |
@Override
public void run() {
long lastTime = System.nanoTime();
long currTime = 0;
double nsPerTick = 1000000000D/(double)ticksPerSecond;
double delta = 0;
while(running) {
currTime = System.nanoTime();
delta += (currTime-lastTime)/nsPerTic... | 7 |
public static int uniquePathsWithObstacles(int[][] obstacleGrid) {
if(obstacleGrid.length == 0 || obstacleGrid[0].length == 0) {
return 0;
}
int m = obstacleGrid.length;
int n = obstacleGrid[0].length;
//automatically initialized to 0
int[] rs = new int[n];
... | 9 |
public static byte[] decode( byte[] base64Data )
{
// handle the edge case, so we don't have to worry about it later
if(base64Data.length == 0) { return new byte[0]; }
int numberQuadruple = base64Data.length/FOURBYTE;
byte decodedData[] = null;
byte b1=0... | 8 |
public PathNode(Point location, PathNode parent, int addg) {
this.location = location;
this.parent = parent;
if (parent != null) {
gscore = addg + parent.getGscore();
}
} | 1 |
private void fillTypesOfEdges() {
Vector<String> names = new Vector<String>();
names.addAll(Global.getImplementations("nodes/edges")); // default + current project
if(!names.contains(Configuration.getEdgeTypeShortName())) {
names.add(Configuration.getEdgeTypeShortName());
}
typeOfEdges.removeAllItems();
... | 2 |
public void keyReleased(KeyEvent e) {
// if we're waiting for an "any key" typed then we don't
// want to do anything with just a "released"
if (game.isWaitingForKeyPress()) {
return;
}
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
game.setLeftPressed(false);
}
if (e.getKeyCode() == KeyEvent.VK_RIGH... | 4 |
public BmgPanelPracticeFirst(final BmgFrame fen, String name) {
//Some settings
this.filename = name;
int nb = 10;
String color = "red";
//Label at first
JPanel panFirst = new JPanel();
panFirst.setPreferredSize(new Dimension(fen.width, fen.height / nb));
... | 6 |
public static <T> void loopGenerator(Generator<T> gen, int timeToWait) {
int mapsCreated = 0;
while (true) {
// generate and show a map
Map map = gen.generateMap(1);
if (timeToWait > 0) {
System.out.println(map.toString());
}
mapsCreated++;
System.out.println("Map nr.: " + mapsCreated);
tr... | 3 |
protected void flushDB() {
if (graphDb == null)
return;
Transaction t = graphDb.beginTx();
try {
GlobalGraphOperations op = GlobalGraphOperations.at(graphDb);
for (Node n : op.getAllNodes()) {
String nodeId = getNodeId(n);
sendNodeAdded(sourceId, nodeId);
for (String key : n.getPropertyKe... | 8 |
private static void initializeTable(String schemaFile) {
Connection conn;
// load the H2 Driver
try {
Class.forName("org.h2.Driver");
} catch (ClassNotFoundException e) {
System.err.println("Unable to load H2 driver");
e.printStackTrace();
// croak
System.exit(1);
}
// credentials do not rea... | 7 |
public static void main(String[] args) throws IOException {
if (args.length != 2) {
System.err
.println("Incorrect Syntax. Correct: java Client <host name> <port number>");
System.exit(1);
}
Client client = new Client();
client.assignVariables(args[0], Integer.parseInt(args[1]));
while (true) {
... | 3 |
private void updateClientID(final long newClientID, final long oldClientID) {
logger.info("registered ClientID is $" + newClientID);
String titlePreFix = "";
if (ServerStarter.isClientServer()) {
titlePreFix = "#### SERVER #### ";
}
GameEngine.getInstance().setTitle(titlePreFix + "netproto Client $" + ne... | 3 |
private void jButtonSourcePreviousActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSourcePreviousActionPerformed
try{
MultiSyntaxDocument syntax = new MultiSyntaxDocument();
if(sourceCurrentPosition==0 ){
JOptionPane optionPane = new ... | 3 |
public void playerScore(int id, int score) {
if (id == myID) {
myScoreField.setText(myName + " = " + score);
}
else {
theirScoreField.setText(theirName + " = " + score);
}
//If someones score is 0 nobody has won, clear the win field
//This is done because the players have no way to know when ... | 2 |
Schedule generateRandomSchedule(int x, int y, int i, int j){
Schedule s = new Schedule(new RoomScheme[x][y]);
for(int k=0; k<x; k++){
for(int m=0; m<y; m++){
s.schedule[k][m] = generateRandomScheme(i, j, d.subject);
}
} return s;
} | 2 |
private static String getPath(BufferedReader in) throws IOException
{
String line = in.readLine();
String path = "";
// extract class from GET line
if (line.startsWith("GET /"))
{
line = line.substring(5, line.length()-1).trim();
int index = line... | 6 |
public EigenvalueDecomposition(Matrix Arg) {
double[][] A = Arg.getArray();
n = Arg.getColumnDimension();
V = new double[n][n];
d = new double[n];
e = new double[n];
issymmetric = true;
for (int j = 0; (j < n) & issymmetric; j++) {
for (int i = 0; (i < n) & issymmetric; i++) {
... | 7 |
public BigPacket(byte source, byte destination, byte hops, byte sequencenr,
byte[] data, Boolean ack, Boolean routing, Boolean keepalive,
Boolean more) {
packet = new byte[data.length + HEADER_LENGTH];
System.arraycopy(data, 0, packet, HEADER_LENGTH, data.length);
packet[0] = source;
packet[1] = dest... | 5 |
public void setValue(String value) {
this.value = value;
} | 0 |
private Color getColor(double power) {
int color = (int)(power*10);
switch(color){
case 0:
return new Color(0xFFFFCC);
case 1:
return new Color(0xFFFF99);
case 2:
return new Color(0xFFFF66);
case 3:
... | 9 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Vertex vertex = (Vertex) o;
if (!value.equals(vertex.value)) return false;
return true;
} | 4 |
@Override
public Object getValue() {
String value="";
Object value1=this.getParent().queryBestResult(this.part1);
Object value2=this.getParent().queryBestResult(this.part2);
if(value1!=null) {
value=value1.toString();
}
if(value2!=null) {
if(value.length()>1) {
value += this.separator;
}
va... | 3 |
@Override
public final Action choose(Robots.BLU actor, Set<Action> options) {
// Here we assume that we will always see the same
// actor. This will be true of many models, including
// this one, but not always.
// On the first call, our state will not be initialized
// so we initialize it here once and use... | 8 |
public void userLeave (String nick)
{
// System.out.println("APP: leave " + nick );
if (extApp != null)
{
if (user.containsKey(nick))
{
extApp.userLeave(nick);
if (debugChannel != null)
{
IRCMessage m2 = new IRCMessage();
m2.command = "PRIVMSG";
m2.numPar... | 8 |
@Override
public void start() throws MusicPlayerException {
this.mLock.lock();
try {
if ( this.mStreamPlayerRunnable == null ) {
throw new IllegalStateException(
this +
" has not been initialized yet!"
);
}
if ( !this.mStreamPlayerRunnable.isStopped() &&
this.mStreamPlayerRunnab... | 5 |
public void run()
{
Graphics g = getGraphics();
int rColor, gColor, bColor;
int x, y, width, height, dx, dy;
while(true)
{
if(dm != null)
{
x = (int)((dm.width + 1) * Math.random());
y = (int)((dm.height + 1) * Math.random());
dx = (int)((x + 50) * Math.random(... | 3 |
public boolean compa(String a){
boolean b= true;
String txt= a.replaceAll(" ", "");
if(txt.length()==0){
b=false;
error.setText("Los campos marcados con asteriscos son obligatorios");
}
return b;
} | 1 |
private static void createDecimalParameters()
{
decimalArray = new Decimal[PARAMETERS];
for (int i = 0; i < PARAMETERS; i++)
{
Decimal decimal = Decimal.valueOf(i * 10.1);
decimalArray[i] = decimal;
}
} | 1 |
private String doMultiply(String n1, String n2)
{
int[] a1 = new int[n1.length()];
int[] a2 = new int[n2.length()];
for (int i =0;i< n1.length(); i++)
{
a1[i] = n1.charAt(n1.length() - i -1) - '0';
}
for (int i = 0; i< n2.length(); i++){
a2[i] = n2.charAt(n2.length() - i -1) - '0';
}
int[] rst = ... | 7 |
public void draw(Graphics g) {
setBbox(point1, point2, circleSize);
setVoltageColor(g, volts[0]);
drawThickLine(g, point1, lead1);
g.setColor(needsHighlight() ? selectColor : Color.gray);
setPowerColor(g, false);
int xc = point2.x;
int yc = point2.y;
drawT... | 9 |
public void selectY() {
int e = yElm == null ? -1 : sim.locateElm(yElm);
int firstE = e;
while (true) {
for (e++; e < sim.elmListSize(); e++) {
CircuitElm ce = sim.getElm(e);
if ((ce instanceof OutputElm || ce instanceof ProbeElm)
... | 7 |
public String getSymbol() {
String currentChar;
String expr = getCurrentExpression();
if (expr.length() > 1) {
currentChar = expr.substring(0, 1);
} else {
currentChar = expr;
}
return currentChar;
} | 1 |
@Override
public List<Command<Ui>> convert() throws CannotConvertModelException {
List<Command<Ui>> commands = new ArrayList<Command<Ui>>();
ImmutableLinearObjfunc objfunc = this.model.getObjfunc();
ImmutableSolution solution = this.model.getCurrentSolution();
List<ImmutableSolution> solutionHistory ... | 8 |
@Override
public void focusLost(FocusEvent e) {
if (isVisible()) {
focus.requestFocusInWindow();
}
} | 1 |
public List<Integer> getIntegerListFromString(String xArg)
{
if (xArg == null || xArg.equalsIgnoreCase(""))
return null;
List<Integer> d = new ArrayList<Integer>();
char[] c = xArg.toCharArray();
int lastPos = 0;
for (int i = 0; i < c.length; i++)
{
if (c[i] == ',')
{
d.add(Integer.value... | 4 |
@Override
public BufferedImage draw()
{
BufferedImage image = new BufferedImage(Chunk.getPixelLength(), Chunk.getPixelLength(), BufferedImage.TYPE_INT_ARGB);
Graphics2D gI = image.createGraphics();
return image;
} | 0 |
public ExtDecimal plus() {
if (type == Type.NUMBER) {
return new ExtDecimal(content.plus());
} else if (type == Type.POSITIVEZERO) {
return new ExtDecimal(Type.POSITIVEZERO);
} else if (type == Type.NEGATIVEZERO) {
return new ExtDecimal(Type.NEGATIVEZERO);
... | 5 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... | 7 |
public int hashCode() {
int lHashCode = 0;
if ( this._nome != null ) {
lHashCode += this._nome.hashCode();
}
if ( this._username != null ) {
lHashCode += this._username.hashCode();
}
if ( this._password != null ) {
lHashCode += this._password.hashCode();
}
if ( lHashCode == 0 ) {
lHashCode =... | 4 |
private static GridResourceWithFailure createGridResource(String name,
double baud_rate, double delay, int MTU, int totalPE,
int totalMachine, int rating, String sched_alg)
{
// Here are the steps needed to create a Grid resource:
// 1. We need to crea... | 4 |
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
value--;
if(value %((int) MAX) == 0 && value != (int) (MAX * filled))
try {
Thread.sleep(5000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if(value > 0)
repaint();
} | 4 |
public static void applyToxicSpikes(Team team) {
Pokemon poke = team.getActivePokemon();
if (poke.isType(Type.POISON) && !poke.getAbility().equals(Ability.LEVITATE)
&& !poke.isType(Type.FLYING)) {
team.removeToxicSpikes();
} else if (team.hasToxicSpikes() && !poke.isType(Type.STEEL)
&& !poke.isType(Typ... | 8 |
public synchronized void paint (Graphics g)
{ Dimension d=getSize();
if (I==null || I.getWidth(this)!=d.width ||
I.getHeight(this)!=d.height)
{ I=createImage(W=d.width,H=d.height);
if (I==null) return;
IG=I.getGraphics();
init();
}
dopaint(IG);
g.drawImage(I,0,0,W,H,this);
double vp... | 7 |
@Override
public T get(S key) {
if (tr.containsKey(key)) {
Node n = ls.remove(tr.get(key));
ls.add(n);
return n.value;
} else {
// not found
return null;
}
} | 1 |
public void run(){
try {
while(true){
byte[] data = new byte[1024];
DatagramPacket packet = new DatagramPacket(data, data.length);
ds.receive(packet);
String content = new String(packet.getData()).trim();
if(content.startsWith("user/")){
p = new Player(content.split("user/")[1], 100, 1, 1,... | 5 |
public static void main(String [] args){
long max =0;
long n =600851475143L;
long[] factors = getFactors(n);
for(long i: factors){
if(isPrime(i) && i > max){
max = i;
}
}
System.out.println("Max prime factor of " + n + " is: " + max);
} | 3 |
public static void main(String[] args) throws Exception {
// TODO code application logic here
Set<Integer> set = new Set();
System.out.println("Выберите действие");
System.out.println("1 - добавить элемент");
System.out.println("2 - удалить элемент");
System.out.println("... | 9 |
public List<Double> getSkewnessList() {
List<Double> result= new ArrayList<Double>();
double[] values= this.getSkewnessArray();
for (int i= 0; i< values.length; ++i) {
result.add(Double.valueOf(values[i]));
}
return result;
} | 1 |
public static Object funcall (java.lang.reflect.Method x, Stella_Object y, Object [] z) {
// Wrapped to catch and transform errors.
try {
return x.invoke(y,z);
}
catch (IllegalAccessException e) {
if (y == null) {
throw (StellaException) StellaException.newStellaException("Illegal Java Acc... | 7 |
private void removeForceFieldConnection(ForceFieldConnection forceFieldConnection) {
if (forceFieldConnection == null)
throw new IllegalArgumentException("The given forceFieldConnection is invalid!");
forceFieldConnections.remove(forceFieldConnection);
} | 1 |
public static void makeCompactGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)pa... | 7 |
@Override
public void keyReleased(KeyEvent e) {
keys[e.getKeyCode()] = false;
} | 0 |
public void AddUniform(String uniform)
{
int uniformLocation = glGetUniformLocation(program, uniform);
if (uniformLocation == -1)
{
System.err.println("Could not find uniform: " + uniform);
new Exception().printStackTrace();
System.exit(-1);
}
uniforms.put(uniform, uniformLocation);
} | 1 |
public boolean close() {
try {
wdg().cbtn.click();
return true;
} catch (Exception ex) {
return false;
}
} | 1 |
private void cpu1() {
switch (this.getGeneratoreRouting().getNextRoute()) {
case IO:
if (this.getIo().isFree()) {
this.getIo().setFree(false);
this.getIo().setJob(this.getCpu1().getJob());
this.getCpu1().setJob(null);
... | 4 |
private void bottomStroke(Location loc, int size){
// If Size == 0 we are done.
// If Invalid, we can't move down any further anyway, so stop.
if(size == 0 || !grid.isValid(loc)) return;
Actor tmp = null;
int r = loc.getRow();
int c = loc.getCol();
for(int i = 0; i < size; i++){
Location rightLoc... | 7 |
public void handle(Request request, Response response) {
// Reject non-announce requests
if (!Tracker.ANNOUNCE_URL.equals(request.getPath().toString())) {
response.setCode(404);
response.setText("Not Found");
return;
}
OutputStream body = null;
try {
body = response.getOutputStream();
this.pro... | 4 |
public String getName()
{
switch( error )
{
case NULL:
return "#NULL!";
case DIV0:
return "#DIV/0!";
case VALUE:
return "#VALUE!";
case REF:
return "#REF!";
case NAME:
return "#NAME?";
case NUM:
return "#NUM!";
case NA:
return "#N/A";
case CIR_ERR:
return "#C... | 8 |
private void douglasPeuckerSimplificationRoutine(Point[] bpoints, int j, int k, boolean[] pointMarker){
if (k <= j + 1)return; // there is nothing to simplify
// check for adequate approximation by segment S from v[j] to v[k]
int farthesti = j; // ind... | 6 |
public void startFadeOut() {
if(gamePlayList != null) {
if(this == gamePlayList.getNextSong(false) && !gamePlayList.getStopping()) {
stopFadeOut();
}
gamePlayList.startFadeOut();
}
} | 3 |
public void loadPathLocation(String pathLocation) {
file = new File(pathLocation);
if (!file.exists()) {
System.out.println("File or Directory not found. Path not Loaded");
try {
System.out.println("Put boards in " + new java.io.File(".").getCanonicalPath() + "/SudokuBoards/");
} catch (IOException ... | 2 |
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.