text stringlengths 14 410k | label int32 0 9 |
|---|---|
void solve() {
for (int i = 0; i < numberOfPoints; i++) { // zeros wavefunction
phi[i] = 0;
}
for (int i = 0; i < numberOfPoints; i++) {
phi[i] = state[0]; // stores wavefunction
x[i] = state[2];
solver.step(); // steps Schroedinger equation
if (Math.abs(state[0]) > stepThresh... | 8 |
private String packListIntoString () {
StringBuilder list = new StringBuilder();
int index = 0;
for (String name : myPPClientList.keySet()) {
list.append(myPPClientList.get(name) + ":" + name);
if (index != myPPClientList.size() - 1) {
list.append(';');
... | 2 |
public void reorderList(ListNode head) {
if (head == null || head.next == null) {
return;
}
ListNode tail = head.next;
ListNode mid = head;
while (tail != null && tail.next != null) {
mid = mid.next;
tail = tail.next.next;
}
tail = mid.next;
mid.next = null; // split list to two parts
tail = ... | 7 |
public void tellOps(String string)
{
Collection<? extends Player> tmp = getServer().getOnlinePlayers();
Player[] players = tmp.toArray(new Player[tmp.size()]);
for(int a = 0; a < players.length; a++)
{
if(players[a].isOp()) players[a].sendMessage(string);
}
} | 3 |
@SuppressWarnings("unchecked")
public float read(float[] leftBuf, float[] rightBuf, int readRate)
{
if (buf.length != leftBuf.length) buf = new float[leftBuf.length];
if (sounds.size() > maxChannels)
{
Collections.sort(sounds);
}
Arrays.fill(leftBuf, 0);
... | 9 |
public String Prom ()
{
double acumA=0, acumB=0;
double promA=0, promB=0;
for (int i = 0; i < CursoA.length; i++) {
acumA+=CursoA[i];
}
for (int i = 0; i < CursoB.length; i++) {
acumB+=CursoB[i];
}
promA=acumA/5;
promB=acumB/5;
... | 3 |
private boolean doSaveBeforeOpenOrNew(){
LogoDocument program = getProgram();
if (program.isDirty()){
int option = JOptionPane.showConfirmDialog(this, "Hay cosas sin guardar, desea guardar ahora?", "Atencion", JOptionPane.YES_NO_CANCEL_OPTION);
if (option == JOptionPane.CANCEL_OPTION){
return false;
}... | 3 |
public void register(IncomingConnectionListener listener) {
this.listeners.add(listener);
} | 0 |
public void run() {
count = 0;
ok = true;
int d = new Random().nextInt(10000);
while (proxy.isRunning()) {
try {
if (proxy.isConnected())
sleep(20000 + d);
else
sleep(2000);
count++;
ok = false;
sentTime = System.currentTimeMillis();
if (proxy.isConnected()) {
prox... | 6 |
public static List loadNeuralNetworkFile(String file) {
{ List nets = List.newList();
InputFileStream stream = InputFileStream.newInputFileStream(file);
int numHidden = 0;
Cons prop = Stella.NIL;
Stella_Object temp = null;
int numIn = 0;
PropositionNeuralNetwork net = null;
... | 6 |
public static int substringsCount(String string, String pattern) {
if(string == null || pattern == null)
return -1;
char[] str = string.toCharArray();
char[] pat = pattern.toCharArray();
int startIndex = 0;
int lastIndex = 0;
int count = 0;
while(lastIndex < str.length) {
if(lastIndex - startI... | 6 |
public final FEMDatetime moveZone(final int hours, final int minutes) throws IllegalStateException, IllegalArgumentException {
if (!this.hasZone()) throw new IllegalStateException();
if ((hours == 0) && (minutes == 0)) return this;
if ((hours < -28) || (hours > 28)) throw new IllegalArgumentException();
if ((mi... | 7 |
public void showStatus(int step, Field field) {
if (!isVisible()) {
setVisible(true);
}
stepLabel.setText(STEP_PREFIX + step);
stats.reset();
fieldView.preparePaint();
for (int row = 0; row < field.getDepth(); row++) {
for (int col = 0; col < fi... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
setBackground(isSelected ? SystemColor.textHighlight : Color.white);
setForeground(isSelected ? SystemColor.textHighlightText : Color.black);
if (value instanceof PageMolecularViewer... | 7 |
public int ladderLength(String start, String end, HashSet<String> dict) {
// Start typing your Java solution below
// DO NOT write main() function\
//mlgb, zhen bu rong yi....
LinkedList<String> queue = new LinkedList<String>();
queue.add(start);
String lastFirst = start;
int ret = 1;
if(dict.contains(s... | 9 |
@SuppressWarnings("static-access")
public void handle(CommandLine parser) {
//Handle listing files
if (parser.hasOption("ls")) {
final File jenHome = new File(options.jenHome);
if (jenHome.listFiles().length == 0) {
log.info("No jen environments found.");
return;
}
for (File f : jenHome.listFi... | 9 |
public void goCompare() {
try {
HashMap<String, ArrayList> tableInfoOne = appState.getDbOperationManagerOne().getTableInfo(tComparatorOne.getSelectedTable());
HashMap<String, ArrayList> tableInfoTwo = appState.getDbOperationManagerTwo().getTableInfo(tComparatorTwo.getSelectedTable());
if(compare... | 6 |
@Override
public void run() {
try {
MulticastSocket socket = new MulticastSocket(4446);
InetAddress address = InetAddress.getByName("230.0.0.1");
socket.joinGroup(address);
DatagramPacket packet;
byte[] buf = new byte[256];
packet = n... | 1 |
public static void main(String[] args) {
PerformChecker.check(new Logic() {
@Override
public void doIt() {
// 計測対象の処理
for (int i = 0; i < 100; i++) {
System.out.println("hello");
}
}
});
// checkTime();
} | 1 |
private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed
// TODO add your handling code here:
if(jPanelRadio.isVisible()){
jPanelRadio.setVisible(false);
jPanelList.setVisible(true);
if(jRadioButtonImport.is... | 9 |
public void delete(int arvo) {
AvlSolmu solmu = etsiArvo(juuri, arvo);
if (solmu != null) {
AvlSolmu vanhempi = solmu.getParent();
if ((solmu.getLeft() == null) && (solmu.getRight() == null)) {
poistaSolmuJollaEiLapsia(vanhempi, solmu);
} else if ... | 5 |
protected void addHeader()
{
String theHeader = "";
if (HumboldtJS.preInitFile != "") {
File inFile = getFile(HumboldtJS.preInitFile);
if (inFile == null) {
HumboldtJS.showError("Cannot find file: " + HumboldtJS.preInitFile);
}
byte[] buffer = loadFile(inFile, HumboldtJS.preInitFile);
theHe... | 9 |
public void add(int id, String title, String author, float price, int quantityOrdered) {
// Check if the id is already in the shopping cart
Iterator<CartItem> iter = cart.iterator();
while (iter.hasNext()) {
CartItem item = iter.next();
if (item.getId() == id) {
// id fou... | 2 |
static private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpo... | 9 |
private Token isReservedWord(Token token) {
Token tok = token;
for (ReservedWord rw : ReservedWord.values()) {
//Si encontramos que en el enum ReservedWord existe el lexema que estoy comparando, entonces devuelvo el TokenType que tiene asociado en ese enum.
//de lo contrario devu... | 2 |
public void paint(Graphics g, int offsetX, int offsetY) {
if (hit) {
if (hitFrameCounter % HIT_FLICKER > HIT_FLICKER / 2) {
super.paint(g, offsetX, offsetY);
}
hitFrameCounter++;
if (hitFrameCounter == HIT_FRAMES) {
hit = false;
}
}
else {
super.paint(g, offsetX, offsetY);
}
// Pi... | 5 |
private static Employee EmployeeObject(ResultSet rs) {
Employee newEmployee = null;
try {
newEmployee = new Employee(rs.getInt(rs.getMetaData().getColumnName(1)),
rs.getString(rs.getMetaData().getColumnName(2)),
r... | 1 |
public static SIIS deSerializeFile(File filename) {
try {
FileInputStream file = new FileInputStream(filename);
ObjectInputStream o = new ObjectInputStream(file);
SIIS tmp = (SIIS) o.readObject();
o.close();
return tmp;
} catch (IOException e) {
System.err.println(e);
} catch (ClassNotFoundExcep... | 2 |
public Status getIntake() throws MenuException {
String command;
Scanner input = new Scanner(System.in);
this.display();
command = input.nextLine();
command = command.trim().toUpperCase();
switch (command) {
case "E":
System.out.println("Th... | 2 |
public void setCartregesReamaining(int cartregesReamaining) {
this.cartregesReamaining = cartregesReamaining;
if (isOutOfAmo() && cartregesReamaining > 0) {
setOutOfAmo(false);
reload();
}
} | 2 |
private static void insertionSort(int[] arr) {
if(arr.length < 2) return;
int firstUnsortedNum;
//索引i之前的全部是已排好序的数组元素
for(int i=1; i<arr.length; i++){
firstUnsortedNum = arr[i];
//截取字数组
int[] sortedArr = new int[i];
for(int m=0; m<i; m++){
sortedArr[m] = arr[m];
}
//用二分搜索找到arr[i]... | 4 |
private void AplicarjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AplicarjButtonActionPerformed
int option = 0;
if (comparacion(piloto1, piloto1Num, pilot1)) {
option = 1;
}
if (metodo == 2) {
if (comparacion(piloto2, piloto2Num, pilot2... | 5 |
public Firewall[] getFirewalls() {
return firewalls;
} | 0 |
public static List<Image> getGalleryContents(String galleryName) {
List<Image> images = new ArrayList<Image>();
NodeList nList = getNodeList();
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
... | 4 |
private void percolateDown(int hole){
int child;
AnyType tmp = this.array[hole];
for( ; hole*2 <= this.currentSize; hole = child){
child = hole*2;
if(child != this.currentSize && compare(this.array[child+1], this.array[child])< 0)
child++;
if(compare(this.array[child],tmp)<0)
this.array[hole] = ... | 4 |
public List<Gaest> getGaester()
{
Gaest gl = null;
String SQLString =
" select * from GAEST_TBL";
PreparedStatement statement = null;
List<Gaest> gaesteListe = new ArrayList<>();
try
{
statement = con.prepareStatement(SQLString);
... | 4 |
@Override
public void keyPressed(int k) {
switch(k){
case KeyEvent.VK_ENTER:
select();
break;
case KeyEvent.VK_UP:
currentChoice--;
if (currentChoice == -1){
currentChoice = options.length - 1;
}
break;
case KeyEvent.VK_DOWN:
currentChoice++;
if (currentChoice == options.length){
... | 5 |
private Color blockTypeColor(BlockType blockType) {
switch (blockType) {
case I: return Color.CYAN;
case J: return Color.BLUE;
case L: return Color.ORANGE;
case O: return Color.YELLOW;
case S: return Color.GREEN;
case T: return PURPLE_COLOR... | 7 |
protected void setupPowersButtons() {
final Quickbar bar = this ;
final UIGroup powerGroup = new UIGroup(UI) ;
final List <Button> powerSlots = new List <Button> () ;
for (final Power power : Power.BASIC_POWERS) {
final Button button = new Button(
UI, power.buttonTex, Button.IC... | 4 |
private void setText(String text) {
try {
// remove all text and insert the completed string
super.remove(0, getLength());
super.insertString(0, text, null);
} catch (BadLocationException e) {
throw new RuntimeException(e.toString());
}
} | 1 |
public ArrayList<DamagePackage> getDamagePacks() {
ArrayList<DamagePackage> packages = new ArrayList<DamagePackage>();
DamagePackage base = new DamagePackage(base_damage, AttackType.typeConversion(attackType));
packages.add(base);
for (int c = 0; c < passiveEnchants.size(); c++) {
... | 1 |
public synchronized void executeNextTask() {
// System.out.println("HIT");
if (this.m_TaskQueue.size() > 0) {
for (int i = 0; i < this.m_Threads.size(); i++) {
DCThread thread = this.m_Threads.get(i);
// System.out.println("Got thread: " + thread.getThreadId());
if (thread.getThreadState() == THREAD... | 5 |
protected boolean checkMessage(HttpServletRequest req, HttpServletResponse resp,
boolean response) throws IOException {
final String signature = req.getParameter("signature");
final String timestamp = req.getParameter("timestamp");
final String nonce = req.getParameter("nonce");
final String echostr = req.ge... | 8 |
public ModelExploiter(){
boolean accept = false;
while (!accept){
ModelExplorer PE = new ModelExplorer();
PE.train();
rl = PE.getRL();
Player[] players = new Player[]{
new PlayerComputer(this),
new PlayerComputer(new ModelRandom())
};
Game g = Game.create(players, 5, 1, false);
int pla... | 6 |
private static boolean isPowerOf(double power_value, double user_value, int range) {
double[] powersList = new double[range];
for(int i = 0; i < range; i++) {
// generate powers of list
powersList[i] = Math.pow(power_value, new Double(i));
// if the users value is... | 2 |
public String makeURL(boolean weather, String ownloaction) {
String URL="https://www.google.co.in/search?q=";
//only for weather for perticular location
if(weather==true && ownloaction!=null){
URL+="current+temp+"+ownloaction;
}
//only for current location
if(weather==false && ownloaction==null){
URL+="cu... | 6 |
private void sendMsg(String msg) {
if(socket != null && socket.isConnected()) {
try {
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
if (!msg.endsWith("\n"))
msg += "\n";
out.writeBytes(msg);
... | 4 |
protected void onTime(String sourceNick, String sourceLogin, String sourceHostname, String target) {
this.sendRawLine("NOTICE " + sourceNick + " :\u0001TIME " + new Date().toString() + "\u0001");
} | 0 |
public String addPlayer(Player p ){
String Team = null;
if(blau.size()!= 4){
blau.add(p);
Team = "Blau";
}
if(rot.size()!= 4){
rot.add(p);
Team = "Rot";
}
if(grün.size()!= 4){
grün.add(p);
Team = "Grün";
}
if(gelb.size()!= 4){
gelb.add(p);
Team = "Gelb";
}
return Team;
} | 4 |
@Test(timeout = 1000)
public void testConcurrentReaderPiping() throws Exception {
final int charCount = 30;
final char[] vals = "123456789".toCharArray();
final int n = vals.length;
Reader[] readers = new Reader[n];
// Generate n readers with charCount equal elements in them.... | 8 |
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
name = request.getParame... | 2 |
private void initPanel(){
int scale = 10;
JPanel p = new JPanel();
p.setLayout(null);
//Outstanding Borrowing
JLabel label0 = new JLabel("Outstanding Borrowing: ");
label0.setBounds(scale, 0, WIDTH/3, HEIGHT/scale);
label0.setHorizontalAlignment(SwingConstants.LEFT);
label0.setVerticalAlignment(Swin... | 4 |
public boolean accept(File f) {
if(f != null) {
if(f.isDirectory()) {
return true;
}
String extension = getExtension(f);
if(extension != null && filters.get(getExtension(f)) != null) {
return true;
};
}
return false;
} | 4 |
public static boolean wrapperP(Stella_Object x) {
if (Stella.$CLASS_HIERARCHY_BOOTEDp$) {
return ((x != null) &&
Stella_Object.isaP(x, Stella.SGT_STELLA_WRAPPER));
}
return (Stella_Object.booleanP(x) ||
(Stella_Object.integerP(x) ||
(Stella_Object.longIntegerP(x) ||
... | 8 |
@Override
public void callback(DiscreteEventSimulator DES) throws SimulatorException {
boolean isNative = context.getContextID() == target.getCoreID();
if (isNative){
Context oldContext = target.switchNativeContext(context);
context.endStall();
// give predictor feedback
switch (type){
case C... | 8 |
public String getFossil() {
return this.fossil;
} | 0 |
void labelClicked(final int xCoordinate, final int yCoordinate) {
//открываем эту новую область
boolean[][] currentBricks = state.getBricks();
currentBricks[xCoordinate][yCoordinate] = false;
state.setBricks(currentBricks);
state.setResultFromButton(false);
//уменьшаем сч... | 1 |
public void setZAxisDeadZone(float zone) {
setDeadZone(zaxis,zone);
} | 0 |
public boolean mySolveSudoku(char[][] board,int row, int column) {
if(!isValidBox(board,row,column))
return false;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 9; j++) {
if (board[i][j] == '.'){
for (int k = 1; k < 10; k++){
... | 6 |
public static boolean isValidLocalLink(String value) {
// Allow links to files stored in the jar.
if (value.startsWith("static_files/")) {
value = value.substring("static_files/".length());
}
for (int index = 0; index < value.length(); index++) {
char c = value.... | 9 |
static final public Engine program() throws ParseException {
Engine engine = new Engine(); ActorType at; CreateActorStatement createStmt; SendMessageStatement sendStmt;
label_1:
while (true) {
at = actor_type();
engine.addActorType(at);
if (jj_2_1(4)) {
... | 7 |
@Test
public void addingVerticesWorks() {
g.addVertex(v);
DynamicArray a = g.getVertices();
assertTrue(a.contains(v));
} | 0 |
public SignatureVisitor visitParameterType() {
endFormals();
if (!hasParameters) {
hasParameters = true;
buf.append('(');
}
return this;
} | 1 |
public String getValue(String name)
throws Exception
{
if (this.prop == null)
{
InputStream propIs = null;
try
{
propIs = Thread.currentThread().getContextClassLoader().getResourceAsStream(propPath);
this.prop = new Properties();
this.prop.load(propIs);
}
catch (Exception e)
{
... | 2 |
public static String[] splitAndMaskWordsAroundNotLeavePunctuation(String text) {
String[] words = text.split("\\s+");
//ignore words around "not" (next to, or one word away) -
//G.H. (this can be much more efficient with a regex)
for (int i=0; i<words.length; i++) {
if (words[i... | 6 |
private static void displayTables() // tester function
{
for (int i = 0; i < DiningRoom.size(); i++) {
Table thisTable = new Table((Table) DiningRoom.get(i));
Vector thisTab = thisTable.getIDList();
System.out.println("Table has " + thisTab.size() + " people.");
for (int j = 0; j < thisTab.size(); j++) {... | 2 |
public GedcomObjectFactory findFactoryForTag(String tag) {
if (tag.equalsIgnoreCase("SOUR"))
return sourceFactory;
else if (tag.equalsIgnoreCase("NOTE"))
return noteFactory;
else if (tag.equalsIgnoreCase("NAME"))
return nameFactory;
GedcomObjectFactory factory = eventHash.get(tag);
if (factory != ... | 5 |
public void printTranslation(String foundWords, String englishOrBliss)
{
//if notFoundQueue is empty
if(notFoundQueue.checkQueueEmpty()==true)
{
System.out.print(foundWords +" translated to "+ englishOrBliss +" is: ");
while(myQueue.checkQueueEmpty() != true)
... | 6 |
public static void main(String[] args) throws Exception {
System.setSecurityManager(null);
// Script file
String scriptFile = (args.length < 1) ? "trips" : args[0];
// Registry host
String host = (args.length < 1) ? null : args[1];
Registry registry = LocateRegistry.getRegistry(host);
// Lookup agency
... | 4 |
public void FillCircle(int X, int Y, int R)
{
// long time = System.nanoTime();
for (int i1 = Math.max(X-(R+1),0); i1 < Math.min(X+(R+1),w); i1 ++)
{
for (int i2 = Math.max(Y-(R+1),0); i2 < Math.min(Y+(R+1),h); i2 ++)
{
if (M... | 5 |
public static UserAgent parseUserAgentString(String userAgentString) {
return new UserAgent(userAgentString);
} | 0 |
private static int partition(int left, int right) {
int pivot = array[right];
int i = left;
int j = right - 1;
do{
while(array[i] <= pivot && i < right)
i++;
while(array[j] >= pivot && j > left)
j--;
... | 7 |
private int extractIntFromStart (int pos) {
int v=0;
if (startBuffer[pos]==true) v=64;
if (startBuffer[pos+1]==true) v=v+32;
if (startBuffer[pos+2]==true) v=v+16;
if (startBuffer[pos+3]==true) v=v+8;
if (startBuffer[pos+4]==true) v=v+4;
if (startBuffer[pos+5]==true) v=v+2;
if (startBuffer[pos+6]==true) ... | 7 |
public static Image createCircleImage(int height, int width) {
Image binaryImage = new RgbImage(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
double aTerm = Math.pow(x - width / 2, 2);
double bTerm = Math.pow(y - height / 2, 2);
double rTerm = Math.pow(height / ... | 3 |
public static ArrayList<String> FetchjobsFromJobPortal(String urlForJob)
{
WebDriver driver1 = new FirefoxDriver();
// Code for pagination
driver1.get(urlForJob);
ArrayList<String> listOfJobs = new ArrayList<String>();
//WebElement ulOfPagination = divForJobs.findElement(By... | 7 |
public boolean isMainHeroDead()
{
if (mainHero == null) return false;
return getPlayer(playerColor()).getDeadHeroes().contains(mainHero);
} | 1 |
public void rotate180(Board board) {
Point[] newRel = new Point[3];
for (int i = 0; i < rel.length; i++) {
newRel[i] = new Point(-rel[i].getX(), -rel[i].getY());
}
if (rotateAlgorithm(board, base, newRel, getKicks()[(rotation+1)%4])) {
addRotation(2);
}
} | 2 |
private void kingBottomPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 0 && y1 >= 1) && (x1 < maxWidth && y1 < maxHeight))
{
if(board.getChessBoardSquare(x1, y1-1).getPiece().getPieceType() != board.getBlankPiece().getPieceType(... | 6 |
public int hashCode()
{
return super.hashCode() ^ getLabel().hashCode() ^ getOutput().hashCode();
} | 0 |
public static <A, O extends A> A[] addObjectToArray(A[] array, O obj) {
Class<?> compType = Object.class;
if (array != null) {
compType = array.getClass().getComponentType();
} else if (obj != null) {
compType = obj.getClass();
}
int newArrLength = (array != null ? array.length + 1 : 1);
@SuppressWarn... | 5 |
public static SpriteID getSpriteID1(EntityType type) {
switch (type) {
case OBJ_TREE:
return EnviroSprite.tree_green_1;
case OBJ_DOOR_WOOD:
return EnviroSprite.door_wooden_closed;
case ENTR_DUNGEON:
return EnviroSprite.stone_ha... | 3 |
public void startGame(Player p, String team1, String team2){
try{
greenTeam = Team.valueOf(team1.toUpperCase());
}catch(Exception e){
p.sendMessage(ChatColor.RED + team1 + " is not a valid team name!");
return;
}
try{
blueTeam = Team.valueOf(team2.toUpperCase());
}catch(Exception e){
p.sendMess... | 8 |
public synchronized void zoomIn(float zoomPercent) {
if (zoomScale >= zoomScaleMax)
return;
float xmin = xAxis.getMin();
float xmax = xAxis.getMax();
float ymin = yAxis.getMin();
float ymax = yAxis.getMax();
float dx = xmax - xmin;
float num = dx / (xAxis.getMajorTic());
if (dx / num * zoomPercent... | 9 |
public static double calculateCentralitySum(double average,
ArrayList<Double> averageRatings, ArrayList<Double> ratings,
ArrayList<Double> similarities, ArrayList<Double> centralityScores) {
double denominator = 0, numerator = 0;
for (int i = 0; i < ratings.size(); i++) {
if (similarities.get(i) > 0 && c... | 4 |
public double getCollisionForceDirection(Point collisionpoint)
{
// Circles simply push the object away
if (this.collisiontype == CollisionType.CIRCLE)
return HelpMath.pointDirection(getX(), getY(),
collisionpoint.x, collisionpoint.y);
// Walls simply push the object to the right (relative)
else if (t... | 6 |
void readCdsFileFasta() {
// Load file
FastaFileIterator ffi = new FastaFileIterator(cdsFile);
for (String seq : ffi) {
String trId = ffi.getName();
// Repeated transcript Id? => Check that CDS is the same
if ((cdsByTrId.get(trId) != null) && (!cdsByTrId.get(trId).equals(seq))) System.err.println("ERRO... | 3 |
public final void setOwner(ChunkyObject object, Boolean keepChildren, boolean clearPermissions) {
if (owner != null) {
if (keepChildren)
owner.removeOwnable(this);
else
owner.removeOwnableAndTakeChildren(this);
}
else if(!keepChildren) {
... | 6 |
public String[] preprocess(String sourceCode) throws BadLabelFormatError {
String[] lines = sourceCode.split("\\n");
//ArrayList<String> newLines = new ArrayList(lines.length);
Console.log("Preprocessing...", "info");
labelTable = new Hashtable<String, Short>(20);
short memoryPoi... | 9 |
public Chance( double p ) {
this.probability = p;
} | 0 |
private void ProcurarEscola_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ProcurarEscola_ButtonActionPerformed
// TODO add your handling code here:
Escola escola = a.getEscola(Escola_ComboBox2.getSelectedItem().toString());
if (escola != null) {
EscolaSelec... | 3 |
public static void addTaskToAgenda(String task,int startTime,int duration){
JTextArea agendaContent = new JTextArea(task);
agendaContent.setWrapStyleWord(true);
agendaContent.setLineWrap(true);
agendaContent.setEditable(false);
Border border = BorderFactory.createEmptyBorder();
agendaContent.setBorder(Borde... | 7 |
public static boolean isDependentOn(String v1, String v2, Grammar grammar) {
GrammarChecker gc = new GrammarChecker();
ProductionChecker pc = new ProductionChecker();
Production[] productions = GrammarChecker.getProductionsOnVariable(v1,
grammar);
for (int k = 0; k < productions.length; k++) {
if (Produc... | 2 |
public synchronized Object lockExclusive() throws IOException {
while (myLock != null) {
try {
wait();
} catch (InterruptedException ex) {
throw new IOException(ex);
}
}
myLock = getLockingObject();
return myLock;
} | 2 |
private boolean isHovering(MouseEvent e) {
Rectangle quad = new Rectangle(quadHndl.x + (int)quadXPos - 1, quadHndl.y + (int)quadYPos - 1, quadHndl.width+2, quadHndl.height+2);
Rectangle quadEnd = new Rectangle(quadEndHndl.x + (int)quadXPos - 1, quadEndHndl.y + (int)quadYPos - 1, quadEndHndl.width+2, quadEndHndl.heigh... | 4 |
private void filter() {
if(model != null) {
if(jCheckBoxCrossPrice.isSelected() && jCheckBoxNFPrice.isSelected()) {
sorter.setRowFilter(null);
} else if(jCheckBoxCrossPrice.isSelected() && !jCheckBoxNFPrice.isSelected()) {
sorter.setRowFilter(R... | 7 |
public void worldBroadcast(String message, String world)
{
for (Player p : server.players)
{
if(p.world == world)
p.sendMessage(message);
}
} | 2 |
@Test
public void selectATargetLocation()
{
// Will go In room
ComputerPlayer player = new ComputerPlayer();
player.setLastVisited('Z');
Board board = game.getBoard();
board.calcTargets(4, 5, 2);
int loc_4_3 = 0;
int total = 120;
for(int i = 0; i < total; i++)
{
BoardCell selected = player.pic... | 9 |
public static void useRod(Item item)
{
if (!hasItem(item))
{
errorWindow.addMessage(" You don't have this item in your inventory to use! ");
errorWindow.toFront();
return;
}
if(JokemonDriver.canFish())
{
inventoryWindow.closeInventory();
JokemonDriver.fishing=true;
JokemonDriver.performing... | 2 |
public void ComputeBigWindowStatisticByToeflDataSet() throws IOException{
int correctAnswers = 0;
File testFile = new File("toefl.tst");
BufferedReader testReader = new BufferedReader(new FileReader(testFile));
String rdline;
int LineNo = 0;
String[] question = new String[6];
while ((rdline = te... | 9 |
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.