text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean tryOpen(Matrix matrix) {
LinkedList<Node> neighbours = matrix.allNeighbours(x, y);
for (Node neighbour : neighbours) {
if (neighbour instanceof Door) {
if (((Door)neighbour).isOpen()) {
((Door)neighbour).close();
if (inventory.containsValue(((Door)neighbour).getKey(... | 7 |
public boolean getFile(String branch, String path, File file)
{
boolean b = true;
Utils.logger.log(Level.INFO, "Getting file from github " + path + " to " + file.getAbsolutePath());
InputStream is = null;
ReadableByteChannel rbc = null;
FileOutputStream fos = null;
try
{
URL url = new URL(APIBASE + "r... | 7 |
private void createSearchList() {
searchList.clear();
for ( Column column : columns ) {
if ( column.isSearchId() ) {
searchList.add( column.getFldName() );
hasSearch = true;
}
}
} | 2 |
static public Integer clampPriority(Integer priority) {
if (priority.intValue() > MAX_PRIORITY.intValue()) {
priority = MAX_PRIORITY;
} else if (priority.intValue() < MIN_PRIORITY.intValue()) {
priority = MIN_PRIORITY;
}
return priority;
} | 2 |
private void createVitalSignjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createVitalSignjButtonActionPerformed
// TODO add your handling code here:
boolean isInputValid = true;
if(this.respiratoryRatejTextField.getText().trim().compareTo("") == 0 &&
!... | 9 |
public void showPersonalPostsToFile(FileWriter f) throws IOException {
for (TimedPosts post : posts) {
long elapsedTimeInSec = (endTime - post.getTime()) / 1000000000;
endTime += 1000000000;
if (elapsedTimeInSec < 60) {
int elapsedTime = (int) elapsedTimeInSec... | 2 |
public static ArrayList<String> walk(String ip, String comunidade, String objeto) throws IOException {
System.out.println("\nSNMP Walk");
System.out.println("Objeto: " + objeto);
System.out.println("Comunidade: " + comunidade);
// Inicia sessaso SNMP
TransportMapping transport =... | 9 |
private DataCacheEntry fetchLine(int address) {
int tag = address / (lineSize * (numberOfLines / associativity));
int set = (address / lineSize) % (numberOfLines / associativity);
int offset = address % lineSize;
int index = 0, oldest = 0;
DataCacheEntry entry = null;
for (int i = 0; i < associativity; i... | 8 |
private void calculateDesiredVelocity() {
float distanceToTarget = Maths.getDistance(this.getX(), this.getY(), this.targetX, this.targetY);
double angleDifference = Maths.angleDifference(Math.toDegrees(angle), Math.toDegrees(desiredAngle));
if(!halting && distanceToTarget > 1) {
... | 5 |
public boolean intersects(GameObj obj){
return (pos_x + width >= obj.pos_x
&& pos_y + height >= obj.pos_y
&& obj.pos_x + obj.width >= pos_x
&& obj.pos_y + obj.height >= pos_y);
} | 3 |
public Token getNextToken(){
//mat.usePattern(space).find();
Token curToken = new Token();
curToken.type = TokType.UNKNOWN;
curToken.value = "";
for(int i=0;i<patterns.length-1;i++){
if(mat.usePattern(patterns[i].pat).find()){
curToken.value = mat.grou... | 3 |
public void init()
{
glMatrixMode(GL_PROJECTION);
glOrtho(-4, 4, -4, 4, 20, -40);
//gluPerspective(70f, 800f/600f, 1, 1000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, Display.getWidth(), Display.getHeight());
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEN... | 2 |
public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} | 6 |
public Data gen() {
int ano = 1960 + g.nextInt(40);
int mes = g.nextInt(12);
int dia = 1;
if (mes == 2 && ano % 400 == 0) {
dia = 1 + g.nextInt(27);
} else if (mes == 2 && ano % 4 == 0 && ano % 100 != 0) {
dia = 1 + g.nextInt(28);
} else i... | 9 |
public synchronized void editar(int i)
{
try
{
new InstituicaoSubmissaoView(this, list.get(i));
}
catch (Exception e)
{
}
} | 1 |
public final String getUrl() {
if (url == null) {
return null;
}
String returnUrl = url;
returnUrl += isUseExtraParams() ? "&cver=html5&ratebypass=yes&c=WEB&alr=yes&keepalive=yes" : "";
returnUrl += String.format("&range=%s-%s", String.valueOf(startRange), String.va... | 5 |
public static JsonElement parse(JsonReader reader) throws JsonParseException {
boolean isEmpty = true;
try {
reader.peek();
isEmpty = false;
return TypeAdapters.JSON_ELEMENT.read(reader);
} catch (EOFException e) {
/*
* For compatibility with JSON 1.5 and earlier, we return a ... | 5 |
static String[] toStringArray(MatVar mv, boolean transpose) {
if (mv.type() == MatVar.TEXT) {
MatText mt = (MatText) mv;
int[] dims = mv.getDim();
String[] out = new String[dims[transpose ? 1 : 0]];
for (int i = 0; i < dims[transpose ? 1 : 0]; i++) {
... | 9 |
private void writeObject(List<Byte> ret, TypedObject val) throws EncodingException, NotImplementedException
{
if (val.type == null || val.type.equals(""))
{
ret.add((byte)0x0B); // Dynamic class
ret.add((byte)0x01); // No class name
for (String key : val.keySet())
{
writeString(ret, key);
enco... | 6 |
private Thread createAliveThread()
{
return new Thread()
{
public void run()
{
while(true)
{
try{
if (aliveNotificator != null) {
aliveNotificator.iamAlive(rmiObjectName);
... | 5 |
private boolean isCollision(Entity e1, Entity e2) {
// Hvis objektene er det samme, return false.
if (e1 == e2) {
return false;
}
// Er objektene vesener og er de i livet enda?
if (e1 instanceof Creature && !((Creature) e1).isAlive()) {
return false;
... | 8 |
public void setAihao(String aihao) {
this.aihao = aihao;
} | 0 |
private static void bindByField(Object pojo, CommandLine cli, Field field) throws Exception
{
CLIOptionBinding cliBinding = field
.getAnnotation(CLIOptionBinding.class);
char shortOpt = cliBinding.shortOption();
String longOpt = cliBinding.longOption();
if (cliBinding.values()) {
if (field.getType().is... | 9 |
private static void printGridletList(GridletList list, String name,
boolean detail)
{
int size = list.size();
Gridlet gridlet = null;
String indent = " ";
System.out.println();
System.out.println("============= OUTPUT for " + name ... | 3 |
private Holiday getHoliday(Element element)
{
String className = null;
if (className == null)
className = element.getAttributeValue("class");
if (className == null)
{
className = "nz.co.senanque.madura.datetime.holidays."+element.getName();
}
H... | 7 |
int daysOfYear(int year) {
if (isLeepYear(year)) {
return 366;
}
return 365;
} | 1 |
@SuppressWarnings("unchecked")
@Override
public String displayQuestion(int position) {
ArrayList<String> questionList = (ArrayList<String>) question;
String questionStr = questionList.get(0);
StringBuilder sb = new StringBuilder();
sb.append("<span class=\"dominant_text\">" + position + ".</span>\n");
sb.ap... | 2 |
@Test
public void testDisconnectOnce() throws Exception {
final Properties config = new Properties();
final int min_uptime = 20;
final int max_uptime = 2000;
config.setProperty("min_uptime", "" + min_uptime);
config.setProperty("max_uptime", "" + max_uptime);
final... | 1 |
static double[][] multiply(double[][] A, double[][] B){
double[][] AB = new double[A.length][B[0].length];
for(int i = 0; i < A.length; i++){
for(int j = 0; j < B[i].length; j++){
for(int k = 0; k < B.length ; k++){
AB[i][j] += A[i][k]*B[k][j];
}
}
}
return AB;
} | 3 |
public List<StudentObj> getStudentBySubmitted(String classname, int objId, int topicId) {
List<StudentObj> items = new LinkedList<StudentObj>();
String sql = "select Student.classname, Student.rollNo, fullname, email from Student inner join Result on Student.rollNo = Result.rollNo inner join Assignment... | 6 |
@Override
protected boolean next() {
switch(state()) {
case size_ready:
return size_ready ();
case message_ready:
return message_ready ();
default:
return false;
}
} | 2 |
@EventHandler
public void WitchRegeneration(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.getWitchConfig().getDouble("Witch.Regen... | 6 |
private void close() {
try {
out.close();
} catch(Exception e) {}
try {
in.close();
} catch(Exception e) {}
try {
socket.close();
} catch(Exception e) {}
System.out.println("Thread closed.");
} | 3 |
public ArrayList<Integer> getAvailableRooms(String startTime, String endTime, int capacity){
ArrayList<Integer> availableRooms = new ArrayList<>();
ArrayList<Meeting> meetings = meetings().getMeetings();
for(Room room : rooms().getRooms()){
if(room.getRoomNumber() == -1) continue;
... | 8 |
@Override
public Party getEnemyParty(int level)
{
Party party = new Party();
Random gen = new Random();
if(level == 1)
{
if(gen.nextInt(2) == 0)
party.add(new Goblin());
else
party.add(new Rat());
}
else if(level == 2)
{
if(gen.nextInt(2) == 0)
party.add(new Orc());
else
p... | 9 |
public byte[] getInfoHash() {
return this.info_hash;
} | 0 |
@Test
public void testInitRandom() {
try {
System.out.println("initRandom");
int numberOfGenerators = 5;
int numberOfLoadsForGenerator = 3;
int R = 2;
double xmean = 0.2;
double delta = 0.2;
PowerGrid instance = new PowerGri... | 5 |
private <T> T[] copyElements(T[] a) {
if (head < tail) {
System.arraycopy(elements, head, a, 0, size());
} else if (head > tail) {
int headPortionLen = elements.length - head;
System.arraycopy(elements, head, a, 0, headPortionLen);
System.arraycopy(element... | 2 |
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... | 9 |
public void prepare( Map<String,BasicType> optionalReturnSettings )
throws MalformedRequestException,
UnsupportedVersionException,
UnsupportedMethodException,
UnknownMethodException,
ConfigurationException,
MissingResourceException,
AuthorizationException,
Heade... | 5 |
public void run() {
Socket incomingSocket = null;
while(true) {
try {
incomingSocket = serverSocket.accept();
System.out.println("Parsing msg..");
Message msg = Utility.parseMessage(incomingSocket);
msg.readMessage();
switch(msg.getType()) {
case GET:
//send peer response
//sen... | 9 |
@Before
public void setUp() {
view = new DialogWindowView("title");
view.addPropertyChangeListener(this);
controller.addView(view);
propertyChangeSupport.addPropertyChangeListener(controller);
} | 0 |
private Content getInheritedTagletOutput(boolean isNonTypeParams, Doc holder,
TagletWriter writer, Object[] formalParameters,
Set<String> alreadyDocumented) {
Content result = writer.getOutputInstance();
if ((! alreadyDocumented.contains(null)) &&
holder instanceo... | 7 |
static final void method1119(boolean bool) {
anInt8381++;
try {
Method method
= (aClass8389 != null ? aClass8389
: (aClass8389 = method1121("java.lang.Runtime")))
.getMethod("availableProcessors", new Class[0]);
if (bool != false)
method1118(false, false, null, -35);
if (method != null... | 5 |
public boolean equals(Packet p) {
if((end-start) != (p.end - p.start)) {
return false;
}
if(p.mask != mask || p.timeStamp != timeStamp) {
return false;
}
int length = end-start;
for(int cnt=0;cnt<length;cnt++) {
if(buffer[(start+cnt)&mask] != p.buffer[(p.start+cnt)&mask]) {
System.out.... | 5 |
public static void drawNetwork(Network network, Renderer renderer)
{
ArrayList<Layer> layers = network.getLayers();
int maxWidth = 0;
/**
* Calculate the maximum width of the layers.
* This will later be used to center all layers that are smaller than the widest on... | 6 |
public void addCode(ByteCode code) {
bytecodes.add(code);
} | 0 |
public void incrementTime(int amount){
//increase elapsed time by one
elapsed_time += amount;
Process temp;
//increase wait time for each process in ready queue
Iterator<Process> it = readyQueue.iterator();
while(it.hasNext()){
temp=it.next();
if(cpuList.indexOf(temp) == -1){
temp.waitTime++;
... | 9 |
synchronized void updateMap(int intLocX, int intLocY)
{
DuskObject objStore;
LivingThing thnStore;
int i=0, i2=0, i3;
if (intLocX-viewrange<0) i = -1*(intLocX-viewrange);
if (intLocY-viewrange<0) i2 = -1*(intLocY-viewrange);
for (;i<mapsize;i++)
{
if (intLocX+i-viewrange<MapColumns)
{
for... | 9 |
public String getCollectionName(Object[] args) {
if (collectionIndex == -1) {
return globalCollectionName;
}
Object arg = args[collectionIndex];
if (arg == null) {
return globalCollectionName;
} else {
return arg.toString();
}
} | 2 |
@Override
public void drawShape(Graphics graphics) {
int thick = super.getThick();
int radius;
// x and y are the coordinates for the centre of the circle
int x, y;
// xn and yn is the first point the user clicked
// xm and ym is the second point the user cl... | 5 |
final boolean method2847(int i, Class348_Sub43 class348_sub43) {
try {
anInt8948++;
int i_37_ = 47 / ((i - -62) / 36);
if (((Class348_Sub43) class348_sub43).aClass348_Sub16_Sub5_7081
== null) {
if ((((Class348_Sub43) class348_sub43).anInt7087 ^ 0xffffffff)
<= -1) {
class348_sub43.removeN... | 6 |
public boolean execute(CommandSender par1Sender, Command par2Command,
String par3Args, String[] par4Args) {
if (par1Sender instanceof Player) {
String message;
Player player = (Player) par1Sender;
if (par4Args.length < 1)
message = i18n._("genericreason_afk" + (AFKWorker.isPlayerAFK(player) ? "" : "_r... | 4 |
@Override
public void createSomeObjects() {
this.addUser(new User("worker", "password", GroupType.WORKER));
this.addUser(new User("Gumby", "MyBrainHurts", GroupType.WORKER));
this.addUser(new User("manager", "password", GroupType.MANAGER));
ProductType pt = new ProductType("Skumbananer"), pt2 = new ProductType... | 7 |
public void updateBookType(String typeName, BookType bt) {
Connection conn = null;
Statement st = null;
//Do nothing if category is not properly instantiated
if(bt == null || bt.getTypeName() == null)
return;
try {
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&p... | 6 |
public void run() {
if (isRunning) {
return;
}
autoRunEnabled = true;
Object selectedItem = commandCombo.getSelectedItem();
String commandLine = null;
if (selectedItem == null) {
return;
} else {
commandLine = selectedItem.toStr... | 7 |
public static Map getRandomMapExcluding(List<String> ex){
List<Map> notexcluded = new ArrayList<Map>();
for(Map m : maps){
boolean match = false;
String name = m.getName();
for(String s : ex){
if(name.equals(s)) match = true;
}if(match == false){
notexcluded.add(m);
}
}
if(notexcluded.siz... | 5 |
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
} | 0 |
private void addTab(JPanel tab, String tabImagePath, int tabWidth, int tabHeight, int width, int height) {
tab.setBounds(width-tabWidth,(height/2)-(tabHeight/2),tabWidth,tabHeight);
BufferedImage TabImage;
try{
if(tab.getComponentCount() == 0){
TabImage = ImageIO.read(new File(tabImagePath));
Image sc... | 2 |
@Override
public void restoreCurrentToDefault() {cur = def;} | 0 |
public void updateGameSign() {
if (signLoc == null)
return;
if (EventHandle.callGameSignUpdateEvent(this, signLoc).isCancelled())
return;
Block block = null;
try {
block = plugin.getServer().getWorld(signLoc.getWorld().getName()).getBlockAt(signLoc);
... | 8 |
@Override
public String toString() {
StringBuilder s = new StringBuilder();
for (int p=0 ; p<listeGroupes.size() ; p++) {
Groupe groupe = listeGroupes.get(p);
// Liste des moyennes (par matières) pour ce groupe
float[] moyennesParMatieres = new float[20];
for (Integer numLigne : groupe.ge... | 5 |
public MyTimer() {
setLayout(new GridLayout(3, 0, 0, 0));
JButton btnCountUp = new JButton("Count Up");
btnCountUp.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MainFrame.cardLayout.show(getParent(), "MyTimerUp");
}
});
add(btnCountUp);
JButton btnCoun... | 0 |
public static void downloadfile(String DLURL, String DLDIR, String DLFILE) { //This downloads a mod given the url and the location/filename
String DLOC = DLDIR+DLFILE; //The dir to download to
new File(DLOC).getParentFile().mkdirs(); //Create parent dirs
System.out.println("URL: "+ DLURL);
System.out.println... | 4 |
protected void initialize() {
Robot.ledStrip.setColor(_red, _green, _blue);
} | 0 |
public static void main(String[] args) throws IOException {
String[] qps = {"22", "27", "32", "37"};
PsvdTest psvdTest = new PsvdTest(qps, args[0], args[1], args[2], args[3], args[4], args[5], args[6], new String("true"));
//make directories
psvdTest.makeDirectory("./common/bits");
... | 9 |
public static boolean isReservedLessThanOp(String candidate) {
int START_STATE = 0;
int TERMINAL_STATE = 1;
char next;
if (candidate.length()!=1){
return false;
}
int state = START_STATE;
for (int i = 0; i < candidate.length(); i+... | 5 |
public void onPickupFromSlot(ItemStack par1ItemStack)
{
ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix);
ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix);
this.func_48434_c(par1ItemStack);
for (int var2 = 0; var2 < this.craf... | 6 |
public void handleInteraction(Automaton automaton,
AutomatonSimulator simulator, Configuration[] configs,
Object initialInput) {
JFrame frame = Universe.frameForEnvironment(environment);
// How many configurations have we had?
int numberGenerated = 0;
// When should the next warning be?
int warningGener... | 9 |
private void freeResources(Socket socket, InputStream in, OutputStream out) {
if (out != null) {
try {
out.close();
} catch (IOException e) {
}
}
if (in != null) {
try {
in.close();
} catch (IOException e) {
}
}
if (socket != null) {
try {
socket.close();
} catch (IOExcepti... | 6 |
private void addButtonsListeners() {
btnAddPics.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
getSoundsPath(picsListModel);
}
});
btnAddSounds.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
getPicturesPath(soundsListM... | 5 |
public void addPeople(ArrayList<Villager> newPeople) {people.addAll(newPeople);} | 0 |
@Override
public String toString() {
return "FUNCTION " + functionName + " " + startLineNumber + " "
+ endLineNumber;
} | 0 |
public static void javaHelpOutputPrintStream(Stella_Object stream, Cons exps, boolean nativeWriterP, boolean endoflineP) {
if (stream == Stella.SYM_STELLA_JAVA_STANDARD_OUT) {
if ((Stella.string_getStellaClass("SYSTEM", false) != null) ||
Stella.inheritedClassNameConflictsP("SYSTEM")) {
((Ou... | 9 |
public String getLocalhost() {
return localhost;
} | 0 |
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
currentLevel++;
currentElement = true;
currentValue = "";
String name = null;
if (localName != null && localName.length() ... | 9 |
public void initAllCells() {
initCells();
initBorders();
initInsideFences();
initEnemies();
initPlayer(1);
if(p2) initPlayer(2);
} | 1 |
public HashMap<String, Multimap<String, Double>> call() throws Exception {
HashMap<String, Multimap<String, Double>> rt = new HashMap<String, Multimap<String, Double>>();
HypermodulesHeuristicAlgorithm ha = new HypermodulesHeuristicAlgorithm(this.stat, this.foregroundvariable, this.sampleValues, this.clinicalValues... | 7 |
static double[][] multiply(double[][] A, double[][] B){
double[][] AB = new double[A.length][B[0].length];
for(int i = 0; i < A.length; i++){
for(int j = 0; j < B[i].length; j++){
for(int k = 0; k < B.length ; k++){
AB[i][j] += A[i][k]*B[k][j];
}
}
}
return AB;
} | 3 |
private char[] charArrToUpperCase(char[] cArr) {
for (int i = 0; i < cArr.length; i++) {
cArr[i] = Character.toUpperCase(cArr[i]);
}
return cArr;
} | 1 |
@Override
public void addPool(ITicketPool pool) {
throw new UnsupportedOperationException();
} | 0 |
private static String[] tokenizeTransformation(String transformation)
throws NoSuchAlgorithmException {
if (transformation == null) {
throw new NoSuchAlgorithmException("No transformation given");
}
/*
* array containing the components of a Cipher transformation:... | 9 |
public int[] getInts(int par1, int par2, int par3, int par4)
{
int ai[] = parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
int ai1[] = IntCache.getIntCache(par3 * par4);
for (int i = 0; i < par4; i++)
{
for (int j = 0; j < par3; j++)
{
... | 7 |
public void addGateComponent(Component gateComponent) {
if (flowLayout) {
flowLayoutGatesPanel.add(gateComponent);
flowLayoutGatesPanel.revalidate();
flowLayoutGatesPanel.repaint();
}
else {
Component[] components = nullLayoutGatesPanel.getComponen... | 9 |
public String getDirFilterInclude() {
return this.dirFilterInclude;
} | 0 |
public BPTreeNodeItem getItem(int index){
if(getItemCount() > 0 && index < getItemCount())
return leafItems.get(index);
else
return null;
} | 2 |
public void visit(
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces)
{
this.version = version;
this.access = access;
this.name = name;
this.signature = sig... | 1 |
* @param str the string to search for
* @param start the index to start at (0 is good)
* @return the index at which the search string was found in the string list, or -1
*/
private static int strIndex(final Vector<String> V, final String str, final int start)
{
if(str.indexOf(' ')<0)
return V.indexOf(str,... | 9 |
public static int bin(int[] a, int from, int to,
int key) {
int left = from;
int right = to - 1;
while (left <= right) {
int mid = (left + right) >>> 1;
int mid1 = a[mid];
if (mid1 < key) {
left = mid + 1;
} else if (m... | 3 |
public void testProperty() {
LocalDateTime test = new LocalDateTime(2005, 6, 9, 10, 20, 30, 40, GJ_UTC);
assertEquals(test.year(), test.property(DateTimeFieldType.year()));
assertEquals(test.monthOfYear(), test.property(DateTimeFieldType.monthOfYear()));
assertEquals(test.dayOfMonth(), t... | 1 |
public void disconnect() {
if (state == CONNECTED) {
try {
mConnection.getOutputStream().write(Messages.disconnect());
// last_action = System.currentTimeMillis();
} catch (IOException e) {
if (DEBUG)
PApplet.println("Ohno! Something went wrong... IO Error, failed to send DISCONNECT message.");... | 8 |
public Type getHint() {
int hint = possTypes & hintTypes;
if (hint == 0)
hint = possTypes;
int i = 0;
while ((hint & 1) == 0) {
hint >>= 1;
i++;
}
return simpleTypes[i];
} | 2 |
public void unpackDat(File outFolder) throws IOException {
log.trace("Unpacking dat file " + datFile.getPath() + " into " + outFolder.getPath());
byte[] buffer = new byte[4096];
int bytesRead;
outFolder.mkdirs();
for (Map.Entry<String, InnerFileInfo> entry : innerFilesMap.entrySet()) {
String innerPath =... | 6 |
public Vector getObjects(String prefix,int cidmask,boolean suspended_obj,
JGRectangle bbox) {
Vector objects_v = new Vector(50,100);
int nr_obj=0;
JGRectangle obj_bbox = tmprect1;
int firstidx=getFirstObjectIndex(prefix);
int lastidx=getLastObjectIndex(prefix);
for (int i=firstidx; i<lastidx; i++) {
JGO... | 8 |
@Test
public void test_addition() {
int m = 2;
int n = 3;
Matrix m1 = new MatrixList(m, n);
Matrix m2 = new MatrixList(m, n);
Matrix m3 = new MatrixList(m, n);
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
m1.insert(i, j, (double) (2 * i + j));
}
for (int i = 1; i <= m; i++) {
... | 4 |
public Tex draw(int h, long scale) {
TexIM ret = new TexIM(new Coord(hist.length, h));
Graphics g = ret.graphics();
for(int i = 0; i < hist.length; i++) {
Frame f = hist[i];
if(f == null)
continue;
long a = 0;
for(int o = 0; o < f.prt.length; o++) {
long c = a + f.prt[o];
g.setColor(cols[o]... | 3 |
void paintOpacity(CPRect srcRect, CPRect dstRect, byte[] brush, int w, int alpha) {
int[] opacityData = opacityBuffer.data;
int by = srcRect.top;
for (int j = dstRect.top; j < dstRect.bottom; j++, by++) {
int srcOffset = srcRect.left + by * w;
int dstOffset = dstRect.left + j * width;
for (int i =... | 4 |
public int getScore(int player) {
int score = 0;
for (int piece : boardArray) if (piece == player) score++;
return score;
} | 2 |
void createColorAndFontGroup () {
/* Create the group. */
colorGroup = new Group(controlGroup, SWT.NONE);
colorGroup.setLayout (new GridLayout (2, true));
colorGroup.setLayoutData (new GridData (SWT.FILL, SWT.FILL, false, false));
colorGroup.setText (ControlExample.getResourceString ("Colors"));
colorAndFon... | 7 |
private boolean CharClass()
{
begin("CharClass");
if (!next('[')
&& !next("^[")
) return reject();
if (next(']')) return reject();
do if (!Char()) return reject();
while (!next(']'));
Space();
sem.CharClass();
return accept();
} | 5 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.