method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e7d126d4-92e0-4d10-9a84-832062eee25c | 6 | public static int loadTexture(BufferedImage image, boolean linearScaling, boolean repeat){
int[] pixels = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.... |
a4e49d3b-fc35-406e-a7a2-7af29dd30ed3 | 5 | private Statistics readStatFromFile()
{
String fileName = new String();;
List<ProcessStat> procStatList = new ArrayList<ProcessStat>();
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("statistics.txt");
// Get the object of D... |
7c24a5ac-6e7e-49c5-8c8c-c75d6ca5a8e2 | 8 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(label.equalsIgnoreCase("freeze")){
if (args.length == 0) {
if (sender.hasPermission("indeciple.freeze")){
if (plugin.hashmap.containsKey(sender)){
plugin.hashmap.remove(sender);
sender.sen... |
3698755d-dbe8-484e-af29-a3b96b99ac8f | 9 | public List getarticleList(int start, int end, int area) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
List articleList = null;
String sql = "";
try{
conn = getConnection();
/*추천지수 불러오는sql*/
sql = "update board set recommand_count = recommand - non_... |
970e0f37-01ce-41d2-9d70-4326e5ab96f4 | 2 | public static String getKey(String key) {
// CHROME WEBSOCKET VERSION 8中定义的GUID,详细文档地址:http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10
String guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
key += guid;
log.info(key);
try {
MessageDigest md = M... |
5e548ea2-0053-4ed1-96e2-9ad948385c9f | 0 | protected GameElement(Rectangle masse, IntHolder unit) {
super(masse);
this.unit = unit;
} |
f7c472a5-de1a-426e-ad05-13ba1a5dfcaf | 5 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
accountPanel = new javax.swing.JPanel();
accountLabel = new javax.swing.JLabel();
account = new javax.swing.JLabel();
TabPanel = ... |
9ca972df-dca9-4703-88b6-f8fc1bb2b63b | 3 | private final int getPackageCount( String packageName )
{
if ( packageName == null )
{
return 0;
}
int count = 0;
int index = 0;
while ( true )
{
index = packageName.indexOf( '.', index );
if ( index == -1 )
{... |
28eabc64-2a73-4031-94aa-63b53929ea07 | 6 | public ValidationProblem<Object, Default, Object, CharSequence> validate(
final Object instance, final Default annotation,
final Object target, final CharSequence value)
{
if(value == null || value.length() < 1)
{
try
{
... |
0f6351fd-a682-48ea-8c2d-92a0e0c7978b | 5 | public void runGA()
{
filenameBase = "GA_" + populationSize + "_" + iterations + "_" + crossoverRate + "_" + mutationRate;
//Init data files
initCSV();
initPlainFile();
for (int cIteration = 0; cIteration < iterations; cIteration++)
{
int... |
0e779a41-025b-4396-91e1-4a333e20f96f | 5 | private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
a.AgregarProceso(txtNombre.getText(), Integer.parseInt(txtRafaga.getText()));
if (a.getSizeArray() < 15) {
for (int i = 0;... |
46991477-d32b-4627-b745-457357fbed4e | 5 | public void computeValues(){
int aceCount = 0;
values.removeAll(values);
//Calculate initial value counting all aces as 11
values.add(0);
for(int i = 0; i < cards.size(); i++){
Card currentCard = cards.get(i);
values.set(0, currentCard.getValue() + values.get(0));
if(currentCard.getValue() == ... |
59a98c07-9a18-4a01-9c91-919cd65607e1 | 8 | private void drawMiter(final float pdx, final float pdy,
final float x0, final float y0,
final float dx, final float dy,
float omx, float omy, float mx, float my,
boolean rev)
{
if ((mx == omx && my =... |
09038e00-b41a-4116-a253-d977cb349156 | 7 | private static float maximum(float a, float b, float c, float d) {
if (a > b) {
if (a > c) {
return a > d ? a : d;
} else {
return c > d ? c : d;
}
} else if (b > c) {
return b > d ? b : d;
} else {
retur... |
b42dcd7b-4285-49b7-a2a3-6e906971e1b8 | 4 | @Override
public void setDir(int dir) {
switch(dir)
{
case 1:
posX++;
poly.setX(posX);
break;
case 2:
posX--;
poly.setX(posX);
break;
case 3:
posY++;... |
a47a24c4-af06-41ef-99e7-1afcfb986715 | 6 | public void mouseEntered(MouseEvent e) {
for(int i = 0; i < TOTALHEIGHT; i++){
for(int j = 0; j < TOTALWIDTH; j++){
if(e.getSource() == m_gridButtons[i][j]){
if(getGame().getPlayerTurn() % 2 == 0){
if(m_playerOne.getColour().equals("Black")){
m_gridButtons[i][j].setIcon(m_blackPiece);
... |
fc00bd8b-b274-4c91-a0a2-5af957113283 | 3 | private PatchScript runInstallPatch(DatabaseConnection pDatabaseConnection, String pPromoteUserName, String pPatchName)
throws ExInstaller {
String lInstallPatchString;
String lFileHash;
try {
lInstallPatchString = IOUtils.toString(getClass().getResourceAsStream(pPatchName));
lFileHash =... |
06cf3994-eb45-4039-a4bf-893855573d23 | 9 | * @param sym a symbol
*/
public Type asEnclosingSuper(Type t, Symbol sym) {
switch (t.tag) {
case CLASS:
do {
Type s = asSuper(t, sym);
if (s != null) return s;
Type outer = t.getEnclosingType();
t = (outer.tag == CLASS... |
bf90ec1d-9588-4e5b-9206-1b792e6b2802 | 8 | public void removeContext(IUndoContext context) {
boolean recompute = false;
// first check to see if we are removing the only context of the
// triggering operation
if (triggeringOperation != null
&& triggeringOperation.hasContext(context)) {
if (triggeringOperation.getContexts().length == 1) {
rem... |
a3df17a5-8f5a-4d2c-b7e2-8f82a24ef108 | 6 | public static void unZipIt (final String zipFile, final String outputFolder) {
final byte[] buffer = new byte[1024];
try {
//create output directory is not exists
final File folder = new File(outputFolder);
if(!folder.exists()){
folder.mkdir();
}
//get the zip file content
final ZipInputSt... |
b21c41a9-e9eb-4973-a0bc-9dd8c1b928c0 | 3 | public NumberDigitizer digitizerBy(final Integer aNumber) {
if (aNumber == null) {
throw new NonDigitizableNumberException("The number to conversion is null");
}
if (aNumber < 0) {
throw new NonDigitizableNumberException("The number to convert is negative");
}
... |
fc3ad78d-63de-4d67-891f-5b225bd5f23e | 6 | private static Point[][] get32PlayersPositions() {
int maxPlayers = 32;
Point[][] pos = new Point[8][128];
for(int i = 0; i < maxPlayers;i++ ){
pos [0][i] = new Point(0,2*i);
}
for(int i = 0; i < maxPlayers/2;i++ ){
pos [1][i] = new Point(2 ,1+4*i);
}
for(int i = 0; i < maxPlayers/4;i++ ){
pos [... |
d61f7f92-91af-435d-8373-18dc894f167a | 8 | private static void findUiBundleFields(HashMap<String, String> uiFields, NodeList childNodes,
String binderPrefix) {
for (int n = 0; n < childNodes.getLength(); n++) {
Node item = childNodes.item(n);
if (item.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) item;
... |
cf47bc6c-a627-49c2-805a-b007de366d82 | 2 | public static String convertToString(InputStreamReader isr) {
String sent = "";
try {
BufferedReader br = new BufferedReader(isr);
String line = br.readLine();
while (line != null) {
String str = line;
//sb.append(str);
... |
59fda8a9-9a75-4f35-b67a-ebed3959bb9b | 2 | public boolean removeAll(Object owner)
{
List<T> removed = providedByOwner.remove(owner);
if (removed == null)
{
return false;
}
for (T r : removed)
{
provided.values().remove(r);
}
return true;
} |
1d0c99ee-4da1-4818-bd99-a356eb5c724a | 1 | public int getAge(Date dateOfBirth) {
Calendar now = Calendar.getInstance();
Calendar dob = Calendar.getInstance();
dob.setTime(dateOfBirth);
int age = now.get(Calendar.YEAR) - dob.get(Calendar.YEAR);
if (now.get(Calendar.DAY_OF_YEAR) < dob.get(Calendar.DAY_OF_YEAR))
{
age--;
... |
38fce232-aaf7-42cb-983e-cf01344adb3f | 7 | public double[][] readData() {
String date;
double open;
int volume;
double yesterday = 0.0;
String[] back;
int dataPointer = 0;
try {
BufferedReader in = new BufferedReader(new FileReader("input1.txt"));
String zeile = null;
... |
d56486b8-8892-4653-a112-9b1e2ca30d83 | 6 | @EventHandler
public void SlimeHeal(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.getSlimeConfig().getDouble("Slime.Heal.DodgeCha... |
b154a31e-323f-4636-8444-2dc44af3e5bd | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.T... |
0f131c62-a028-490d-ac3d-bb59cf661741 | 2 | public void save() throws SQLException {
// create values
Map<String, String> values = new HashMap<String, String>();
values.put("username", username);
values.put("passwordHashed", passwordHashed);
values.put("isAdmin", this.isAdmin?"1":"0");
values.put("isRemoving", this.isRemoving?"1":"0");
values.pu... |
08a8dcc1-fb7c-4cfc-a560-0063a66f051a | 8 | private void boxConvert(List<ModelLoader> modelList, Map<GraphicsFont, List<Text.TextInstance>> text, ContextBox box) {
ModelLoader model = new ModelLoader();
//put vertices
// 0--------3
// | |
// 1--------2
model.vertices.put((float) box.x, box.y, 0);
model.vertices.put((float) box.x, ... |
3df9ccbe-6205-42a6-aa20-868f5a64f9b2 | 1 | public void save() {
try {
ImageIO.write(io, "png", new File("" + System.nanoTime() + ".png"));
} catch (IOException e) {
e.printStackTrace();
}
} |
3611ba4c-5972-4d7a-b84c-8949b2c64a36 | 5 | public static void main(String[] args)
{
String server, localuser, remoteuser, terminal;
RLoginClient client;
if (args.length != 4)
{
System.err.println(
"Usage: rlogin <hostname> <localuser> <remoteuser> <terminal>");
System.exit(1);
... |
a41e4bf1-fcda-412d-ab70-bac63fc22eaf | 5 | public void detect(){
AUnit u = getBoard();
UnitConfiguration unitConfig = u.getConfiguration();
double currentAngle = getMaxAngle() - u.getSpeedMs() * unitConfig.getMaxSpeedMs()/(getMaxAngle() - getMinAngle());
if(currentAngle>getMaxAngle()) currentAngle = getMaxAngle();
for(Position p:u.getPosition... |
671fb012-3e95-4479-bc2f-bfa178a8991c | 8 | @Override
public boolean equals(Object o) {
if (o instanceof Route) {
if (((Route) o).t1.equals(this.t1)
&& ((Route) o).t2.equals(this.t2)) {
// System.out.println(t1 + " " + t2 + " " + o + " OK");
return true;
} else if (((Route) o).t1.equals(this.t2)
&& ((Route) o).t2.equals(this.t1)) {... |
5d091d80-01ca-4530-830e-41e7a1196250 | 0 | public RemoveColumnHeaderRenderer() {
super(TEXT_NEW_ELLIPSIS);
} |
76783b66-a05f-4c74-a64f-9367fd22243a | 8 | public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof Type && ((Type) o).typecode == TC_CLASS) {
ClassInterfacesType type = (ClassInterfacesType) o;
if (type.clazz == clazz && type.ifaces.length == ifaces.length) {
big_loop: for (int i = 0; i < type.ifaces.length; i++) {
f... |
57fd896a-b36b-484d-a4af-7434b893c6a4 | 2 | public List<ArtificialSatellite> getArtificialSatellites() {
List<ArtificialSatellite> returnedSatellites = new ArrayList<ArtificialSatellite>();
for (Satellite satellite : satellites) {
if (satellite.getClass() == ArtificialSatellite.class) {
returnedSatellites.add((Artific... |
485734d8-8122-4adf-9485-c0e187d46ea8 | 9 | public void processKeyboard() {
boolean xSpeedCap = (+xvel < (Keyboard.isKeyDown(Keyboard.KEY_Z)? targetXSpeed_running : targetXSpeed));
if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
if (grounded) {
if (xSpeedCap) {
xvel += xAcceleration;
}... |
69127ebe-9130-4fe1-bfbd-b43ddad0980d | 4 | public static int getDashboardDistanceUnit() throws ClassNotFoundException {
int weightUnit = 0;
try{
//Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar");
Class.forName(driverName);
Class.forName(clientDriverName);
}catch(java.lang.ClassNotFound... |
8e1bd80f-4216-4fbd-987b-5edad1242967 | 5 | @Override
public void render(GameContainer gc, StateBasedGame s, Graphics g) throws SlickException {
super.render(gc, s, g);
Tile[][] tiledMap = super.getTiledMap();
for (int i = 0; i < tiledMap.length; i++) {
for (int j = 0; j < tiledMap.length; j++) {
Logger.log(super.getGrassImage()+"", "tiledMapTes... |
aa372b70-4335-49c6-bc7a-6f78151954fa | 0 | public void onStop() throws JFException {
} |
39435238-61ca-449d-aed9-c86c3541d179 | 8 | public ArrayList<String> autocomplete(String str) {
ArrayList<String> result = new ArrayList<String>();
str = str.trim();
if (str.charAt(0) == '-') {
if (str.length() == 1) {
for (Option o : options) {
result.add(String.valueOf(o.getShort()));
result.add("-" + o.getLong());
}
return resu... |
2ed408da-95dc-4e85-8786-3db6ed9d0ab4 | 8 | public Surrogate typeToWrappedType() {
{ Surrogate self = this;
if (((Stella_Class)(self.surrogateValue)) == null) {
{ Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
try {
Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
Stella.signalTranslat... |
04eda5ab-0816-4f01-b961-7bd624a8fe82 | 5 | private void logInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logInButtonActionPerformed
String password = new String(passwordField.getPassword());
int response = server.logIn(usernameField.getText(), password);
if(response == 102){
JOptionPane.showMessag... |
206d73f9-e7a6-41eb-9d9a-b3020bd039e5 | 0 | @InitBinder("entityForm")
protected void initSurveyListFormBinder(final WebDataBinder binder) {
binder.setValidator(entityFormValidator);
} |
221d75df-3c2e-4b48-8df4-6ec5884f3b65 | 5 | public boolean nextImage()
{
boolean b = false;
this.CurrentIndex += 1;
if ((this.Loop) && (this.CurrentIndex == this.Indexes.length)) {
this.CurrentIndex = 0;
}
else if (this.CurrentIndex < this.Indexes.length)
b = true;
if (this.CurrentIndex < this.Indexes.length)
{
if... |
d96e103e-b26c-4be9-b259-13387b1279ff | 9 | @Override
public void jouerEnForteresseDeGlace(Dieu deus, GeantDeGivre gdg, De de, DomaineDesMorts ddm, DemeureDesElfes dde, JFrame page) {
if (Dieu.pouvoirDieu) {
int forcedieu = deus.getFORCEINITIALE();
super.setPartieRestanteAjouer(super.getPartieRestanteAjouer() - 1);
... |
c83783d5-5267-42a9-855a-c1e8d7867d3e | 4 | private void predictFutureMemoryStatus() {
System.out.println("================= Future Memory Status =================");
//
// predict framework objects
//
System.out.println("## To-be-allocated framework objects");
if(reducer.getRunningPhase().equals("shuffle")) {
computeToBeAllocatedObjs();
}
/... |
b74fbb93-36b1-4658-ab40-27a690bcaa78 | 4 | public void addNewTab(final PropertyChangeListener propertyChangeListener) {
// If we create new tab first time, we have to copy text from the textArea
// of the TextEditorPane first, create a new tab for this text and only
// afterwards create a new tab
if (CurrentlyOpenTextFile.getInstance().getNumberOfAvaila... |
2ba6ccd2-225c-47a8-a2f1-a2eb69e9af15 | 4 | @Override
public int compare(Integer o1, Integer o2) {
double diff = dataArray[o2] - dataArray[o1];
if (diff == 0) {
return 0;
}
if (sortType == ASCENDING) {
return (diff > 0) ? -1 : 1;
} else {
return (diff > 0) ? 1 : -1;
}
} |
0ee87b47-6f86-4e98-9906-0657513c670b | 9 | public void printSpells() {
/*
* Initialisation stage
*/
String[] names = new String[spells.length]; //The array with the names of the spells
int[] tabs = new int[names.length]; //An array of the amount of tabs needed for each name of the spells
int maxLength = 0; //Largest length of characters in the ... |
99128d15-3552-4e97-be29-64fa35796ee0 | 2 | public static void load(ImageList list){
textures = new ArrayList<Texture>();
ArrayList<ImageTicket> tickets = list.getImageTickets();
for(ImageTicket tick : tickets){
if(tick.loadIntoOpenGL() == true){
add(tick.getName(), tick.getImage());
}
}... |
4a77ab8d-943b-417c-930a-8dcd4076bf73 | 0 | public void addPropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
} |
c1e64e8f-fa19-4c5e-9a01-1742ab604080 | 8 | public Object createObjectFromJsonElement(JsonElement value) {
if (value == null) {
return null;
}
if (value instanceof JsonPrimitive) {
JsonPrimitive primitive = (JsonPrimitive) value;
if (primitive.isBoolean()) {
return primitive.getAsBoolean();
}
if (primitive.is... |
dfe38c70-9141-474d-8514-f951609e4359 | 9 | private ByteBuffer readBufferRFC6455(boolean mask, ByteBuffer request) {
int min = mask ? 6 : 2;
if (request.remaining() < min) {
return null;
}
byte header1 = request.get();
byte header2 = request.get();
PayloadLengthType payloadLengthType = PayloadLengthTy... |
54d0cbd1-62d5-462c-affe-f089ee1a1dbc | 3 | * @param queryProperties the given query properties or null if the defaults are to be used
*/
public void initializeNamedInferenceProblemStore(final String name, final InferenceParameters queryProperties) throws IOException, CycApiException {
//// Preconditions
if (name == null) {
throw new NullPoint... |
7d7f7cee-4252-4ba9-b910-6689dd7fc56b | 7 | * @return boolean
*/
public static boolean falseP(Proposition self) {
{ TruthValue truthvalue = ((TruthValue)(Stella_Object.accessInContext(self.truthValue, self.homeContext, false)));
if (truthvalue == Logic.FALSE_TRUTH_VALUE) {
return (true);
}
else if (truthvalue == Logic.DEFAULT_... |
0b4029e2-7717-452e-9350-ad3e271f0bf1 | 1 | @Override
public void onGameOver(boolean won) {
MainMenu mainMenu = new MainMenu();
if (won) {
DbScoreboard scoreboard = new DbScoreboard();
long score = timer.getTimePassed();
scoreboard.add(score);
mainMenu.setScoreText(Timer.longToTimeString(score))... |
82cbcc9b-9434-44d8-b438-ff23ff84d78e | 0 | @Test
public void test_getXSize() {
assertNotNull(board);
assertEquals(xSize, board.getXSize());
} |
4a259c98-b0d2-4ee1-9de8-6f18a41792d7 | 5 | public MethodInfo getFieldSetter(FieldInfo finfo, boolean is_static)
throws CompileError
{
String fieldName = finfo.getName();
String key = fieldName + ":setter";
Object res = accessors.get(key);
if (res != null)
return (MethodInfo)res; // already exists.
... |
1b3cb776-b675-4f74-bc5d-d6665cad1194 | 1 | public static File getModulesDirectory(){
if(modulesDir == null)
modulesDir = new File(getWorkingDirectory(),"modules");
return modulesDir;
} |
5c4dbb24-dee3-4d31-8992-b9953203ffbe | 0 | public IncludeParser(String layoutFile) {
this.layoutFile = layoutFile;
} |
01dbc8f3-0816-4954-9c76-7d8f807d56e9 | 3 | public Set<String> getRequiredFiles(OperatingSystem os) {
Set neededFiles = new HashSet();
for (Library library : getRelevantLibraries()) {
if (library.getNatives() != null) {
String natives = (String)library.getNatives().get(os);
if (natives != null) neededFiles.add("launcher/" + library... |
03333ae1-0930-49c9-8b0d-d25a2bdf88b7 | 7 | private void setPoints(int row, int col, int color, int rowchange, int colchange)
{
int i = row, j = col;
while (true)
{
if (i < 0 || j < 0 || i > 7 || j > 7 || board[i][j] == EMPTY)
{
return;
}
else if (board[i][j] == color)
... |
334b2313-aed2-4da7-b156-42642b99425f | 7 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == b1) {
String naam = JOptionPane.showInputDialog(null,
"Voer loper naam in: ", "Naam invoeren",
JOptionPane.PLAIN_MESSAGE);
if ((naam != null) && (naam.length() > 1)) {
listModel.addElement(loop.voegLoperToe(naam) + ". " +... |
86f0f69a-461b-4170-a490-db7bd8be8c00 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final UsuarioSistema other = (UsuarioSistema) obj;
if (this.idUsuario != other.idUsuario) {
return ... |
703ce4f0-835e-4233-aa9f-f924ed0cb1a0 | 7 | public long nextPeriod()
{
final Calendar calendar=Calendar.getInstance();
calendar.add(Calendar.MILLISECOND, -calendar.get(Calendar.MILLISECOND));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
switch(this)
{
case HOU... |
a5233c7f-7aec-426a-9c1a-9898f2c5e66b | 5 | public static String pformat(Collection<?> c) {
if(c.size() == 0) {
return "[]";
}
StringBuilder result = new StringBuilder("[");
for(Object elem : c) {
if(c.size() != 1) {
result.append("\n ");
}
result.append(elem);
... |
bff95d0c-2c3b-483b-9f0d-2ec45a9fbebc | 9 | public static Stella_Object inheritPropositionArgument(Stella_Object argument, Proposition parent, KeyValueMap mapping) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(argument);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_PROPOSITION)) {
{ Proposition argument000 = ((Propositio... |
622c50fa-c7c3-4ccf-a5df-79d8fc5d1ff1 | 1 | @Override
public void bind() {
int offset = 0;
// 4 bytes per float
int stride = totalNumComponents * 4;
for(int i = 0; i < attributes.length; i++) {
VertexAttrib a = attributes[i];
buffer.position(offset);
GL20.glEnableVertexAttr... |
ac5451c2-53b6-4ea4-9288-252acf76bad2 | 4 | public void draw(Graphics g, Component comp, int offsetX, int offsetY) {
if (stale) {
updateComp();
updateImage();
}
Rectangle bounds = world.getBounds();
if (screen == null
|| screen.getWidth() != comp.getWidth()
... |
20fe46a7-32bc-44d5-ac72-d8a59856dfd5 | 9 | private void matchProcedureDeclarations() {
dispatchEvent(ParserEvent.BEGAN_PARSING_NON_TERMINAL_SYMBOL, "ProcDecl");
boolean hasReturnType = false;
ProcedureBuilder.getInstance().startBuilding();
SyntacticValidator.getInstance().matchNextToken(ProductionRule.REQUIRED, Reserved.Keyword.PROCEDURE);
Syntacti... |
c903b88b-eb7f-467e-8e7f-3872a88c546e | 9 | public void initNameStats() {
String otherName = null;
String thisName = null;
String input;
String output;
Boolean spec = false;
try {
while(thisName == null) {
input = inClient.readLine();
thisName = isName(input);
}
//sharedBoard.giveTheName(thisName, this.myPlayNum);
if(this.myP... |
773d8e6c-a382-49c9-9a6a-b13a82a771f1 | 6 | private void collisionCheck() {
if ( (ballY <= 0) || (ballY >= frameHeight - size - 22) )
ballSpeedY *= -1;//reverses y direction when the ball hits the sides
if (ballX < width) {
if ((new Rectangle(p1x, (int) playerY, width, height).contains(new Point((int)ballX, (int) ballY... |
b1039451-d778-4c63-af12-2ed2789e0825 | 9 | public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
if(o.equals(bRetour)){
frame.getContentPane().removeAll();
frame.getContentPane().add(new PanelMenu(frame));
frame.validate();
} else if(o.equals(bRechercher)) {
GregorianCalendar laDate = new GregorianCalendar();
GregorianCalen... |
1dbc3367-b3fa-4dfd-9686-823b2a1c31b1 | 3 | public int[] execute() {
/*
* Heuristics to improve performance: Reduce rows and columns by their
* smallest element, compute an initial non-zero dual feasible solution
* and create a greedy matching from workers to jobs of the cost matrix.
*/
reduce();
computeInitialFeasibleSolution();
greedyMatch(... |
af557ca8-408f-4e94-a3b6-b62b557aa7d0 | 6 | 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... |
27c9e608-bb45-4e52-b82b-7da525b08f83 | 2 | private int CountOne(String binaryString)
{
int countOne = 0;
for(int i = 0; i < binaryString.length(); ++i)
{
if(binaryString.charAt(i) == '1')
countOne++;
}
return countOne;
} |
77f01b12-db03-49ea-a8a1-4eb19f3963c7 | 8 | public Object invokeMethod(Reference ref, boolean isVirtual, Object cls,
Object[] params) throws InterpreterException,
InvocationTargetException {
if (!isVirtual && cls != null) /* XXX */
throw new InterpreterException("Can't invoke nonvirtual Method "
+ ref + ".");
Method m;
try {
String[] para... |
866a923c-bfd8-4532-92ee-7dc44b255b23 | 8 | private Document addElements(Document doc, Element currentElement,
GenericTreeNode<LayoutParserTreeElement> Node)
throws TransformerException {
Element child;
// Gaseste copiii nodului curent
List<GenericTreeNode<LayoutParserTreeElement>> children = Node
.getChildren();
Iterator<GenericTreeNode<Layou... |
0b719393-1da1-4e26-bae5-4e5e78da59f2 | 2 | public void resetLabels() {
AbstractInsnNode insn = first;
while (insn != null) {
if (insn instanceof LabelNode) {
((LabelNode) insn).resetLabel();
}
insn = insn.next;
}
} |
31215d24-9f95-4cc9-8269-d28fd3cd6d57 | 2 | public void useReserve() {
if(reserves >= 1) {
if(tank.isEmpty()) {
dead = false;
}
tank.setFuelLevel(tank.getFuelCapacity());
reserves--;
}
} |
1d3f87f7-a9aa-42ab-8bcb-929bb7fbbdf0 | 4 | @Override
public Object getValueAt(int row, int column) {
int index = 0;
for (final Pair<Boolean, String> entry : data) {
if (index == row) {
if (column == 0) {
return entry.getElement0();
} else if (column == 1) {
return entry.getElement1();
}
}
index++;
}
return null;
} |
57e50c48-9d6b-414f-88a5-01f44f4b6c7c | 6 | private void writeObject(JSONObject jsonobject) throws JSONException {
// JSONzip has two encodings for objects: Empty Objects (zipEmptyObject) and
// non-empty objects (zipObject).
boolean first = true;
Iterator keys = jsonobject.keys();
while (keys.hasNext()) {
if (probe) {
... |
169f4ecd-8325-4efb-8dcc-d38b5aab4cac | 8 | public void render(Graphics g) {
//Draw background
Image im = null;
try {
im = new Image("data/image/Pebbles.png");
} catch (SlickException e1) {
throw new NullPointerException("Pebbles.png does not exist!");
}
for (int x = 0; x < Constants.GAME_WIDTH; x += im.getWidth()){
for (int y = 0; y < Co... |
3619945e-4dda-43d3-b85f-f152fc8c9309 | 9 | protected double[] evaluateGradient(double[] x){
double[] grad = new double[x.length];
for(int i=0; i<m_Classes.length; i++){ // ith bag
int nI = m_Data[i][0].length; // numInstances in ith bag
double denom=0.0;
double[] numrt = new double[x.length];
for(int j=0; j<nI; j+... |
ddca4cb0-4785-4aed-a516-b27797a0c8bb | 8 | public void mergeInto(Type targetType)
{
if (targetType != null && targetType != this)
{
// merge constructors
for (Constructor constructor : this._constructors)
{
if (targetType.hasConstructor(constructor) == false)
{
targetType.addConstructor(constructor);
}
}
// merge propert... |
9084b9fa-7e50-49f0-8028-1ae93720d83f | 5 | private double[] getCumulativeWeights(List<Chromosome> fittestIndividuals){
double weightSum = 0;
for(Chromosome c: fittestIndividuals){
if(minimize){
weightSum += 1/c.getFitnessValue();
}else {
weightSum += c.getFitnessValue();
}
... |
2eff1381-ac4c-4832-9d73-ca4fc32e9c54 | 5 | public Tile getTileLayerCollision(Layer layer, int x, int y) {
if(x < 0 || y < 0 || x >= width || y >= height) return VoidTile;
if (CollTileIDS.get(layer.tiles[x + y * width]) != null) {
return CollTileIDS.get(layer.tiles[x + y * width]);
} else {
return EmptyTile;
}
} |
76f57248-154f-4254-a02d-82044814fd16 | 2 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String[] queue = plugin.queue;
if (args.length == 0) {
queue = new String[10];
sender.sendMessage("New queue created with size 5.");
}
else if (args.length == 1) {
int in = Integer.parseInt(args[0]) * 2;
queue... |
ee5c43dc-a46b-4d18-8689-303fc1d73ed5 | 4 | private String getCommand(String txt) {
String mes = txt;
String result = "";
// get payload
if (txt.contains("payload")) {
int tmpbeg = txt.lastIndexOf("payload");
tmpbeg = tmpbeg + 8;
String gamePlayerId = txt.substring(tmpbeg, tmpbeg + 3);
txt = txt.substring(tmpbeg + 3);
int tmpend = txt.inde... |
e319f427-90e1-459d-b1ba-79a7361821f3 | 7 | public int threeSumClosest_2(int[] num, int target) {
if(num == null || num.length < 3) return Integer.MAX_VALUE;
Arrays.sort(num);
int res = num[0]+num[1]+num[2];
int len = num.length;
for(int p = 0; p < len; ++p){
int i = p+1;
int j = len - 1;
... |
7881be85-6943-4f98-9805-bba6bdc4cbe2 | 2 | TreeNode next() {
TreeNode head = queue.poll();
if (head.left != null)
queue.offer(head.left);
if (head.right != null)
queue.offer(head.right);
return head;
} |
28109ff6-7e32-40b7-b8b1-16f3f5a589e1 | 6 | private static final void method2622(int[] is, int i, int i_11_) {
int i_12_ = anInt4105 + (i_11_ << 1);
if (anIntArray4107 == null || anIntArray4107.length < i_12_) {
int[] is_13_ = new int[i_12_];
for (int i_14_ = 0; i_14_ < anInt4105; i_14_++)
is_13_[i_14_] = anIntArray4107[i_14_];
anIntArray4107 ... |
245a9590-f6d4-4c3e-bca7-fb551364edfe | 4 | @Override
public synchronized void handlePeerReady(SharingPeer peer) {
ArrayList<Piece> choice = new ArrayList<Piece>(
SharedTorrent.RAREST_PIECE_JITTER);
BitSet interesting = peer.getAvailablePieces();
interesting.andNot(this.completedPieces);
interesting.andNot(this.requestedPieces);
logger.trace("Pe... |
51b87a04-4708-422e-91be-971e5db2d7c8 | 7 | @Override
public void run() {
try {
while(true) {
TimeStampMessage message = null;
// Check whether the config file has benn changed
String MD5 = ConfigParser.getMD5Checksum(configFile);
if (!MD5.equals(MD5Last)) {
... |
9376c393-820d-4b04-8658-97da24d64e1f | 5 | private static void alterRasterY2Gray(WritableRaster wr, int bitsPerComponent,
Vector decode) {
int[] values = new int[1];
int width = wr.getWidth();
int height = wr.getHeight();
boolean defaultDecode = (0.0f == ((Number) decode.elementAt(0)).flo... |
4d4bdb41-83c2-4763-a2ab-f0fbf980c49b | 9 | @Override
public void dump(Map<String, Object> into) throws IOException {
super.dump(into);
{
StringBuilder request = new StringBuilder(requestHeaders);
request.append(EOL);
if (requestExcerpt != null) {
request.append(new String(requestExcerpt, re... |
6dd538f9-55bb-4ae6-aed2-9bfe0260a801 | 8 | public boolean isMatch(RPMRequest req) {
if(req.name.equals(name)&&
req.arch.equals(arch)) {
if( (req.epoch.equals(RPMRequest.LATEST)||
req.epoch.equals(epoch)) &&
(req.version.equals(RPMRequest.LATEST)||
req.version.equals(version)) &&
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.