text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MarkPk other = (MarkPk) obj;
if (idCours != other.idCours)
return false;
if (idUser != other.idUser)
return false;
return true;
} | 5 |
public UIMenu toUIMenu(String heading) {
if (null == heading)
throw new IllegalArgumentException();
if (_menu.size() <= 1)
throw new IllegalStateException();
UIMenu.Pair[] array = new UIMenu.Pair[_menu.size()];
for (int i = 0; i < _menu.size(); i++)
array[i] = _menu.get(i);
return ... | 3 |
public static void main(String[] args) throws Exception
{
String urlString;
if (args.length == 0)
{
urlString = "http://www.w3.org/";
System.out.println("Using " + urlString);
}
else urlString = args[0];
URL url = new URL(urlString);
InputStream in = url.op... | 5 |
private NodeVariable getFixableLoad(NodeFunction f) throws NoMoreValuesException {
LinkedList<NodeVariable> xes = new LinkedList<NodeVariable>(f.getNeighbour());
Collections.shuffle(xes);
//for (NodeVariable x : f.getNeighbour()) {
// xes let the load to be chosen in random order (not al... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AffectationPK other = (AffectationPK) obj;
if (idEmp != other.idEmp)
return false;
if (idProj != other.idProj)
return false;
return tru... | 5 |
public Expr Mul_Expr() throws ParseException {
Expr e, et;
Token tok;
e = Un_Expr();
label_25:
while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case MUL:
case DIV:
case MOD:
break;
... | 9 |
public void parse(String fileName) {
parserFactory = new ObjLineParserFactory(this);
InputStream fileInput = ResourceLoader.getResourceAsStream(fileName);
if (fileInput == null) {
// Could not find the file in the jar.
try {
File file = new File(fileName);
if (file.exists()) fileInput = new FileIn... | 5 |
public static int lastIndexOfNonWhiteSpace( String string )
{
if ( isEmpty( string ) ) {
return 0;
}
int right = string.length();
char[] chars = string.toCharArray();
for ( int idx = right - 1; idx > 0; idx-- ) {
char eachChar = chars[idx];
... | 4 |
public List<WorldNode> getNeighbours(WorldNode node) {
if(log.isLoggable(Logger.INFO))
log.log(Logger.INFO, "getNeighbours() for node: " + node.getxCoord() + ", " + node.getyCoord());
List<WorldNode> result = new ArrayList<WorldNode>();
int[] offset = {1, -1};
WorldNode child = null;
for (int i ... | 9 |
public boolean run( char option, char jogador )
{
switch( option )
{
case 'P':
// TODO
break;
case 'N':
// TODO
break;
case 'U':
// TODO
break;
case 'F':
// TODO
break;
case 'T':
return runTabela();
case 'H':
return runHelp();
}
Util.println( "Opção nã... | 6 |
public String getColumnText(Object element, int columnIndex) {
if (element != null) {
switch (columnIndex) {
case 0:
return ((StockDTO) element).getTickerSymbol();
case 1:
return ((StockDTO) element).getLastTrade().toString();
case 2:
return numberFormat.format(((StockDTO) element).getVolume()... | 9 |
protected List[] verticalSlices(List childBoundables, int sliceCount) {
int sliceCapacity = (int) Math.ceil(childBoundables.size() / (double) sliceCount);
List[] slices = new List[sliceCount];
Iterator i = childBoundables.iterator();
for (int j = 0; j < sliceCount; j++) {
slices[j] = new ArrayList... | 3 |
static void bindMouseEvents(Drawer drawer, Component component) {
MouseAdapter mouseAdapter = new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
if ((evt.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
// source.setText(source.getText() + "nLeft... | 4 |
@Override
public void handleFile(File file) {
if (getProcessMode() == MODE_BIG_CHUNK) {
String contents = FileTools.readFileToString(file, getOpenEncoding(), lineEnding);
contents = processContents(file, contents);
// If contents are null then don't write anything out.
if (contents == null) {
ret... | 7 |
public void loadEquipment(Element docEle){
NodeList equipmentsList = docEle.getElementsByTagName("Equipment");
Node equipmentsNode = equipmentsList.item(0);
Element equipmentElement = (Element)equipmentsNode;
String equipmentsPath = equipmentElement.getAttribute("FolderPath");
String equipmentPrefix = equipme... | 6 |
public Marker getMarker (Position position){
return (Marker)board[position.getY()][position.getX()];
} | 0 |
public static byte[] getFileBytes(File file) {
try {
InputStream is = new FileInputStream(file);
long length = file.length();
if (length > Integer.MAX_VALUE) {
System.out.println("File " + file.getName() + " was too big to attain file bytes.");
is.close();
return null;
}
byte[] bytes = new ... | 7 |
public void addOuterValueListener(OuterValueListener l) {
if (ovListeners == null)
ovListeners = new Vector();
ovListeners.addElement(l);
} | 1 |
private int fillOcean(Map map, Position p, ServerRegion region,
Rectangle bounds) {
Queue<Position> q = new LinkedList<Position>();
int n = 0;
boolean[][] visited = new boolean[map.getWidth()][map.getHeight()];
visited[p.getX()][p.getY()] = true;
q.add(p... | 8 |
@Override
protected void setRolloverTab(int index) {
int oldIndex = getRolloverTab();
super.setRolloverTab(index);
if (oldIndex != index) {
if (oldIndex != -1) {
tabPane.repaint(getTabBounds(tabPane, oldIndex));
}
if (index != -1) {
... | 3 |
public static TestThread createRequestGenerator(Scanner canal, int src){
if(src == 1)
System.out.print("Origin: ");
int origin = Integer.parseInt(canal.nextLine());
if(src == 1)
System.out.print("Target: ");
int target = Integer.parseInt(canal.nextLine());
if(src == 1)
System.out.print("Operations:... | 7 |
public void saveData(Result result) {
// Erstelle ein TemplateObject für die Ausgabedatei
Template tpl = new Template();
// Lade vorlage
tpl.load("templates/truth.kml.tpl");
// Füge Name im Template ein
tpl.replace("name", result.getName());
... | 4 |
private byte[] encrypt(byte[] data) throws InvalidKeyException,
IllegalBlockSizeException, BadPaddingException {
if (data.length > MAX_ENC_SIZE) {
System.err
.println("Data to long to encrypt. Reason: Possible cheating! Fix: Exit");
System.exit(1);
}
RSAKeyParameters kp = new RSAKeyParameters(fa... | 1 |
public void doMain(String[] args) {
CmdLineParser parser = new CmdLineParser(this);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
// TODO Auto-generated catch block
e.printStackTrace();
parser.printUsage(System.out);
return;
}
if (help)
parser.printUsage(System.out);
el... | 6 |
public static boolean checkEnfrentamiento(Cancha cancha, int x, int y){
int[][] dimension=cancha.getDimension();
for (int i=(x-4);i<x+4;i++){
for(int j=(y-4);j<(y+4);j++){
if(dimension[i][j]==1 || dimension[i][j]==2){
return true; //true igual conflicto p... | 4 |
*/
public void selectAll () {
checkWidget ();
if ((getStyle () & SWT.SINGLE) != 0) return;
selectedItems = new CTableItem [itemsCount];
System.arraycopy (items, 0, selectedItems, 0, itemsCount);
if (isFocusControl () || (getStyle () & SWT.HIDE_SELECTION) == 0) {
redraw ();
}
for (int i = 0; i < selectedItems.l... | 4 |
public static void setPropertyAsString(PropertyContainer container, String key, String value) {
if (container != null) {
container.setProperty(key, value);
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} | 1 |
public static ArrayList<PenPoint> readPointsFromFile(File f) {
BufferedReader br = null;
ArrayList<PenPoint> points;
points = new ArrayList<PenPoint>();
try {
String sCurrentLine;
br = new BufferedReader(new FileReader(f));
boolean flagForPenState = false;
while((sCurrentLine = br.readLine()) != nul... | 7 |
@Override
public void run(){
try{
System.out.println("HireDataNodeServer is waiting for new workers on the port: "+this.portNum);
while(running){
Socket dataNodeSocket = serverSocket.accept();
DataNodeManagerServer managerServer = new DataNodeManagerS... | 3 |
public Norm containsNorm(Action ac, NormType nt)
{
for ( Norm norm: getAllRestrictNorms().values() )
{
Action a = norm.getNormResource().getAction();
if ( a!=null && a.getName().equalsIgnoreCase(ac.getName()) && norm.getNormType() == nt && norm.isActive() )
{
return norm;
}
}
return null;
} | 5 |
public static void main(String[] args) {
String movie = "";
Sub sub = null;
while(true)
{
movie = CLib.input("SubID");
try {
/*context = JAXBContext.newInstance(Root.class);
File file = new File("./omdbapi_text.xml");
System.out.println("Unmarshaling...");
Root r = (Root) c... | 6 |
@Override
public void keyReleased(KeyEvent e) {
if (e.getKeyChar() == 's') {
plateau.resetVitesse();
}
if (e.getKeyChar() == '2') {
plateau2.resetVitesse();
}
} | 2 |
@Override
public void windowClosing(WindowEvent arg0)
{
} | 0 |
@Test
public void getFinishedQuestions() throws Exception {
for (int i = 0; i < 10; i++) {
assertEquals(i, st.getFinishedQuestions());
if (i % 2 == 0) {
st.incRightQuestions();
} else {
st.incMistakeQuestions();
}
}
... | 2 |
public static void main(String[] args) {
int BITS_PER_LINE = 16;
if (args.length == 1) {
BITS_PER_LINE = Integer.parseInt(args[0]);
}
int count;
for (count = 0; !BinaryStdIn.isEmpty(); count++) {
if (BITS_PER_LINE == 0) { BinaryStdIn.readBoolean(); contin... | 7 |
public LLNode getSummedLinkedList(LLNode head1, LLNode head2, int carry) {
if(head1==null && head2==null)
return null;
else {
LLNode node=null;
int num1 = (head1==null)?0:head1.data;
int num2 = (head2==null)?0:head2.data;
int sum = num1+num2+carry;
node = new LLNode(sum%10);
node.next = getSumm... | 6 |
public Integer getExtraPoints() {
return extraPoints;
} | 0 |
boolean isSkip(String skipName) {
return (skipName.equals(name)&&skip==true)? true : false;
} | 2 |
private static void doDescriptionTest()
{
System.out.print("Testing description command ");
try
{
File testFolder = new File( TEST_FOLDER );
String mvdName = TEST_FOLDER+File.separator+"test.mvd";
if ( !testFolder.exists() )
testFolder.mkdir();
String[] args0 = { "-c","create","-m",mvdName,"-d","... | 3 |
public void startLogger() {
Calendar cal = Calendar.getInstance();
cal.clear(Calendar.HOUR);
cal.clear(Calendar.MINUTE);
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);
logger = new Logger("logs/" + cal.getTime() + ".txt", this);
String filename = cal.getTime().toString().replace(" ", "-");
... | 2 |
public void atualizar(Local local) throws Exception
{
String sql = "UPDATE local SET cidade = ?, estado = ?, descricao = ? WHERE id = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
stmt.setString(1, local.getCidade());
stmt.setString(2, local.getEstado());
... | 1 |
*/
public void centerHorizontal(FastVector nodes) {
// update undo stack
if (m_bNeedsUndoAction) {
addUndoAction(new centerHorizontalAction(nodes));
}
int nMinY = -1;
int nMaxY = -1;
for (int iNode = 0; iNode < nodes.size(); iNode++) {
int nY = getPositionY((Integer) nodes.elementAt(iNode));
if (n... | 7 |
public static void writeHttpRequest(OutputStream stream, Keyword method, String host, String urlPath, KeyValueList headers, Stella_Object content) {
{ long contentlength = 0l;
stream.nativeStream.print(method.symbolName + " " + urlPath + " HTTP/1.0\r\n");
if (host != null) {
if (headers == null... | 9 |
public static void sobreescribirFichero(ArrayList<Cliente> array){
try{
FileWriter fichero=new FileWriter("src/Ficheros/Clientes.txt");
PrintWriter pw=new PrintWriter(fichero);
float aux_cuenta_corriente=0, aux_cuenta_ahorro=0, aux_penalizacion=0;
for(int i=0; i<array.size(); i++){
if(array.get(i)... | 4 |
public double FindPeak(long[][] arr) {
long max = 0;
for (int i = 0; i < ximlen; i++) {
for (int j = 0; j < yimlen; j++) {
if (arr[i][j] > max) {
max = arr[i][j];
}
}
}
// this fractal has extreme values at certain points, cut down the max
// value
if (gradient <= 0.3)
return Math.pow... | 7 |
@Override
public int getRoll(){
if(Historical.getInstance().isEmpty()){
return getRandomInt();
}
return getMediumHistoricResult();
} | 1 |
public static void handleItemOption7(Player player, int slotId, int itemId,
Item item) {
long time = Utils.currentTimeMillis();
if (player.getLockDelay() >= time
|| player.getEmotesManager().getNextEmoteEnd() >= time)
return;
if (!player.getControlerManager().canDropItem(item))
return;
player.stopA... | 9 |
public List<DisplayTable> getTables(String world) {
Connection conn = null;
PreparedStatement st = null;
ResultSet rs = null;
List<DisplayTable> tables = new ArrayList<DisplayTable>();
try {
conn = getConnection();
st = conn.prepareStatement(SELECT_WORLD);... | 6 |
public void visitNegExpr(final NegExpr expr) {
if (isLeaf(expr.expr())) {
firstOrder = true;
}
} | 1 |
private void writeSelectorsAndHuffmanTables() throws IOException {
final BZip2BitOutputStream bitOutputStream = this.bitOutputStream;
final byte[] selectors = this.selectors;
final int totalSelectors = selectors.length;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int mtfAlphabetSize = t... | 5 |
@EventHandler
public void onInteract(PlayerInteractEvent event) {
final Player p = event.getPlayer();
if (Core.getState() != State.INGAME) {
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
if (event.getItem() == null) ... | 5 |
@Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
setUser((User) session.get("User"));
setUserdetails((UserDetails) getMyDao().getDbsession().get(UserDetails.class, getUser().getEmailId()));
... | 4 |
public Manacher(String s) {
this.s = s.toCharArray();
t = preprocess();
p = new int[t.length];
int center = 0, right = 0;
for (int i = 1; i < t.length - 1; i++) {
int mirror = 2 * center - i;
if (right > i)
p[i] = Math.min(right - i, p[mirror]);
// attempt to expand palindrome centere... | 4 |
public static void compress() {
int run = 0;
boolean old = false;
while (!BinaryStdIn.isEmpty()) {
boolean current = BinaryStdIn.readBoolean();
// alternate bit
if (current != old) {
BinaryStdOut.write(run, lgR);
run = 1;
old = !old;
}
// sam... | 3 |
private void setUpField() throws Exception {
m_fieldIndex = -1;
m_fieldValueIndex = -1;
m_field = null;
if (m_fieldDefs != null) {
m_fieldIndex = getFieldDefIndex(m_fieldName);
if (m_fieldIndex < 0) {
throw new Exception("[NormDiscrete] Can't find field " + m_fieldName
... | 7 |
static double[][] add(double[][] matrix1, double[][] matrix2){
double[][] sum = new double[matrix1.length][matrix1[0].length];
for(int i = 0; i < sum.length; i++)
for(int j = 0; j < sum[0].length; j++)
sum[i][j] = matrix1[i][j] + matrix2[i][j];
return sum;
} | 2 |
public byte[] renderImage(final ACamera camera) {
// measure render time
LOG.info("rendering image...");
this.information = new RenderInformation();
this.information.start();
// calculate the size of the image data
this.data = new byte[this.settings.getBytes()];
// initialize the render pool
int thre... | 5 |
@Override
protected boolean processSourceMessage(CMMsg msg, String str, int numToMess)
{
if(msg.sourceMessage()==null)
return true;
int wordStart=msg.sourceMessage().indexOf('\'');
if(wordStart<0)
return true;
String wordsSaid=CMStrings.getSayFromMessage(msg.sourceMessage());
if(wordsSaid == null)
... | 7 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
public Coord mod(Coord d) {
int v, w;
v = x % d.x;
w = y % d.y;
if (v < 0)
v += d.x;
if (w < 0)
w += d.y;
return (new Coord(v, w));
} | 2 |
public long getLength() {
return length;
} | 0 |
private Boolean waitForJobToComplete(String jobId, String sqsQueueURL) throws InterruptedException, JsonParseException, IOException {
Boolean messageFound = false;
Boolean jobSuccessful = false;
while (!messageFound) {
out.println("Checking for messages on queue '" + sqsQueueURL + "... | 7 |
public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
* to str... | 9 |
static int blendfactor(int c, int factor, int src, int dst) {
switch (factor) {
case 1:
return c;
case 2:
return colorMul(c, src);
case 3:
return colorMul(c, colorSub(0xFFFFFFFF, src));
case 4:
return colorMul(c, dst);
case 5:
return colorMul(c, colorSub(0xFFFFFFFF, dst));
case 6:
return... | 9 |
public char getChar(){
if( value.length() != 1 )
throw new XException( "not a character: " + value );
return value.charAt( 0 );
} | 1 |
private void rellenarTabla() {
TableColumnModel tcm;
if(tarea.getSubtareas()!=null && !tarea.getSubtareas().isEmpty()){
tableModel = new JDEditar.TableModel(tarea.getSubtareas());
jTabla.setModel(tableModel);
}
tcm = jTabla.getColumnModel();
for (int col =... | 3 |
public static void collectVariableBinding(String name, Stella_Object type, Stella_Object binding, KeyValueList bindings) {
if (binding != null) {
if (type != null) {
type = Logic.getDescription(type);
}
if (RDBMS.collectionValuedConstraintP(binding)) {
{ Cons args = Stella.NIL;
... | 6 |
public void setMedicoCollection(Collection<Medico> medicoCollection) {
this.medicoCollection = medicoCollection;
} | 0 |
public Powerup(){
int i = rand.nextInt(225);
if (i >= 25) this.type = PowerupType.NUKE;
if (i < 25) this.type = PowerupType.SLOWTIME;
if(i >= 100) this.type = PowerupType.LIVES;
if(i >= 150) this.type = PowerupType.SHRINK;
if(i >= 200) this.type = PowerupType.RANDOM;
this.xPos = this.rand.nextInt(Snow.ga... | 9 |
@Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns;
//Find the column.
int boardPositionColumn = boardPosition % columns;
//Posit... | 3 |
public boolean collision(HashMap<Body, Personnage> personnages) {
if (world == null)
return false;
Personnage persCourant;
// collision avec l'environnement est apparu?
CollisionEvent[] evenement = world.getContacts(body);
float Normal_x;
for (int i = 0; i < evenement.length; i++) {
Normal_x = eveneme... | 7 |
public static void main(String[] args){
Socket socket = null;
DataOutputStream os = null;
DataInputStream is = null;
Scanner sc = new Scanner(System.in);
try{
socket = new Socket("192.168.22.1",5000);
os = new DataOutputStream(socket.getOutputStream());
is = new DataInputStream(socket.getInputStream... | 3 |
public final String methodR(int j) {
if(j >= 0 && j < 10000)
return String.valueOf(j);
if(j >= 10000 && j < 10000000)
return j / 1000 + "K";
if(j >= 10000000 && j < 999999999)
return j / 1000000 + "M";
if(j >= 999999999)
return "*";
else... | 7 |
@Override
public void stateChanged(ChangeEvent evt) {
if (evt.getSource().equals(targetDayPicker.getModel())) {
targetDay.set( targetDayPicker.getModel().getYear(),
targetDayPicker.getModel().getMonth(),
targetDayPicker.getModel().getDay());
updateRosterList();
updateTripList();
}
i... | 8 |
public Notebook() {
getContentPane().add(content);
scrollPane = new JScrollPane(content);
getContentPane().add(scrollPane, "Center");
for (menu_count = 0; menu_count < menu.length; menu_count++) {
nbMenuBar.add(menu[menu_count]);
menu[menu_count].addActionListener(this);
while ((menu_count == 0) && (m... | 5 |
public void monitorarSoro(float qtdSoro, Paciente paciente)
throws ControllerException {
try {
if (qtdSoro < 0 || qtdSoro > 500) {
throw new ControllerException(
"valor de quantidade de soro inválido");
}
if (ValidarPaciente(paciente) && qtdSoro < 20) {
Publish publish = new Publish(pacient... | 7 |
public int largestRectangleArea(int[] height) {
// Start typing your Java solution below
// DO NOT write main() function
Stack<Pair> sta = new Stack<Pair>();
if (height.length == 0)
return 0;
int res = 0;
int i = 0;
for (; i < height.length; i++) {
int preH = sta.isEmpty() ? -1 : height[sta.peek().i... | 8 |
public Boolean equals(Eisenstein that) {
return this.a == that.a && this.b == that.b;
} | 1 |
@Override
public String toString() {
String result = "";
int counter = 0;
if (!isEmpty()) {
for (Object obj : queue) {
if (obj != null) {
result += counter + "[" + obj + "] ";
if (counter == (head) % queue.length) {
result += "(head) ";
}
if (counter == (tail) % queue.length) {
... | 5 |
public Card handleSuggestion(Solution suggestion){
ArrayList<Card> clues = new ArrayList<Card>();
Random roller = new Random();
for(Player player : players) {
if(player.getName().equals(suggestion.getPerson()))
player.setLocation(currentPlayer.getLocation());
if(players.get(currentPlayerIndex) == pla... | 5 |
static String findCommonString(String string1, String string2) {
int length1 = string1.length();
int length2 = string2.length();
int[][] traceMap = new int[length1][length2];
int maxNum = 0;
int lastSubBegin = 0;
String commonSub = "";
if(length1==0 || length2==0) return "";
for(int i=0;i<length1;... | 9 |
public VariableStack mapStackToLocal(VariableStack stack) {
VariableStack newStack;
int params = cond.getFreeOperandCount();
if (params > 0) {
condStack = stack.peek(params);
newStack = stack.pop(params);
} else
newStack = stack;
VariableStack after = VariableStack.merge(thenBlock
.mapStackToLoc... | 3 |
private int square(Piece[][] pieces, int from_x, int from_y, int to_x, int to_y) {
if((to_x == from_x && Math.abs(to_y - from_y) == 1 || to_y == from_y && Math.abs(to_x - from_x) == 1 || Math.abs(to_x - from_x) == 1 && Math.abs(to_y - from_y) == 1) && (isOccupiedByAnOpponent(pieces[to_x][to_y]) || isEm... | 9 |
void FillDistancesPrices()
{
for (int i = Base.kStartPosModelIndex; i < Base.kNumFullDistances; i++)
{
final int posSlot = GetPosSlot(i);
final int footerBits = ((posSlot >> 1) - 1);
final int baseVal = (2 | posSlot & 1) << footerBits;
tempPrices[i] = ... | 6 |
@Override
public void run(ListIterator<Instruction> iter){
Instruction i = iter.next();
// if this function does any function calls, the return
// address will need to be saved
if(i instanceof Call) {
registersUsed.add(retAddrReg);
}
Integer color = i.getC... | 4 |
public boolean isFull(int i, int j) // is site (row i, column j) full?
{
if (i<1 || i>N || j<1 || j>N)
{
throw new java.lang.IndexOutOfBoundsException();
}
return isOpen(i, j) && uf_real.connected(N * (i - 1) + j - 1, N * N);
} | 5 |
static void lsp_to_curve(float[] curve, int[] map, int n, int ln,
float[] lsp, int m, float amp, float ampoffset) {
int i;
float wdel = M_PI / ln;
for (i = 0; i < m; i++) {
lsp[i] = Lookup.coslook(lsp[i]);
}
int m2 = (m / 2) * 2;
i = 0;
wh... | 9 |
public String nextCDATA() throws JSONException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = ... | 6 |
@Override
public int decidePlay(int turn, int drawn, boolean fromDiscard) {
DataInstance d = getHistory(drawn, false);
playNet.compute(d.inputs);
int actual = playNet.getOutput()-1;
//Train
if (model_mimic != null){
int target = model_mimic.decidePlay(turn, drawn, fromDiscard);
playNet.trainBackprop(0.... | 1 |
private String queryServer() throws IOException {
ih_str = "";
byte[] info_hash = this.torrentInfo.info_hash.array();
for (int i = 0; i < info_hash.length; i++) {
ih_str += "%" + this.HEXCHARS[(info_hash[i] & 0xF0) >>> 4]
+ this.HEXCHARS[info_hash[i] & 0x0F];
}
//System.out.println("info hash:... | 8 |
@Override
public boolean onResponse(Message message) {
String msg = message.content.toLowerCase();
Pattern pattern = Pattern.compile("^@((qinbot)|(亲妹子)) +help(.*)");
Matcher matcher = pattern.matcher(msg);
if (matcher.find()) {
//总帮助提示
if (matcher.group(4)==null||matcher.group(4).trim().equals(""))... | 7 |
public long getElapsedTimeSecs() {
long elapsed;
if (running) {
elapsed = ((System.currentTimeMillis() - startTime) / 1000);
}
else {
elapsed = ((stopTime - startTime) / 1000);
}
return elapsed;
} | 1 |
public ArrayList<Disciplina> Disciplinas() throws FileNotFoundException {
try {
Scanner fi = new Scanner(new File("src/Ficheiros/disciplinas.txt"));
Scanner ji = new Scanner(new File("src/Ficheiros/disciplinas.txt"));
String bb = fi.nextLine();
String bbb = ji.ne... | 9 |
public void addMarker(double latitude,double longtitude)
{
if(markers<20)
{
marker[markers] = new MarkerRect(latitude,longtitude);
markers++;
}
} | 1 |
@Override
// Over writes the table cell renderer to perform custom cell rendering
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column) {
// Create a rendered label for easy manipulation
JLabel renderedLabel = (J... | 7 |
private static void addAll(Set<String> target, Set<String> toAdd, String prefix){
for(String i : toAdd){
// System.out.println((prefix+i));
target.add((prefix+i));
}
} | 1 |
@Override
protected void paintScreen(Graphics2D g) {
paintInstructions(g);
int maxNbChoicesOnScreen = (getScreenHeight() - INSTRUCTIONS_AREA_HEIGHT)
/ CHOICE_HEIGHT - 1;
int start = 0;
if (selectedIndex >= maxNbChoicesOnScreen) {
start = selectedIndex - maxNbChoicesOnScreen + 1;
}
int lastChoiceTo... | 4 |
public boolean isBlockSolidOnSide(World world, int x, int y, int z, int side)
{
int meta = world.getBlockMetadata(x, y, z);
if (this instanceof BlockStep)
{
return (((meta & 8) == 8 && (side == 1)) || isOpaqueCube());
}
else if (this instanceof BlockFarmland)
... | 8 |
protected void updateOrigin()
{
mxRectangle bounds = getGraphBounds();
if (bounds != null)
{
double scale = getView().getScale();
double x = bounds.getX() / scale - getBorder();
double y = bounds.getY() / scale - getBorder();
if (x < 0 || y < 0)
{
double x0 = Math.min(0, x);
double y0 = ... | 7 |
public static void main(String[] args) throws Exception {
IfolorLoader loader = new IfolorLoader();
ProjectPath path = TestData.getTestProject();
Book book = loader.load(path);
HashSet<String> duplicateFind = new HashSet<String>();
int doubles = 0;
for (BookPage pg : book.pages)
for (BookElement el : ... | 7 |
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.