text stringlengths 14 410k | label int32 0 9 |
|---|---|
public final void des_set_key(byte[] key, int[] schedule)
throws SecurityException
{
int c,d,t,s;
int inIndex;
int kIndex;
int i;
if (des_check_key) {
if (!check_parity(key)) {
throw new SecurityException("des_set_key attempted with incorrect parity");
}
if (des_is_weak_key(key)) {
... | 5 |
public Matrix minus(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) {
throw new RuntimeException("Illegal matrix dimensions.");
}
Matrix C = new Matrix(M, N);
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
C.data[i][... | 4 |
@Override
protected int runTest(StdConverter.Operation oper) throws Exception
{
if (oper == null) {
throw new RuntimeException("Internal exception: no operation passed");
}
final boolean doRead = (oper != StdConverter.Operation.WRITE);
final boolean doWrite = (oper !... | 6 |
public boolean _setName(String name)
{
if(name != null)
{
sprite._setSpriteLabel(name);
return true;
}
else
{
return false;
}
} | 1 |
@Test(expected=NotEnoughOperandsException.class)
public void evaluatePostfix5() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException
{
try
{
postfix.removeFront();
String result = calc.evaluatePostfix(postfix);
}
... | 5 |
protected static boolean writeFile(Path file, List<String> lines, boolean append) {
assert (file != null) && (lines != null) && (lines.size() > 0);
OpenOption[] options;
Charset charset = Charset.defaultCharset();
if (append) {
options = new OpenOption[] { StandardOpenOption... | 7 |
* @param iRow index of row in table
* @param iCol index of column in table
*/
public void setValueAt(Object oProb, int iRow, int iCol) {
Double fProb = (Double) oProb;
if (fProb < 0 || fProb > 1) {
return;
}
m_fProbs[iRow][iCol] = (double) fProb;
double sum = 0;
for (int i = 0; i < m_fProb... | 9 |
public static void drawEmptyCircle(Graphics g, int x, int y){
// d = EMPTY_CIRCLE
// center (x + EMPTY_CIRCLE) / 2 , (y + EMPTY_CIRCLE) / 2
// for (int i = 255; i >= 0; i-= (255/10)){
// g.setColor(new Color(i,0,255));
//
// }
for (int i = 10; i >= -10; i--){
g.setColor(new Color(Math.abs(i * (127 / 1... | 1 |
protected ArrayList<Placement> densityMapping(Field[][] map, int c) {
shootDensity.clear();
for (int y = 0; y < map.length; ++y) {
for (int x = 0; x < map[y].length - shipValue + 1; ++x) {
int tmp = 0;
for (int z = 0; z < shipValue; ++z) {
... | 9 |
@Override
public int update(Integer idMetier, Secteur objetMetier) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} | 0 |
public static boolean compare(Node lhs, Node rhs) {
// search each node in trees Depth first.
if (lhs == null) {
return (rhs == null) ? true : false;
} else {
if (rhs == null) {
return false;
}
}
if (lhs.data == rhs.data) {
if (compare(lhs.left, rhs.left)) {
return compare(lhs.r... | 5 |
private boolean extraEntity(String outputString, int charToMap)
{
boolean extra = false;
if (charToMap < ASCII_MAX)
{
switch (charToMap)
{
case '"' : // quot
if (!outputString.equals("""))
extra = true;
... | 9 |
static void generate()
{
String[] players = {"mosquito.g1.WalkTowardsTheLight",
"mosquito.g2.G2Dragonfly",
"mosquito.g3.G3Player",
"mosquito.g4.Exterminator",
"mosquito.g5.G5Player",
"mosquito.g6.MosquitoBuster",
"mosquito.g7.ZapperPlayer"};
String[] boards = {
"Blank",
"BoxesAndLin... | 4 |
public void reapplyRowFilter() {
if (mRowFilter != null) {
ArrayList<Row> list = new ArrayList<>(mSelection.getCount());
int index = mSelection.firstSelectedIndex();
while (index != -1) {
Row row = getRowAtIndex(index);
if (mRowFilter.isRowFiltered(row)) {
list.add(row);
}
index = mSelec... | 4 |
private void insertClientToRouteThatMinimizesTheIncreaseInActualCost(int client,int depot,int period)
{
double min = 99999999;
int chosenVehicle =- 1;
int chosenInsertPosition =- 1;
double cost;
double [][]costMatrix = problemInstance.costMatrix;
int depotCount = problemInstance.depotCount;
ArrayLi... | 7 |
@Override
public List<Autor> ListBySobrenome(String Sobrenome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Autor> autores = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStat... | 3 |
@Test
public void depthest01opponent5()
{
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 6; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new SimpleAI());
... | 5 |
private Planet generateNewPlanet() {
if(++planetNameIndex >= PLANET_NAMES.length) planetNameIndex = 0;
String name = PLANET_NAMES[planetNameIndex];
int bottom = 5000;
if(Math.random() <= 0.5) bottom = 3000;
else if(Math.random() <= 0.5) bottom = 7000;
return new Planet(model, name, false, Planet.getStandard... | 3 |
public boolean isJoined(String a, String b)
{
ArrayList<String> aList = joinedTables.get(a);
if (aList != null)
{
if (aList.contains(b))
{
return true;
}
}
return false;
} | 2 |
public static String escapeHTML(String s) {
if (s==null) return "";
StringBuffer sb=new StringBuffer(s.length()+100);
int length=s.length();
for (int i=0; i<length; i++) {
char ch=s.charAt(i);
if ('<'==ch) {
sb.append("<");
}
else if ('>'==ch) {
sb.append("&g... | 7 |
protected boolean arvoreBinariaBuscaValidaAux(Nodo nodo){
if(nodo != null){
Nodo left = nodo.getLeft();
Nodo right = nodo.getRight();
if((left != null && left.getKey() > nodo.getKey()) || (right != null && right.getKey() < nodo.getKey())){
return false;
... | 7 |
public void writeObject(Object obj, AbstractHessianOutput out)
throws IOException
{
if (out.addRef(obj)) {
return;
}
Class cl = obj.getClass();
try {
if (_writeReplace != null) {
Object repl;
if (_writeReplaceFactory != null)
repl = _writeReplace.invoke(_writeReplaceFactory... | 7 |
private static void objectArrayAppend(StringBuilder sbuf, Object[] a,
Set<Object> seenSet) {
if (!seenSet.contains(a)) {
seenSet.add(a);
final int len = a.length;
for (int i = 0; i < len; i++) {
deeplyAppendParameter(s... | 3 |
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if ( this.isEnabled() ) {
if ( command.getName().equals("sheepfeed") ) {
// check for permission
if ( !this.canInfo(sender) ) {
sender.sendMessage("You are not allowed to use this command.");
... | 4 |
void clean(QNode pred, QNode s) {
Thread w = s.waiter;
if (w != null) { // Wake up thread
s.waiter = null;
if (w != Thread.currentThread()) {
LockSupport.unpark(w);
}
}
/*
* At any given time, exactly one node on list cannot be deleted -- the
* last inserted node. To accommodate this, if we c... | 9 |
public void gameRun() //gameRun is the true core of the game, this method is called in Main.
{
boolean gameQuit = false;
// player initialization process, below.
playerControl.setPlayers(); //Ask for player names
//----------------------------------------------
// Main game loop below.
while(gameQuit != true)... | 3 |
private BufferedImage load(String file){
if(textureMap.get(file) != null) return textureMap.get(file);
BufferedImage image = null;
try {
image = ImageIO.read(getClass().getResourceAsStream(file));
} catch (IOException e) {
try {
image = ImageIO.rea... | 3 |
public AST V()
{
// V -> D | W | ( L )
List<String> emp = Collections.<String>emptyList(); // an empty list
String next = toks.peek();
if ( isNumber(next) ) {
// D
double d1 = D();
return new Value(new Quantity(d1, emp, emp));
} else if ( isAlphabetic(nex... | 4 |
public void update(long dt) {
Widget next;
for (Widget wdg = child; wdg != null; wdg = next) {
next = wdg.next;
wdg.update(dt);
}
} | 1 |
public AlgorythmFile deleteFile(int index){
AlgorythmFile file = dataBaseFiles.remove(index);
if(file != null)
return file;
else
return null;
} | 1 |
@Test
public void testSetRock() {
System.out.println("setRock");
Cell instance = new Cell(0,0);
instance.setRock(false);
boolean expResult = false;
boolean result = instance.getRock();
assertEquals(expResult, result);
instance.setRock(true);
... | 0 |
private void generateChests() {
Random rand = new Random();
Point[] chests = new Point[rand.nextInt(5) + 1];
for (int i = 0; i < chests.length; i++) {
boolean a = rand.nextBoolean();
chests[i] = new Point();
chests[i].x = ((a) ? rand.nextInt(w - 2) + 1 : ((rand.nextBoolean()) ? 1 : w - 2));
chests[i].... | 7 |
public boolean isAdmin() {
return _prefix.indexOf('a') >= 0;
} | 0 |
public Vue(Joueur[] joueurs, org.polytech.nantes.monopoly.manager.Case[] cases) throws Exception {
// controle des paramètres
if(!(joueurs.length == 2 || joueurs.length == 4)) {
throw new Exception("nombre de joueurs renseigné incorrect");
}
this.setTitle("Monopoly");
this.setDefaultCloseOperation(JF... | 5 |
static final void method1903(int i, int i_0_, int i_1_, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_) {
anInt6866++;
int i_7_ = 0;
int i_8_ = i_2_;
int i_9_ = 0;
int i_10_ = -i_3_ + i_0_;
int i_11_ = i_2_ + -i_3_;
int i_12_ = i_0_ * i_0_;
int i_13_ = i_2_ * i_2_;
int i_14_ = i_10_ * i_10_;
int i... | 9 |
private static String exec(String ...cmd)
{
try {
ProcessBuilder pb = new ProcessBuilder(cmd);
Process process = pb.start();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream stdout = process.getInputStream();
int readByte = std... | 3 |
@Override
public Object getRequiredService2(Class serviceType) throws Exception {
Object rs = this.getService2(serviceType);
if (rs == null) {
throw new MissingRequiredServiceException(serviceType);
}
return rs;
} | 1 |
void snapshot() {
if (Page.isApplet())
return;
boolean b = false;
if (implementMwService()) {
Method method;
Object c = null;
try {
method = applet.getClass().getMethod("getSnapshotComponent", (Class[]) null);
if (method != null) {
c = method.invoke(applet, (Object[]) null);
}
}
... | 8 |
public void visitZeroCheckExpr(final ZeroCheckExpr expr) {
if (expr.expr == from) {
expr.expr = (Expr) to;
((Expr) to).setParent(expr);
} else {
expr.visitChildren(this);
}
} | 1 |
public void actionPerformed(ActionEvent e){
Object object = e.getSource();
if(object == button_calc) {
this.supsendBenchmarkLog();
SwingUtilities.invokeLater(new Runnable() {
public void run(){attack.outerAttack(key);}
});
} else if(object == button_key_length) {
key = new BsGs_Key(((key_length)co... | 3 |
public boolean canEncode(Serializable structure) {
return true;
} | 0 |
@Override
public Multiple build() {
try {
Multiple record = new Multiple();
record.intField = fieldSetFlags()[0] ? this.intField
: (java.lang.Integer) defaultValue(fields()[0]);
record.floatField = fieldSetFlags()[1] ? this.floatField
: (java.lang.Float) defaultValue(fields()[1]);
recor... | 4 |
private void markExploredCell(String descriptor) throws ArenaTemplateException {
String binStr = null;
try{
binStr = hexToBinaryStr(descriptor);
}catch(NumberFormatException e){
throw new ArenaTemplateException(2, "The descriptor contains some non-hex digit");
}
if(binStr.length() != this.rowCount *... | 9 |
static void downloadFailedFile(final String url) throws IOException {
synchronized (downloadedUrls) {
if (downloadedUrls.contains(url)) {
SparkUtils.getLogger().info("url already downloaded:" + url);
return;
} else {
downloadedUrls.add(url);
synchronized (downloadedUrlWriter) {
downloadedU... | 3 |
public void validate() throws InvalidMenuException{
if(style == null || mainColor == null || titleColor == null || pageColor == null || title == null){
throw new InvalidMenuException("Property null");
}
if(usePrefix && prefix == null){
throw new InvalidMenuException("Prefix null and enabled");
}
} | 7 |
public static void main(String[] args) {
Random r = new Random();
ArrayList<Integer> ArrayA = new ArrayList<Integer>();
ArrayList<Integer> ArrayB = new ArrayList<Integer>();
ArrayList<Integer> ArrayC = new ArrayList<Integer>();
ArrayA.add(r.nextInt(10));
ArrayA.add(r.nextInt(10));
ArrayA.add(r.nextInt(10)... | 4 |
public int FindRouterPacket(int seq)
{
int result = -1;
//search for the sequence number
for(int x=0; x<internalMemory.size();x++)
{
//compare each packet sequence with the sequence number
if(internalMemory.get(x).GetSequenceNumber() == seq)
{
... | 2 |
public String getString(String expression, Object context)
throws XPathExpressionException {
assert(expression != null);
if(context == null) {
assert(document != null);
context = document;
}
return (String) xpath.evaluate(expression,
... | 1 |
public void compileShader()
{
glLinkProgram(program);
if (glGetProgram(program, GL_LINK_STATUS) == 0)
{
System.err.println(glGetShaderInfoLog(program, 2024));
System.exit(1);
}
glValidateProgram(program);
if (glGetProgram(program, GL_VALIDATE_STATUS) == 0)
{
System.err.println(glGetShad... | 2 |
public static void main (String[] args) throws IOException {
// starts the REPL
boolean repl = true;
while (repl) {
try {
// split input on semicolons, only grab and interpret statements before the first semicolon
Scanner scan = new Scanner(System.in).... | 8 |
int getDifference(Image image, Colour q, int x1, int y1, int x2, int y2) throws ImageTooSmallException
{
if (image.getWidth() <= x1 || image.getHeight() <= y1 || image.getWidth() <= x2 || image.getHeight() <= y2 || x1 < 0 || x2 < 0 || y1 < 0 || y2 < 0)
{
throw new ImageTooSmallException();
}
return image.ge... | 8 |
@Override
protected void doRemoveAll() {
try {
cache.removeAll();
} catch (Throwable e) {
CacheErrorHandler.handleError(e);
}
} | 1 |
public Vector2 GetLightPos(int j)
{
int i = 0;
ComputedPlace p = null;
while ((p = places[i++][j]) == null)
;
double max = p.h * p.w;
for (; i < places.length; i++)
{
ComputedPlace t1 = places[i][j];
if (t1 != null)
{
double t2 = t1.h * t1.w;
if (t2 > max)
{
max = t2;
p = ... | 4 |
public double getAttenuationConstant(){
if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){
this.generalAttenuationConstant = 0.0D;
}
else{
this.generalAttenuationConstant = Complex.sqrt(this.getDistributedImpedance().times(this.getDistributedAdmitt... | 2 |
protected boolean[] datasetIntegrity(
boolean nominalPredictor,
boolean numericPredictor,
boolean stringPredictor,
boolean datePredictor,
boolean relationalPredictor,
boolean multiInstance,
int classType,
boolean predictorMissing,
boolean classMissing) {
... | 9 |
private boolean containsExcludeToken(String agentString)
{
if (excludeList != null) {
for (String exclude : excludeList) {
if (agentString != null && agentString.toLowerCase().indexOf(exclude.toLowerCase()) != -1)
return true;
}
}
return false;
} | 4 |
private void parseID3v1ExtendedTag(byte[] tagInput) {
int runningIndex = -1;
// find header "TAG"
for (int i = 0; i < tagInput.length; i++) {
boolean foundT = tagInput[i] == (byte) 'T';
boolean foundA = (tagInput.length > i + 1 && tagInput[i + 1] == (byte) 'A');
boolean foundG = (tagInput.length > i + 2... | 9 |
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_init_bits = init_bits;
// ... | 9 |
public boolean hasNext() {
if (iit == null || !iit.hasNext()) {
if (!it.hasNext()) {
return false;
}
Map.Entry<K, ArrayList<Long>> item = it.next();
key = item.getKey();
iit ... | 3 |
protected void loadResource(ResourceSpecs<T> specs) {
if (specs == null) return;
String uri = specs.getUri();
if (uri == null || uri.length() == 0) {
if (isVerbose()) Log.d(TAG, "1. Resource was not loaded, uri is empty");
specs.onLoaded(null, true, false);
r... | 8 |
public String printLineNumber(boolean printAlso){
currentLineNumber = lineNumber++;
return printLineNumber && printAlso ? String.valueOf(currentLineNumber) + ". " : "";
} | 2 |
public static boolean exportHover(double xPos,double yPos) {
int check = 0;
if((xPos > exportXborderL) && (xPos < exportXborderR))
check+=1;
if((yPos > exportYborderT) && (yPos < exportYborderB))
check+=1;
return check == 2;
} | 4 |
private void serialize(OutputStream out) throws IOException {
LinkFlags lf = header.getLinkFlags();
ByteWriter bw = new ByteWriter(out);
header.serialize(bw);
if (lf.hasLinkTargetIDList())
idlist.serialize(bw);
if (lf.hasLinkInfo())
info.serialize(bw);
if (lf.hasName())
bw.writeUnicodeString(nam... | 8 |
public void gridletSubmit(Gridlet gl, boolean ack)
{
// update the current Gridlets in exec list up to this point in time
updateGridletProcessing();
// reset number of PE since at the moment, it is not supported
if (gl.getNumPE() > 1)
{
String userName = GridSim.... | 4 |
void insert(String key, T value) {
if (key.isEmpty()) {
this.value = value;
return;
}
char c = key.charAt(0);
String substr = key.substring(1);
if (c < character) {
if (left == 0) {
left = createNode(buffer, c, substr.isEmpty() ? value : null);
}
buffer.get(left).insert(key, value);
} e... | 9 |
public boolean isValidMove(Direction d)
{
if(d == Direction.DOWN)
{
if(compare(currentBlock, blockRow, blockCol, 1, 0) == true)
return true;
else
return false;
}
else if(d == Direction.RIGHT)
{
if(compare(currentBlock, blockRow, blockCol, 0, 1) == true)
return true;
else
return fa... | 9 |
@org.junit.Test
public void testBlocking() throws com.grey.base.GreyException, java.io.IOException
{
FileOps.deleteDirectory(rootdir);
final com.grey.naf.BufferSpec bufspec = new com.grey.naf.BufferSpec(0, 10);
final String rdwrdata = "This goes into an xmtpool buffer"; //deliberately larger than IOExecWriter'... | 8 |
public boolean open( )
{
state = State.PROCESSING;
setVisible(true);
while (state == State.PROCESSING);
return(state == State.OKAY);
} | 1 |
@Override
public boolean tick(final Tickable ticking, final int tickID)
{
if((flag==State.STOPPED)||(amDestroyed()))
return false;
tickStatus=Tickable.STATUS_START;
if(tickID==Tickable.TICKID_AREA)
{
tickStatus=Tickable.STATUS_BEHAVIOR;
if (numBehaviors() > 0)
{
eachBehavior(new EachApplicable... | 8 |
public void scaleUp(){
switch (polygonPaint) {
case 0:
line.ScaleUp();
repaint();
break;
case 1:
curv.ScaleUp();
repaint();
... | 7 |
public void getCurrentRooms(CommandSender sender) {
ArrayList <String> current = new ArrayList <String> ();
Player [] player = Bukkit.getServer().getOnlinePlayers();
for (int i = 0; i < player.length; i++) {
if (current.contains(config.getConfig().getString("Player."+player[i].getName()+".CR"))) {
}
els... | 6 |
public static Tetromino generatePiece() {
Random r = new Random();
Tetromino t;
switch (r.nextInt(7)) {
case 0:
t = TypeI;
break;
case 1:
t = TypeL;
break;
case 2:
t = TypeJ;
break;
case 3:
t = TypeO;
break;
case 4:
t = TypeT;
break;
case 5:
t = TypeZ;
break;
case... | 7 |
public static void loadWhitelistConfigYAML(MainClass mainClass) {
File file = new File(path + "Whitelist/config.yml");
FileConfiguration f = YamlConfiguration.loadConfiguration(file);
for(String str : f.getStringList("Whitelist")) {
mainClass.whitelist.add(str.toLowerCase());
}
} | 1 |
private String getNbrString() {
String r = "";
for (NbrCostPair ncp : nbrList) {
if (r.length() > 0) r += ", ";
r += ncp.getNbr().getId() + "[" + ncp.getCost() + "]";
}
return r;
} | 2 |
private String getErrors(String algChoice, String matroidChoice, String oracleType) {
error = new String[] {"", "", "", ""};
boolean runFailed = false;
if (algChoice.length()==0) {
error[0] = "an algorithm,\r";
runFailed = true;
}
if (matroidChoice==null) ... | 6 |
private void list_movesMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_list_movesMousePressed
current_move=null;
current_sprite=null;
hitbox_index_selected=-1;
frame_index_selected=-1;
//Add frames
listOfMoves_main_file = main_doc.getElementsByTagName("Move");
DefaultListMode... | 5 |
public boolean avoidAsteroid(){
boolean hit=false;
for(int b=0;b<objects.size();b++){
if(objects.get(b).kind!=0)
continue;
boolean obstacle = collisionCircle((int)(x+vx),(int)(y+vy),h/2,(int)(objects.get(b).x),(int)(objects.get(b).y),(int)(objects.get(b).h/2));
... | 3 |
private JPanel createSortingPane() {
JPanel sorting = new JPanel();
sorting.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
sorting.setLayout(new BoxLayout(sorting, BoxLayout.PAGE_AXIS));
JSlider slider;
String[] props = controller.getParametersBean().getSortingProperties();
for (String prope... | 1 |
public void setRenderer(int row, int column) {
if(column == 0)
setHorizontalAlignment(SwingConstants.CENTER);
else if (column == 1) {
setHorizontalAlignment(SwingConstants.RIGHT);
for (int i=0;i<highlightIndex.size(); i++) {
i... | 8 |
private void handleSelectedAction() {
if (!Commons.get().isKeyPressed()
&& (Keyboard.isKeyDown(Keyboard.KEY_RETURN) || Mouse
.isButtonDown(0)
&& isMouseOnSelection(currentSelection))) {
Commons.get().setKeyPressed(true);
switch (currentSelection) {
case YES:
Sounds.get().playAccept();
... | 6 |
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String[] words = input.nextLine().toLowerCase().split("[\\W\\d]+");
TreeMap<String, Integer> wordsHashMap = new TreeMap<>();
for (String word: words) {
if (wordsHashMap.containsKey(word)) {
wordsHashMap.put(word, wor... | 6 |
public boolean existeCliente(String nick, String email){
getLista g = new getLista();
ListaClientes = g.getListaCliente();
ListaProveedores = g.getListaProveedor();
for(int i = 0;i<ListaClientes.size();i++){
if(ListaClientes.get(i).getNick().equals(nick) || ListaClientes.get(i).... | 6 |
public static String md5(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte[] byteDigest = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < byteDigest.length; offset++) {
i = byteDigest[offset];
i... | 4 |
public String XMLtoResources (int number){
try {
String path = new File(".").getCanonicalPath();
FileInputStream file =
new FileInputStream(new File(path + "/xml/resources.xml"));
DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
... | 6 |
public boolean symmetricalEqual(TreeNode a, TreeNode b){
if(a == null && b == null)
return true;
else if(a != null && b == null || a == null && b != null)
return false;
else if(a.val == b.val)
return true && symmetricalEqual(a.right, b.left)
&& symmetricalEqual(a.left, b.right);
else
return fa... | 9 |
private TableData join(HashMap<String, TableData> result)
{
//Queue<String> todo=new LinkedList<String>();
//Queue<String> temp=new LinkedList<String>();
String leftId=idsTobeJoin.remove(idsTobeJoin.size()-1);
int index=idsTobeJoin.size()-1;
String rightId;
ArrayList<String> finishedId=new ArrayList<Str... | 5 |
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getPlayer().getItemInHand().getType() == Material.SLIME_BALL && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
plugin.debugMessage("Block name: " + event.getClickedBlock().getType());
plugin.debugMess... | 2 |
public static List<Venue> createFromResultSet(ResultSet result) throws SQLException {
List<Venue> rtn = new ArrayList<Venue>();
while(result.next()) {
rtn.add(createOneFromResultSet(result));
}
return rtn;
} | 1 |
public int calcPayment() {
return ((int)(this.getEffMult()*this.getBase()));
} | 0 |
public void setRASOutput() throws BadLocationException {
if (rasChecker.isSimpleNet()) {
simplePNLabel.setText("OK");
simplePNLabel.setForeground(RASConst.greenColor);
} else {
simplePNLabel.setText("False");
simplePNLabel.setForeground(RASConst.redColor);... | 9 |
private boolean isContactAdded(Contact contact)
{
for(int i=0; i<addedContactCount; i++)
{
Contact addedContact = contacts[i];
if(addedContact.getFirstName().equalsIgnoreCase(contact.getFirstName()))
{
if(addedContact.getLastName().equalsIgnoreCase(contact.getLastName()))
{
if(addedContac... | 4 |
@Override
public File execute(File wd, String[] cmd) {
// TODO Auto-generated method stub
try
{
if (cmd.length == 3)
{
File f1 = new File(wd, cmd[1]);
if (!f1.exists())
throw new FileNotFoundException();
File f2 = new File(wd, cmd[2]);
if (f2.exists())
throw new IOException();
... | 7 |
protected Class getTransitionClass()
{
return MealyTransition.class;
} | 0 |
public static int indexOf(final String s, final char searchChar, final int beginIndex, final int endIndex) {
for (int i = beginIndex; i < endIndex; i++) {
if (s.charAt(i) == searchChar) {
return i;
}
}
return -1;
} | 2 |
public static void testDomainTheory(Symbol relationName, Symbol className) {
{ Surrogate renamed_Class = Logic.getDescription(className).surrogateValueInverse;
Proposition prop = null;
Cons consQuery = Stella.NIL;
QueryIterator query = null;
List instances = Logic.allClassInstances(renamed_C... | 8 |
public void setSizeY(int y) {
ySize = y;
image = new BufferedImage(xSize, ySize, BufferedImage.TYPE_INT_RGB);
for (int i = 0; i < xSize; i++) {
for (int j = 0; j < ySize; j++) {
image.setRGB(i, j, 0xffffff);
}
}
} | 2 |
@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... | 8 |
private void generate() {
rand = new Random();
MazeNode initial = grid[rand.nextInt(x_Dim)][rand.nextInt(y_Dim)][rand
.nextInt(z_Dim)];
MazeNode current = initial;
current.setVisited(true);
int count = 1;
int size = x_Dim * y_Dim * z_Dim;
// checks if all nodes in maze have been visited; continues o... | 6 |
private void showCommandPrompt() {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print(localName + "# ");
String inputCommand;
try {
while ((inputCommand = in.readLine()) != null) {
String[] tokens = inputCommand.split(" ");
if ("show".equals(tokens[0])) {
... | 7 |
@Test
public void testPropertiesFile() {
String[] testPropsAFF = {"duration", "title", "author", "album", "date", "comment",
"copyright", "ogg.bitrate.min", "ogg.bitrate.nominal", "ogg.bitrate.max"};
String[] testPropsAF = {"vbr", "bitrate"};
try {
File file = new Fi... | 5 |
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.