text stringlengths 14 410k | label int32 0 9 |
|---|---|
private void cboInstructionsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboInstructionsItemStateChanged
// TODO add your handling code here:
int instructionMethodValue = cboInstructions.getSelectedIndex();
if (instructionMethodValue == 0) {
txtAreaInstr... | 6 |
private boolean stopConditionsProcessor(StopConditions stopCondition) {
boolean any = (stopCondition == StopConditions.ANY);
// EXCEEDED_LIMIT_TRANSMISSION
if (stopCondition == StopConditions.EXCEEDED_LIMIT_TRANSMISSION || any) {
if (receivedPackageCount >= settings.getPacketsQuantit... | 9 |
* @param dependOn the index number of pathway this one depends on, -1 if no dependency
* @return
*/
private ArrayList<Queue> pathwayQueues(LayoutInfo[] layouts,int[] dependOn){
ArrayList<Queue> queues = new ArrayList<Queue>();//each queue is for a disconnected group of pathways
int n=layou... | 7 |
public int GetPassengerQuantity()
{
return passengersOnBoard;
} | 0 |
public void moveBall() {
for (int i = 0; i < SPEED; i++) {
ball.move(dx, dy);
collisionCheck();
}
} | 1 |
final void method2629(int i, r var_r, int i_12_, int i_13_) {
anInt4114++;
r_Sub1 var_r_Sub1 = (r_Sub1) var_r;
i_13_ += 1 + ((r_Sub1) var_r_Sub1).anInt10468;
i += i_12_ + ((r_Sub1) var_r_Sub1).anInt10474;
int i_14_ = i * ((Class330) this).anInt4113 + i_13_;
int i_15_ = 0;
int i_16_ = ((r_Sub1) var_r_Sub1).anInt1... | 6 |
public static void setWrap(boolean isSelected, JCellule[][] grid, JLabel lblGeneration, JButton btnProchaineGeneration) {
ControllerGrille.grid.setWrap(isSelected);
synchroniser(grid, lblGeneration, btnProchaineGeneration);
} | 0 |
private void load(boolean inverse) {
if(inverse) {
for(int y = 0; y < SIZE; y++) {
for(int x = 0; x < SIZE; x++) {
pixels[x + y * SIZE] = sheet.pixels[(this.x - x + 15) + (y+this.y) * sheet.SIZE];
}
}
} else {
for(int y = 0; y < SIZE; y++) {
for(int x = 0; x < SIZE; x++) {
pixels[x + ... | 5 |
public void fortify() {
Countries c = map.getCountries();
// there are no troops to fortify
if (c.getTroops(c.getAttacker()) == 1) {
return;
}
// get amount of fortifiers
boolean stop = false;
int fortification;
do {
String fortification_String;
do {
fortification_String = JOptionPane.sho... | 9 |
protected static Ptg calcNPER( Ptg[] operands )
{
if( operands.length < 3 )
{
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
debugOperands( operands, "calcNPER" );
double rate = operands[0].getDoubleVal();
double pmt = operands[1].getDoubleVal();
double pv = operands[2].getDoubleVal... | 4 |
public static final List<Integer> parseSecTypes(String types_) {
List<Integer> result = new ArrayList<Integer>();
String[] types = types_.split(",");
for (int i = 0; i < types.length; i++) {
int typeNum = secTypeNum(types[i]);
if (typeNum != secTypeInvalid)
result.add(typeNum);
}
... | 2 |
private int[] getAvailable(Date s, Date e)
{
boolean[] busy = new boolean[N];
Arrays.fill(busy, false);
int i;
for (String start : cal.keySet())
{
for (CalEntry ce : cal.get(start))
{
if (ce.overlaps(s, e))
{
for (i = 0; i < ce.participants.length; i++)
{
busy[ce.participants... | 9 |
public String get(String user, String password, String urlOption,
String searchString, Boolean isFirst) {
String response = null;
DefaultHttpClient httpClient = new DefaultHttpClient();
try {
String url = urlOption + URLEncoder.encode(searchString, UTF_8);
if... | 8 |
void attackPlaceDiagonallyBelowRight(int position, char[] boardElements, int dimension, int attackPlacesOnTheRight) {
int positionRightBelow = 1;
while (attackPlacesOnTheRight > 0) {
if (isPossibleToPlaceDiagRightBelow(boardElements.length, position, dimension, positionRightBelow)
... | 3 |
public void Login(RequestPacket request, DBCollection coll, User user) {
try {
// Use cursor to find query -> password
DBCursor cursor = coll.find(new BasicDBObject("user_name", request.getUser_name()));
if(cursor.hasNext()) {
BasicDBObject ob = (BasicDBObject) cursor.next();
// Check that user_p... | 3 |
@Override
public String getName() {
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
String ret = null;
try {
ret = (String)super.invokeMethod(methodName, new Object[0], new Class<?>[0]);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
... | 4 |
public HTSMsg rcv() throws IOException{
byte[] lenBytes = new byte[4];
while (is.available() < 4) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
is.read(lenBytes, 0, 4);
long len = HTSMsg.deserializeS64(lenBytes, 4);
byte[] msg = new byte[(int)len];
while (is.available() < l... | 4 |
@EventHandler(priority = EventPriority.MONITOR)
void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().getTitle().equals(name)) {
event.setCancelled(true);
int slot = event.getRawSlot();
if (slot >= 0 && slot < size && optionNames[slot] != null) {
Plugin plugin = this.plugin;
Op... | 6 |
private void itemAction(int slot, String act) {
if (slot < 0)
slot = 0;
if (slot > 15)
slot = 15;
Coord c = new Coord(0, 0);
if (UI.instance.equip.equed != null)
if (UI.instance.equip.equed.get(slot) != null) {
if (act.equals("itemact")... | 5 |
@Override
public boolean activate() {
return (!Bank.isOpen()
&& (
!Inventory.contains(Settings.itemOneID)
|| (!Inventory.contains(Settings.itemTwoID) && !Settings.usingHerb)
)
&& !Widgets.get(13, 0).isOnScreen()
&& !validate(Constants.WAITFOR_WIDGET)
&& !validate(Constants.FLASK_WIDGET)
);
} | 6 |
public static void makeHtmlReport(MyArrayList<Employee> list){
File f = new File("html" + File.separator + "report.html");
try(FileWriter fw = new FileWriter(f);
BufferedWriter bw = new BufferedWriter(fw)){
bw.write("<!Doctype html>");
bw.newLine();
bw.write("<html>");
bw.newLine();
bw.write("<h... | 5 |
public String[] check(String passage) {
// No misspelled words for an empty string.
if ((passage == null) || (passage.length() == 0)) {
return null;
}
ArrayList errorList = new ArrayList();
// Tokenize the passage using spaces and punctionation.
StringTokenizer st = new StringTokenizer(passage, ... | 8 |
public void deconnect() {
InNode in = (a instanceof InNode ? (InNode) a : (InNode) b);
OutNode out = (a instanceof InNode ? (OutNode) b : (OutNode) a);
if (in != null) {
in.deconnect(out);
in = null;
}
if (out != null) {
out.deconnect(in);
out = null;
}
} | 4 |
public boolean isReverseOf(Edge o) {
if (o.start == this.end && o.end == this.start) {
return true;
}
return false;
} | 2 |
@Override
public void layoutContainer(Container container) {
final int offsetX = 0;
final int offsetY = 0;
final int boxWidth = (container.getWidth() - offsetX * 2) / numBoxes;
final int boxHeight = (container.getHeight() - offsetY * 2) / numBoxes;
for(Component comp : container.getComponents()) {
... | 2 |
public Integer getIdSintomas() {
return idSintomas;
} | 0 |
@RequestMapping(value="/players/nearby", method=RequestMethod.GET)
public @ResponseBody List<Player> getNearbyPlayers(String id){
System.out.println("in nearby yo");
Player requestingPlayer = playerService.getPlayerById(id);
List<Player> players = playerService.getAllAlive();
System.out.println("Players size... | 6 |
public void setPlayerInArea(Player p, Location newPos) {
double x = newPos.getX();
double y = newPos.getY();
double z = newPos.getZ();
boolean f = false;
Location min = minPoint.getLocation();
Location max = maxPoint.getLocation();
if(x < min.getX()) {
... | 8 |
public CropImage2() {
initComponents();
fc = new JFileChooser();
addB.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int returnVal = fc.showOpenDialog(CropImage2.this);
if (returnVal == ... | 5 |
@Override
protected int[] orderArray() {
for (int i = 1; i < len(); i++) {
bubbleDown(i);
}
return array;
} | 1 |
public int hamming() {
int compare = 1;
if (!hammed) {
for (int i = 0; i < tiles.length; i++) {
for (int j = 0; j < tiles[i].length; j++) {
if (tiles[i][j] != 0) {
if (tiles[i][j] != compare) {
hamming++;
}
}
compare++;
}
}
hammed = true;
return hamming;
}
r... | 5 |
public static final String stringFromBytes(byte abyte0[], int offset, int length) {
char ac[] = new char[length];
int k = 0;
for (int l = 0; l < length; l++) {
int i1 = abyte0[offset + l] & 0xff;
if (i1 != 0) {
if (i1 >= 128 && i1 < 160) {
... | 5 |
public void setUserInfo(String userInfo) {
this.userInfo = userInfo;
this.authority = assembleAuthority(this.host, this.port, this.userInfo, null);
} | 0 |
public List<BoardDataBean> getArticleList(int start, int end, String id)
throws Exception {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
List<BoardDataBean> articleList = null;
String sql = "";
try {
conn = getConnection();
/*추천지수 불러오는sql*/
sql = "update board set... | 9 |
@Override
public void vieraile(TormaysReunaanViesti viesti) {
if (tormaysLaskuri > 0) {
return;
}
switch (viesti.getReuna()) {
case YLA:
case ALA:
viestit.kasitteleValittomastiViesti(new AlustaNopeusViesti());
viestit.kasitt... | 5 |
private static BufferedImage mergeNearestWhitePoints(BufferedImage img) {
Graphics2D g = img.createGraphics();
g.setColor(Color.WHITE);
for (int k = 0; k < 20; k++) {
for (int i = 0; i < img.getWidth() - 1; i++) {
for (int j = 0; j < img.getHeight() - 1; j++) {
if (img.getRGB(i, j) == -1) {
Vec... | 5 |
public void setURLStream (String connstr){
try {
URLStream = new URL(connstr).openStream();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
};
} | 2 |
protected LinkedNode<K,V> getInner(Object o, int h, int segment) {
long recid = segmentRecids[segment];
for(int level=3;level>=0;level--){
long[][] dir = engine.get(recid, DIR_SERIALIZER);
if(dir == null) return null;
int slot = (h>>>(level*7 )) & 0x7F;
as... | 9 |
public MpimParseInput(Proxy proxy) throws ConnectionClosedException
{
//assert(parse != null && proxy != null);
assert(proxy != null);
String inicial ="<stream>";
String end = "</stream>";
String tmp;
int i;
body = null;
accounts = proxy;
try{
byte data[] = new byte[accounts.getConnection().so... | 8 |
private String readString(byte[] remainingData, int stringIdx) throws IOException {
int strLen = readUInt16(remainingData, stringIdx);
if (strLen == 0)
return "";
stringIdx += 2;
byte[] str = new byte[strLen * 2];
System.arraycopy(remainingData, stringIdx, str, 0, strLen * 2);
return new String(remaining... | 1 |
public boolean equals(Object o){
if (! (o instanceof ASection )) return false;
if ( (start.getOffset() == ((ASection)o).getStartOffset())
&& (end.getOffset() == ((ASection)o).getEndOffset())
) return true;
return false;
} | 3 |
@Override
public AbstractPlay getBest() {
ArrayList<AbstractPlay> bestPlays = getBestPlays();
return bestPlays.get(rnd.nextInt(bestPlays.size()));
} | 0 |
private boolean checkSpace() {
// TODO Auto-generated method stub
for (int i = 0; i < clientObj.length; i++) {
if(clientObj[i]!=null)
count++;
}
if(count<5){
return true;
}
else{
return false;
}
} | 3 |
final Interface2 method3739(int i, Buffer buffer, boolean bool, int i_35_,
int i_36_) {
try {
if (i != 8448)
((OpenGlToolkit) this).aClass64_Sub3_7844 = null;
anInt7605++;
if (aBoolean7873 && (!bool || aBoolean7869))
return new Class135_Sub1(this, i_35_, buffer, i_36_, bool);
return new Cla... | 6 |
public static void printTurn() {
for (MyAnt ant : MyBot.myAnts) {
int dir = ant.getDirection();
String direction = "";
if (dir < 4) {
switch (dir) {
case 0:
direction = "E";
break;
case 1:
direction = "S";
break;
case 2:
direction = "W";
break;
case 3:
... | 6 |
@SuppressWarnings("resource")
public Class<?>[] getClassesFromThisJar(Object object)
{
final List<Class<?>> classes = new ArrayList<Class<?>>();
ClassLoader classLoader = null;
URI uri = null;
try
{
uri = object.getClass().getProtectionDomain().getCodeSource().ge... | 7 |
public static void figureOutMapIn(PrintStream w, Object... comps) {
for (Object c : comps) {
ComponentAccess cp = new ComponentAccess(c);
w.println("// Input mapping to " + objName(cp));
for (Access fin : cp.inputs()) {
Role role = fin.getField().getAnnotation... | 4 |
public static void main(String[] args) {
// Declare named constants.
final double MIN_FAHRENHEIT = -459.67;
// Declare the variables.
double fahrenheit;
double convertedDegrees;
int tempScale;
String tempScaleStr="";
// Creating the Scanner object
Scanner keyboard = new Scanner(Syste... | 6 |
public void setTime(int time)
{
this.time = time;
notifyListeners();
} | 0 |
LiteralDecoder()
{
} | 0 |
public void reHash(){
int nuevaCapacidad=(int) (capacidad+(INCREMENTO*capacidad));
if(esPrimo(nuevaCapacidad)){
capacidad=nuevaCapacidad;
}
else{
boolean bool=false;
int proximoPrimo=0;
for(int i=nuevaCapacidad+1;i<Integer.MAX_VALUE && !bool;i++){
if(esPrimo(i)){
proximoPrimo=i;
bool=t... | 7 |
private List<TileButton> getNeighbours(int x, int y) {
List<TileButton> neighbours = new ArrayList<TileButton>();
for(int j = y - 1; j <= y + 1; j++) {
for(int i = x - 1; i <= x + 1; i++) {
if(j == y && i == x) {
continue;
} else if(j < 0 || i < 0 || !(j < this.mineFieldGrid.getHeight())
||... | 8 |
@Override
public void initStatesList(GameContainer gc) throws SlickException {
input = gc.getInput();
try {
loadedResources = new Loader();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
loadedMapResources = new MapLoader();
} catch (IOException e) {
... | 4 |
public static RoundManager getInstance()
{
return instance;
} | 0 |
public Gphelper() {
initComponents();
boolean bOk;
String errText = "";
SystemCommand cmd = new SystemCommand();
gpgCommand = "gpg2";
cmd.setCommand(gpgCommand + " --batch --version");
bOk = cmd.run();
if (bOk == false) {
gpgCommand = "gpg";
... | 9 |
DeviceImpl (USB bus, File f, int a)
throws IOException, SecurityException
{
super (null, bus, a);
usb = bus;
path = f.getPath ();
// should only fail if the device unplugged before
// we opened it, or permissions were bogus, or ...
if ((fd = openNative (path)) < 0) {
String message;
message =... | 5 |
public void onQuit(IRCUserInfo user, String msg) {
String nick = user.getNick();
String username = user.getUsername();
String host = user.getHost();
if (msg.length() > 0)
msg = "("+ msg +")";
String line = "* Quit: "+ nick +" ("+ username +"@"+ host +") quits "+ msg;
int iTabsAmount = main... | 4 |
private void setHandles() {
if (handleArc == null)
handleArc = new Polygon();
else handleArc.reset();
float x0 = rect.x + rect.arcwidth * 0.5f;
handleArc.addPoint(Math.round(x0 - 4), Math.round(rect.y - 14));
handleArc.addPoint(Math.round(x0), Math.round(rect.y - 18));
handleArc.addPoint(Math.round(x0 + ... | 9 |
protected static void writeUIFile(UIFileTextVO uifile, Path destination) throws IOException {
assert (uifile != null) && (destination != null);
Charset charset = Charset.defaultCharset();
OpenOption[] options = new OpenOption[] { StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenO... | 3 |
@EventHandler
public void GrenadeEvent(ProjectileHitEvent event) { //Grenade
if (event.getEntity().getType() == EntityType.SNOWBALL) {
Snowball sb = (Snowball) event.getEntity();
if (sb.getShooter() instanceof Player) {
// createExplosion(X, Y, Z, Power (F), Fire (tr... | 2 |
public void setTextureCoords(Vector3f[] texs) {
ta = texs[0];
tb = texs[1];
tc = texs[2];
if (this.isQuad()) {
td = texs[3];
}
} | 1 |
public String toString() {
StringBuffer buf = new StringBuffer("@");
buf.append(getTypeName());
if (members != null) {
buf.append("(");
Iterator mit = members.keySet().iterator();
while (mit.hasNext()) {
String name = (String)mit.next();
... | 3 |
public Object getAttribute(String name)
throws AttributeNotFoundException, MBeanException,
ReflectionException {
// Validate the input parameters
if (name == null)
throw new RuntimeOperationsException
(new IllegalArgumentException("Attribute name is null")... | 9 |
private void loadDefinition(Buffer stream) {
do {
int attribute = stream.getUnsignedByte();
if (attribute == 0)
return;
else if (attribute == 1) {
rgbColour = stream.get3Bytes();
rgbToHls(rgbColour);
} else if (attribute == 2)
textureId = stream.getUnsignedByte();
else if (attribute == ... | 8 |
public AbstractController() {
registeredViews = new ArrayList<>();
registeredModels = new ArrayList<>();
} | 0 |
public void printLines(int indent, String line) {
if (startPos == -1) {
pw.print(line);
} else {
pw.print(line.substring(0, startPos));
printRegion(indent + startPos, line);
pw.print(line.substring(endPos));
}
} | 1 |
@Override
public void dragFrame(JComponent f, int newX, int newY) {
//System.out.println("dragFrame");
// Prevent dragging of the frame above the visible area. To the left is ok though.
if (newY < 0) {newY = 0;}
super.dragFrame(f,newX,newY);
updateDesktopSize(false);
} | 1 |
public String toString() {
if (m_Instances == null) {
return "Naive Bayes (simple): No model built yet.";
}
try {
StringBuffer text = new StringBuffer("Naive Bayes (simple)");
int attIndex;
for (int i = 0; i < m_Instances.numClasses(); i++) {
text.append("\n\nClass " + m_Ins... | 7 |
public void tick() {
up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
space = keys[KeyEvent.VK_SPACE];
hitbox = keys[KeyEvent.VK_H] && keys[Key... | 5 |
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 fe... | 6 |
public Modele getPlateau2() {
return plateau2;
} | 0 |
public Node Get(int index) {
if (index > length - 1) {
System.out.println("out of bounds");
return null;
} else {
Node node = new Node();
node = head;
if (index == 0)
return node;
for (int i = 1; i <= index; i++) {
node = node.getNext();
if (i == index) {
return node;
}
}
... | 4 |
static void openFile (File file){
//Opens the file using ImageJ libraries.
Kappa.imageStack = new ImagePlus(file.getPath());
//Splits the image into the R, G, and B channels, but only if the image is in RGB color
if (Kappa.imageStack.getType() == ImagePlus.COLOR_RGB)
Kappa.imageStackLayers = ChannelSplitter... | 9 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Aplicativo)) {
return false;
}
Aplicativo other = (Aplicativo) object;
if ((this.codaplicativo == null && other... | 5 |
public void toggleFullscreen( int screen, boolean fullscreen )
{
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if( screen > -1 && screen < gs.length )
{
setUndecorated(fullscreen);
... | 5 |
public ArrayListStorage() {
internalStorage = new ArrayList<String>();
} | 0 |
@Override
public void use(Player player, Direction direction) throws InvalidActionException {
if (hasPlayersPositionAnActiveLightGrenade(player))
throw new InvalidActionException("The current location already contains an active LightGrenade!");
useItemOnPlayersPosition(player);
activate();
} | 1 |
public int getPosition() {
return position;
} | 0 |
@Basic
@Column(name = "FUN_CLAVE")
public Integer getFunClave() {
return funClave;
} | 0 |
public void readFile(String fileName) throws IOException, NumberFormatException{
FileInputStream in = new FileInputStream(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
int src,dest,weigh,lc=0;
String line;
String[] strLine;
while(true){
line=br.readLine();
if(line==n... | 7 |
public boolean displayGrid(Grid grid) {
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: displayGrid() BEGIN");
}
getDrawing().setGrid(grid, m_gameControl);
if (test || m_test) {
System.out.println("GameWindow :: displayGrid() END");
}
retur... | 4 |
private void setupMatrix()
{
int cost = -1;
int del, sub, ins;
matrix = new int[compOne.length()+1][compTwo.length()+1];
for (int i = 0; i <= compOne.length(); i++)
{
matrix[i][0] = i;
}
for (int i = 0; i <= compTwo.length(); i++)
{
matrix[0][i] = i;
}
for (int i = 1; i <= compOne.length(); i++)
{
fo... | 9 |
public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... | 6 |
public static int convertObjectToInt(Object value) {
if (value != null) {
if (value instanceof Integer) {
return ((Integer) value).intValue();
} else {
return Integer.valueOf(value.toString()).intValue();
}
} else {
throw new NullPointerException("Property value was null so it couldn't be conver... | 2 |
private static void recoverExplosionEvent(EntityExplodeEvent event) {
final int HealDelay = Main.getInstance().getConfig().getInt("variable.HealDelay");
final int FullHealTime = Main.getInstance().getConfig().getInt("variable.FullHealTime");
final boolean AllowTNTChainReaction = Main.getInstance... | 6 |
public boolean prefixFreeAux(Node node,boolean checked){
boolean check=false;
boolean end=false;
if (node==null) return true;
if (!node.name.isEmpty()) { //Eliminate root node.
check=node.isUsed();
if (check && checked) {
return false; //Non prefix Free.
}
else {
checked=check|check... | 5 |
@Override
public List<Loja> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Loja> lojas = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYNO... | 3 |
private Node getNodeAt(int givenPosition){
Node currentNode=firstNode;
for(int count=1;count<givenPosition;count++){
currentNode=currentNode.getNext();
}
return currentNode;
} | 1 |
private static boolean levenshteinDelOK(String a, String b, int aOffset, int bOffset, int max, int delA, int delB)
{
if (aOffset < 0) return (bOffset - delB <= max - delA);
if (bOffset < 0) return (aOffset - delA <= max - delB);
if (a.charAt(aOffset) == b.charAt(bOffset))
return levenshteinDelOK(a, b, aOffset... | 7 |
private void setPermissions(PermissionAttachment attachment, Map<String, Boolean> permissions) {
try {
Field p = PermissionAttachment.class.getDeclaredField("permissions");
p.setAccessible(true);
@SuppressWarnings("unchecked")
Map<String, Boolean> map = (Map<Strin... | 3 |
public void setCampus(Campus campus) {
if (campus != this.campus) {
Campus vorigeCampus = this.campus;
this.campus = campus;
if (vorigeCampus != null && vorigeCampus.getManager() == this) {
vorigeCampus.setManager(null);
}
if (campus != null && campus.getManager() != this) {
campus.setManager(t... | 5 |
float[][] getCameraVectorsNormal(int resX, int resY){ //returns resX*resY nprmalized camera vectors
float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector
float[] vect2=rotateYVector(dir);
vect2[1]=0;
vect2=normalize(vect2);
float[] ve... | 9 |
@Override
public boolean onKeyDown(int key) {
if(key == Keyboard.KEY_C || key == Keyboard.KEY_ESCAPE) {
Application.get().getHumanView().popScreen();
return true;
}
return true;
} | 2 |
private boolean readFeed()
{
try
{
// Set header values intial to the empty string
String title = "";
String link = "";
// First create a new XMLInputFactory
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
// Setup... | 8 |
@Override
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
switch( keyCode ) {
case KeyEvent.VK_UP:
keyUp = true;
break;
case KeyEvent.VK_DOWN:
keyDown = true;
break;
case KeyEvent.V... | 6 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
public boolean scrubFile() {
try {
this.outputFile = new File(outputFileName);
this.inputReader = new BufferedReader(new FileReader(this.path + inputFileName));
this.outputWritter = new BufferedWriter(new FileWriter(this.path + outputFile));
while (this.inputReader.ready()) {
String sLine = th... | 9 |
private int getMinIndex() {
int minIdx = 0;
for (int i = 0; i < size(); i++) {
if (comparator.compare(queue.get(i).getKey(), queue.get(minIdx)
.getKey()) < 0) {
minIdx = i;
}
}
return minIdx;
} | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Author other = (Author) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fa... | 6 |
void recursiveSort(boolean sortLeaves) {
if (isLeaf && !sortLeaves)
return;
boolean change = false;
// Use modified bubble sort for almost-sorted lists.
do {
change = false;
for (int i = 0; i < contents.size() - 1; i++)
change |= swap(i);
if (!change)
break;
change = false;
for (int i ... | 8 |
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.