text stringlengths 14 410k | label int32 0 9 |
|---|---|
void finishDocument() throws IOException {
if (doVectors == false) {
return;
}
doVectors = false;
final int numPostings = bytesHash.size();
final BytesRef flushTerm = termsWriter.flushTerm;
assert numPostings >= 0;
// This is called once, after inverting all occurrences
// of ... | 8 |
public void run(){
while (!m_isAborted){
boolean currentAction = m_isRising;
checkSwitches();
if(currentAction != m_isRising){
double speed = 0;
if(m_isRising){
speed = 1;
}els... | 3 |
public SQLite(Logger log, String prefix, String name, String location) {
super(log, prefix, "[SQLite] ");
this.name = name;
this.location = location;
File folder = new File(this.location);
if (this.name.contains("/") || this.name.contains("\\") || this.name.endsWith(".db")) {
this.writeError("The database ... | 4 |
public final void makeroom(int nbefore, int nafter) {
if (value != null) {
LuaString s = value.strvalue();
value = null;
length = s.m_length;
offset = nbefore;
bytes = new byte[nbefore + length + nafter];
System.arraycopy(s.m_bytes, s.m_offset, bytes, offset, length);
} else if (offset + length + ... | 6 |
public static XmlGlobalAttribute makeXmlGlobalAttributeInternal(String name, String namespaceName, String namespaceUri, String surfaceForm) {
if ((namespaceUri == null) ||
((namespaceName == null) ||
(Stella.stringEqlP(namespaceUri, "") ||
Stella.stringEqlP(namespaceName, "")))) {
t... | 6 |
private int findNearestPair(double key, double secondaryKey) {
int low = 0;
int high = m_CondValues.size();
int middle = 0;
while (low < high) {
middle = (low + high) / 2;
double current = ((Double)m_CondValues.elementAt(middle)).doubleValue();
if (current == key) {
double secon... | 7 |
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 |
private void calculeRoof(){
boolean matrixAuxiliar[][] = new boolean[matrix_height][matrix_width];
int auxLen;
for(int row = 0; row < matrix_height; row++){
for(int col = 0; col < matrix_width; col++){
if(!matrixAuxiliar[row][col] && matrix[row][col]==1){
... | 7 |
public int haeVuodentilaukset (int vuosi) throws DAOPoikkeus {
TilastointiDAO tilasto = new TilastointiDAO();
HashMap<Integer, Tilastointi> tilaustenlkm = tilasto.haeTilaukset(vuosi);
int vuodentilaukset = 0;
for (int i = 1; i < 13; i++) {
Tilastointi tilauksia = tilaustenlkm.get(i);
... | 1 |
public static int strdtoi(String decimal)
{
/*
* The basic set up for the next three methods is to basically check the value at a given index
* convert that character to its ASCII representation and subtract the appropriate value so that
* it matches correctly. When going through again, the sum is multipli... | 1 |
private void added (DeviceImpl dev)
{
// call synch'd on devices
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
listener = (USBListener) listeners.elementAt (i);
try {
listener.deviceAdded (dev);
} catch (Excepti... | 3 |
void drawVLine(int argb, boolean tScreened, int x, int y, int z, int h) {
// hover, labels only
int width = g3d.width;
int height = g3d.height;
if (h < 0) {
y += h;
h = -h;
}
int[] pbuf = g3d.pbuf;
int[] zbuf = g3d.zbuf;
if (y < 0) {
h += y;
y = 0;
}
if (y... | 9 |
public static void main(String[] args) {
TargetDataLine line = null;
Mixer mixer = null;
final AudioBuffer buffer = new AudioBuffer();
PeakListener peakListener = new PeakListener(buffer, 300,500);
//buffer.activateLowPassFilter(100);
//peakListener.addPeakHandler(new LetterDetector("letterData.txt", 1));
... | 8 |
public void addListener() {
itemtf[4].addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent arg0) {
if (!itemtf[4].getText().equals("")) {
String name = logic.showTeacherName(itemtf[4].getText());
itemtf[5].setText(name);
}
}
@Override
public void focusGai... | 5 |
private static String convertToneNumber2ToneMark(final String pinyinStr) {
String lowerCasePinyinStr = pinyinStr.toLowerCase();
if (lowerCasePinyinStr.matches("[a-z]*[1-5]?")) {
final char defautlCharValue = '$';
final int defautlIndexValue = -1;
char unmarkedVowel = defautlCharValue;
... | 9 |
public boolean release(long id) {
if(weaponID == id) {
weaponID = NO_WEAPON;
return true;
}
return false;
} | 1 |
private static int getServerCertificateFailures(X509Certificate cert, String realHostName) {
int mask = 8;
Date time = new Date(System.currentTimeMillis());
if (time.before(cert.getNotBefore())) {
mask |= 1;
}
if (time.after(cert.getNotAfter())) {
mask |= 2;
}
... | 7 |
public String getSeatType() {
return this._seatType;
} | 0 |
public void addOutgoingEdge(Edge out) throws MaltChainedException {
super.addOutgoingEdge(out);
if (out.getTarget() != null) {
if (out.getType() == Edge.DEPENDENCY_EDGE && out.getTarget() instanceof DependencyNode) {
Node dependent = out.getTarget();
if (compareTo(dependent) > 0) {
leftDependents.ad... | 7 |
private void locationClicked()
{
World<T> world = parentFrame.getWorld();
Location loc = display.getCurrentLocation();
if (loc != null && !world.locationClicked(loc))
editLocation();
parentFrame.repaint();
} | 2 |
public static void manageProfessors() {
System.out.print("Do you want to add (0) or delete (1) a professor ? ");
int res = -1;
while (res < 0 || res > 1) {
Scanner sc = new Scanner(System.in);
res = sc.nextInt();
}
switch (res) {
case 0:
createProfessor();
break;
case 1:
if (FileRead.pr... | 6 |
protected void process(int att, int pos, BitSet C, double[][] D, double[][] minGen)
{
if (C.cardinality() < minSup) return;
if (!addCandidate(minGen, C)) return;
if (Main.printResult)
{
System.out.print(" Closed " + toStringPattern(D) +" ; ");
System.out.println("Generator " +toStringPattern(minG... | 9 |
public void changeSelection() {
drawer.clearSelected();
Configuration[] configs;
configs = configurations.getConfigurations();
boolean foundFocused = false;
for (int i = 0; i < configs.length; i++) {
Configuration current = configs[i];
foundFocused = setFocusIfNeeded(current, foundFocused);
... | 3 |
@Test
public final void testRemoveSeveral() {
for (int j = 1; j <= 10; j++) {
for (int i = 1; i <= 1000; i++) {
s.add(i);
}
}
// remove 10 elements 10 times
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= 10; j++) {
s.remove(j * 10);
}
}
assertEquals("Wrong size():", 990, s.size())... | 4 |
public static void main(final String[] args) {
// int n = 200;
// double pi = f(n, 6) + f(n, 75) + f(n, 89) + f(n, 226);
// System.out.println(f(n, 6) + f(n, 75) + f(n, 89) + f(n, 226)); // pi
int max = 1;
int n = 10000;
for(int a = 0; a < max; a++) {
for(int b = 0; b < max; b++) {
for(int c = 0; ... | 5 |
public byte evaluate_byte(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return 0;
}; | 1 |
public String processArgs(String[] args) throws Exception {
int i = 0, j;
String arg;
char flag;
boolean vflag = false;
String outputfile = "";
String readFromFile = null;
try {
while (i < args.length && args[i].startsWith("-")) {
arg = args[i++];
if (arg.equals("-verbo... | 8 |
public List<Argument> getArguments(boolean ordered) {
List<Argument> results = new ArrayList<Argument>();
Set<Resource> classes = JenaUtil.getAllSuperClasses(this);
classes.add(this);
for(Resource cls : classes) {
StmtIterator it = cls.listProperties(SPIN.constraint);
while(it.hasNext()) {
Statement s... | 7 |
public String getColumnName( int column)
{
String nom="";
switch (column) {
case 0:
nom="ID";
break;
case 1:
nom="Descripcion";
break;
case 2:
nom="Color";
break;
case 3:
nom="Peso";
break;
case 4:
nom="Consumo";
break;
case 5:
nom="Costo";
break;
case 6:
nom="C... | 9 |
public int getYSquares() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: getYSquares() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: getYSquares() END");
}
return Y_SQUARES;
} | 4 |
public void remove(Object removed, int type){
Drop drop = null;
if(type == 1){
for(int n = 0; n < managers.size(); n++){
if(managers.get(n).getDrop().getPath().equals((String) removed)){
drop = managers.get(n).getDrop();
ports.remove((Integer) Integer.parseInt(managers.get(n).getDrop().get... | 6 |
public void paint(Graphics g)
{
g.setColor(color);
for(int i = 0; i < currentSquares; i++)
{
g.fillRect(i * (squareWidth + padding), 0, squareWidth, height);
}
} | 1 |
@Test
public void testClearEdges()
{
final DCRGraph graph = new DCRGraph();
final OrdinaryCluster parent = new OrdinaryCluster(graph, 1.0);
parent.setGroundTruthIndex(0);
final ClusterAdjacencyList list = new ClusterAdjacencyList(parent);
final Node[] nodes = { new Node(), new Node(), new Node(), new Node(... | 5 |
private Map<String, Set<JarFile>> buildMapOfExportsToJars() {
String classPath = System.getProperty("java.class.path");
String pathSeparator = System.getProperty("path.separator");
Map<String, Set<JarFile>> exportsToJars = new HashMap<String, Set<JarFile>>();
String[] classPaths = clas... | 7 |
public void testResizeWithPurgeAndGetOfNonExistingElement() {
Table<Integer> table=new Table<>(3, 10, 0);
for(int i=1; i <= 50; i++)
addAndGet(table, i);
System.out.println("table: " + table);
assertIndices(table, 0, 0, 50);
assert table.size() == 50 && table.getNumMi... | 9 |
public static long getVideoDurationInSeconds(File video) {
IContainer container = null;
try {
container = IContainer.make();
if (container.open(video.getAbsolutePath(), IContainer.Type.READ, null) < 0) {
throw new IllegalArgumentException("Could not open file: " + video.toString());
}
return contain... | 2 |
public static long toAmount(String price)
{
if(price.charAt(0) == '$')
price = price.substring(1);
index = price.indexOf(".");
if(index == -1)
price = price + "00";
else if(index == price.length()-1)
price = price.substring(0,price.length()-1) + "00";
else if(index == 0 && price.length() == 2)... | 8 |
@EventHandler
public void WitherResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Resi... | 7 |
public void addTab(final String name) {
int i;
int matchCount = 0;// how many tabs have that name
String title;
for (i = 0; i < this.tabbedPane.getTabCount(); i++) {
title = this.tabbedPane.getTitleAt(i);
if (title.equals(name)) {
matchCount++;// exactly the same name
}
else if (title.matches(na... | 6 |
public Double[][] getFVal() {
return fVal;
} | 0 |
public int maxArea2(int[] height, int start, int end, int max) {
while (end > start) {
int thisArea = Math.min(height[start], height[end]) * (end - start);
if (thisArea > max)
max = thisArea;
if (height[start] > height[end])
end--;
... | 3 |
public int[] vote(int length)
{//Randomly select how many answers we're going to pick, since multiplechoice can have multiple answers
//then randomly select which indexes we think are the right answers and return this array
//part of the code is similar to the generateQuestions method in SimulationDriver for multi... | 3 |
public static boolean implementsSerializable(final ClassEditor ce) {
if (ce.type().equals(Type.OBJECT)) {
// Stop the recursion!
return (false);
}
final Type serializable = Type.getType("Ljava/io/Serializable;");
final Type[] interfaces = ce.interfaces();
for (int i = 0; i < interfaces.length; i++) {
... | 4 |
public Debate getSpecificDebate(String id) {
Element root = document.getRootElement();
Element debateElement;
Debate debate = null;
Element debateE = (Element) document
.selectSingleNode("//debate[@id='" + id + "']");
if (debateE != null) {
String topic = debateE.element("topic").getText()
, de... | 9 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().write("hi");
HashMap<String,Integer> accessList=new HashMap<String,Integer>();
System.out.println("test called");
try {
URL te... | 3 |
public void startElement(String uri, String localName,
String qName, Attributes attributes)
throws SAXException {
if(qName.equals("levelWidth")) {
inLevelWidth = true;
}
if(qName.equals("levelHeight")) {
inLevelHeight = true;
}
if(qName.equals("x")) {
inX = true;
}
if(qName.equa... | 5 |
public ArrayList<Car> findCarsById(int id) {
ArrayList<Car> carList = new ArrayList<Car>();
for (int i = 0; i < 4; i++) {
for (int j = 0; j < Cars.get(i).size(); j++) {
if (Cars.get(i).get(j).getId() == id)
carList.add(Cars.get(i).get(j));
}
... | 3 |
public void update() {
//if a global state exists, call its execute method, else do nothing
if(pGlobalState != null) pGlobalState.execute(pOwner);
//same for the current state
if (pCurrentState != null) pCurrentState.execute(pOwner);
} | 2 |
@Test
public void filtersByAuthorLastnameWorks() {
citations.add(c1);
filter.addFieldFilter("author", "Kekkonen");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c1) && filtered.size() == 1);
} | 1 |
private void
writeLong(
long l )
{
if ( l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE ){
writeInt((int)l);
}else{
writeBytes(Long.toString( l ).getBytes());
}
} | 2 |
static void setComboBox(JComboBox cb, int k) {
ActionListener[] al = cb.getActionListeners();
if (al != null) {
for (ActionListener i : al)
cb.removeActionListener(i);
}
ItemListener[] il = cb.getItemListeners();
if (il != null) {
for (ItemListener i : il)
cb.removeItemListener(i);
}
cb.setS... | 8 |
private void setUpInfoPanel()
{
infoPanel = new JPanel();
cEquals = new JLabel("C = ");
cText = new JTextField(27);
cText.setEditable(false);
infoPanel.add(cEquals);
infoPanel.add(cText);
add(infoPanel, BorderLayout.SOUTH);
} | 0 |
private static void printHelper(RBNode n, int indent) {
if (n == null) {
System.out.print("<empty tree>");
return;
}
if (n.right != null) {
printHelper(n.right, indent + INDENT_STEP);
}
for (int i = 0; i < indent; i++)
System.out.pr... | 5 |
public GoGame()
{
super("Go"); // name of the top of the board
groups = new ArrayList<Group>();
board = new ImageIcon("go.png");// puts the board as an image icon
whitePass = false;// boolean which checks to see if white has passed
blackPass = false;// Checks to see if black has passed
JPanel panel = new ... | 2 |
public byte GetByte(int distance)
{
int pos = _pos - distance - 1;
if (pos < 0)
pos += _windowSize;
return _buffer[pos];
} | 1 |
public static void printQueryIteratorSolutionOrnately(QueryIterator self, QuerySolution solution, int solutionnumber, PrintableStringWriter stream) {
if (solutionnumber == Stella.NULL_INTEGER) {
solutionnumber = 0;
{ QuerySolution solution000 = null;
DictionaryIterator iter000 = ((DictionaryIter... | 8 |
private static final void method2623(AbstractToolkit var_ha, int[] is, int i, int i_19_,
int i_20_, int[] is_21_,
int[] is_22_) {
int[] is_23_ = new int[4];
var_ha.getDimensions(is_23_);
if (is_21_ != null && is_23_[3] - is_23_[1] != is_21_.length)
throw new IllegalStateException();
method2624();
... | 7 |
public void addCity(City cit) {
int id;
Connection con = null;
PreparedStatement pstmt = null;
Statement idstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(d... | 7 |
public boolean renderBlockFenceGate(BlockFenceGate par1BlockFenceGate, int par2, int par3, int par4)
{
boolean var5 = true;
int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4);
boolean var7 = BlockFenceGate.isFenceGateOpen(var6);
int var8 = BlockDirectional.getDirection(va... | 9 |
public void dequeueSound(String filename) {
if (!toStream) {
errorMessage("Method 'dequeueSound' may only be used for "
+ "streaming and MIDI sources.");
return;
}
if (filename == null || filename.equals("")) {
errorMessage("Filename not specified in method 'dequeueSound'");
return;
}
synchr... | 6 |
private boolean jj_2_31(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_31(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(30, xla); }
} | 1 |
protected Boolean IsPronome(String pTexto)
{
ConexaoMySql cn = new ConexaoMySql();
Boolean retorno=false;
String strSQL = "select cleasing_pronome from cleasing_pronome";
try{
ResultSet rs = cn.retornarResultSet(strSQL);
... | 4 |
public void mouseReleased(MouseEvent e) {
try {
if (mapViewer.getGotoPath() != null) {
// A mouse drag has ended (see CanvasMouseMotionListener).
PathNode temp = mapViewer.getGotoPath();
mapViewer.stopGoto();
// Move the unit:
... | 7 |
private void processWrite(SelectionKey key) throws IOException {
WritableByteChannel ch = (WritableByteChannel) key.channel();
synchronized (writeBuf) {
writeBuf.flip();
int bytesOp = 0, bytesTotal = 0;
while (writeBuf.hasRemaining() && (bytesOp = ch.write(writeBuf)... | 5 |
private static boolean isLetter(char arg0) {
return arg0 >= 'a' && arg0 <= 'z' || arg0 >= 'A' && arg0 <= 'Z';
} | 3 |
private Owner PlayerToOwner(Player p){
if(p == Player.Cathargo){
return Owner.Cathargo;
}
return Owner.Rom;
} | 1 |
protected final void setLogin(String login) {
_login = login;
} | 0 |
public <T extends ICreature> Collection<T> createCreatures(IEnvironment env, int count,
IColorStrategy colorStrategy, Constructor<T> constructor) {
Collection<T> creatures = new ArrayList<T>();
Dimension s = env.getSize();
for (int i=0; i<count; i++) {
// X coordinate
double x = (rand.nextDoub... | 2 |
@Override
public ArrayList<Map<String, String>> getAllWonBidsOfUser(String user) {
System.out.println("getAllWonAuctionsOfUser");
ArrayList<Map<String, String>> bidsList = new ArrayList<Map<String,String>>();
TypedQuery<Bid> allWonBidsQuery = emgr.createNamedQuery("Bid.findAllWonAuctionsByUser", Bid.class)... | 1 |
@Override
public void connectionSuccessful() {
messagelog.append("Connected!\n");
messageToSend.setText("");
messageToSend.setEditable(true);
} | 0 |
public int getMachineIndexByName(String machineFileName){
ArrayList machines = getEnvironment().myObjects;
if(machines == null) return -1;
for(int k = 0; k < machines.size(); k++){
Object current = machines.get(k);
if(current instanceof Automaton){
... | 4 |
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
if (Utils.promptQuestion("Weet je zeker dat je " + selectedEmployee.getFirstName() + " " + selectedEmployee.getFamilyName() + " wilt verwijderen?", true, "Ja", "Nee")) {
if (selectedEmpl... | 2 |
@Test
public void testBoardingPassengersOfLP() throws TrainException{
d = new DepartingTrain();
loco = new Locomotive(grossWeight, locoClassification);
d.addCarriage(loco);
passenger1 = new PassengerCar(grossWeight, passenger1Seats);
d.addCarriage(passenger1);
assertEquals(0, (int)d.numberOnBoard());
int... | 3 |
public int getFirstFreeSeat() {
for(int i = 0; i < seatStatus.length; i++)
for(int j = 0; j < seatStatus[i].length; j++)
if(seatStatus[i][j] == 'L')
return i*40+j;
return -1;
} | 3 |
public void receiveResponse(byte[] data, int length) throws IOException {
DNSInputStream dnsIn = new DNSInputStream(data, 0, length);
int id = dnsIn.readShort();
if (id != queryID) {
throw new IOException("ID does not match request");
}
int flags = dnsIn.readShort();
... | 7 |
private int valueXexpand(char[] charArray, int i) {
if ('X' == charArray[i]) {
if (charArray.length > i
& ('L' == charArray[i + 1] | 'C' == charArray[i + 1]
| 'D' == charArray[i + 1] | 'M' == charArray[i + 1])) {
return -10;
} else if (charArray.length + 1 > i + 1
& ('L' == charArray[i + 2]... | 6 |
public static Map mapEnchantmentData(int par0, ItemStack par1ItemStack)
{
Item var2 = par1ItemStack.getItem();
HashMap var3 = null;
Enchantment[] var4 = Enchantment.enchantmentsList;
int var5 = var4.length;
for (int var6 = 0; var6 < var5; ++var6)
{
Enchan... | 7 |
public Object getValueAt(int row, int col) {
try {
BasicRecipe r = data.get(row);
switch (col) {
case 0 :
return r.title;
case 1 :
return r.style;
case 2 :
return r.brewer;
case 3 :
return r.iteration;
default :
return "";
}
} catch (Exception ... | 5 |
public void indication(final FrameEvent e)
{
final CEMILData f = (CEMILData) e.getFrame();
final byte[] apdu = f.getPayload();
// can't be a process communication indication if too short
if (apdu.length < 2)
return;
final int svc = DataUnitBuilder.getAPDUService(apdu);
// Note: even if this is a... | 7 |
@Override
public boolean show() {
if (!getTab().open()) {
return false;
}
final WidgetChild list = Widgets.get(EMOTE_WIDGET, EMOTE_LIST);
if (list == null || !list.visible()) {
return false;
}
final WidgetChild emote = list.getChild(childId);
return Widgets.scroll(emote, Widgets.get(EMOTE_WIDGET, E... | 5 |
@Override
public void mouseEntered(MouseEvent e) {
} | 0 |
public void run() {
while (true) {
if (animationEnabled()) {
repaint();
}
try {
Thread.sleep(FRAME_DELAY);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
} | 3 |
public void applyNoise() {
currCycle++;
currCycle %= NUMBER_OF_CYCLES_PER_CHANGE;
// every NUMBER_OF_CYCLES_PER_CHANGE we do the change
if (currCycle == 0) {
this.speed += ((random() * 2) - 1);
// maintain the speed within some boundaries
if (this.speed < MIN_SPEED) {
this.speed = MIN_SPEED;
}... | 3 |
public static List<Graph.Edge> findShortestPath(Graph g, int sourceVertex, int destinationVertex){
int n = g.getVerticesCount();
//keeping space for 1 extra cycle to detect a negative cycle
int [][]cost = new int[n+1][n];
Graph.Edge[][] retrackt = new Graph.Edge[n+1][n];
for( I... | 9 |
public static int characterSize(int character) throws JSONException {
if (character < 0 || character > 0x10FFFF) {
throw new JSONException("Bad character " + character);
}
return character <= 0x7F ? 1 : character <= 0x3FFF ? 2 : 3;
} | 4 |
@Override
public int compareTo(DataChunk chunk) {
DataChunk arg0 = (DataChunk)chunk;
for (int i = arg0.getStart().length - 1; i >= 0; --i) {
if (this.getStart()[i] == arg0.getStart()[i])
continue;
return this.getStart()[i] < arg0.getStart()[i] ? -1 : 1;
}
return 0;
} | 3 |
private int alphabeta(int m, int dt, int a, int b, Board B, boolean max) {
if (dt == 0 || findPossibleMoves(max, B).length == 0) {
return getRating(max, B, m);
} else if (max == true) {
for (int i : findPossibleMoves(max, B)) {
Board nB = B;
n... | 7 |
@Override
public String display() { //Display memory on command line interface
String displayString = "";
for (int i = 0; i < MEMORY.length; i++) {
if (MEMORY[i] == null) {
if (i < 10) { //For formatting of single digits
String iString = " 0" + i;
displayString += "\n" + iString + "| ---------... | 4 |
protected static Map<String, String> resolveDataProviderArguments(Method testMethod) throws Exception
{
if (testMethod == null)
throw new IllegalArgumentException("Test Method context cannot be null.");
DataProviderArguments args = testMethod.getAnnotation(DataProviderArguments.class);
... | 5 |
protected void useCameraValue(double value) {
setSetpoint(returnPIDInput()+value);
} | 0 |
private byte[] hashPassword(String password, byte[] nonce) throws IOException {
byte[] passw = password.toUpperCase().getBytes();
byte[] lmPw1 = new byte[7];
byte[] lmPw2 = new byte[7];
int len = passw.length;
if (len > 7) {
len = 7;
}
int idx;
... | 9 |
private void sortiere(int[] zahlen, int l, int r) {
int positionRechts = r;
/*
* Sortierung von der Mitte aus starten
*/
// int pivot = zahlen.length / 2 ;
int pivot = Math.round((r + 1 - l) / 2 + l);
System.out.println();
System.out.println("Mittelwert: " + zahlen[pivot]);
if (l... | 6 |
public void newGame() {
String s;
String name = "";
s = "Welcome to Ye Olde RPG!\n";
s += "\nChoose your class: \n";
s += "\t1: Warrior\n";
s += "\t2: Mage\n";
s += "\t3: Archer\n";
s += "\t4: Assassin\n";
s += "Selection: ";
System.out.print( s );
try {
role = Integer.parseInt( in.readLine() );
}
... | 6 |
public void updateList(ArrayList<ClientContact> contacts){
clientContactCurrent = contacts;
list.setModel(new AbstracListModelForClient(clientContactCurrent));
} | 0 |
public void setList(JTextArea list) {
this.list = list;
} | 0 |
@Override
public Object clone() throws CloneNotSupportedException {
//PropertyContainerImpl cloned = new PropertyContainerImpl();
PropertyContainerImpl cloned = (PropertyContainerImpl) super.clone();
cloned.current_values = (HashMap) this.current_values.clone();
cloned.default_values = (HashMap) this.default_v... | 0 |
private void notifyOfLockedStateWillChange() {
for (OutlineModelListener listener : getCurrentListeners()) {
listener.lockedStateWillChange(this);
}
} | 1 |
public ScriptFile(String fileName)
{
this.fileName = fileName;
try
{
BufferedReader reader = new BufferedReader(new FileReader(fileName));
while (reader.ready()) {
String line = reader.readLine().trim();
if (line.length() == 0)
... | 4 |
public double getProbability(String[] ratings) {
int n = ratings.length;
ArrayList<Integer> list = new ArrayList<Integer>();
int Enumber;
int x;
int R;
double ans = 0.0;
String str = "";
for(int i = 0;i < n;i++){
str = str + ratings[i];
}
String s[] = str.split(" ");
for(int i = 0;i < s.leng... | 6 |
private static int[] getCrewsIndices() {
Set s = (Set<Crew>) map.get(flightList.getSelectedValue().toString());
int[] selectedIndices = new int[s.size()];
for(int i = 0; i<s.size(); i++){
for(int j=0; j<data.fetchCrewsList().length; j++){
if(data.fetchCrewsList()[j].toString().equals((s.toArray()[i]).toSt... | 3 |
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.