method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d9fed74c-43a3-472d-82bd-f7442aad2c7a | 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... |
219ddc81-d5a4-4192-aa52-d2d0690e317b | 2 | public void swapColors(int src, int dest) {
for (int i = 0; i < triangleCount; i++) {
if (triangleColors[i] == src) {
triangleColors[i] = dest;
}
}
} |
1d2702f9-f2bd-4890-b949-a10dfb196d50 | 4 | public boolean isStringValidForFk(String str)
{
char passChars[] = {
'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E',
'F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',
'U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i',
'j','k','l','m','n','o','p','q','r','s','t','u',... |
8386c59b-f987-4421-8414-dd81e63b2eac | 3 | public void removeItem(Item item) {
content[item.getPosX()][item.getPosY()].remove(item);
if (item instanceof BlockDestroyable) {
if (Math.random() > 0.8) {
if (Math.random() < 0.5) {
addItem(new BombUp(item.getPosX(), item.getPosY()));
} else {
addItem(new FireUp(item.getPosX(), item.getPosY()... |
1b7e0939-ca46-4d26-9570-5632832e7eb6 | 3 | public static String proccess(String line) {
String line2 = line.replaceAll("-", "");
while (!line2.equals(line)) {
line = line2;
line2 = line2.replaceAll("-", "");
}
String result = "";
for (int i = 0; i < line.length(); i++) {
if (Character.isDigit(line.charAt(i)))
result += (line.charAt(i) + "... |
7388e8ab-e727-4070-bd23-30cc58535ea5 | 8 | protected void updateMovement(float deltaTime) {
movementDirection.normalise();
movementDirection.scale(speed * deltaTime / 1000f);
Vector2f test = new Vector2f(location).add(movementDirection);
float rightLimit = world.getWidth() * world.getTileWidth();
float lowerLimit = world.getHeight() * world.getTileHei... |
f270e71e-cbcd-4717-bac0-31a117e0de29 | 4 | private double[] dichotCharToDouble(char[] responses){
boolean test0 = false;
int n = responses.length;
double[] converted = new double[n];
for(int i=0; i<n; i++){
boolean test1= false;
for(int j=0; j<this.nDichotomousC; j=j+2){
if(responses[i]==th... |
0aad8673-7a40-490e-8d7d-7989fc12281b | 0 | public void setEmail(String email) {
this.email = email;
} |
70c213a9-eb69-46df-902f-f777bc9ac7a6 | 0 | @Override
public String getClassName() {
return className;
} |
b739f018-f953-4a48-89da-e70ffab8285b | 8 | public static Change delete(final CourseRec record) {
Change change = new Change(record.getSource(), Change.DELETE, record) {
@Override
public String getDescription() {
return (record.isSelfStudy() ? "#" : "") + "Class";
}
@Override
public String getTarget() {
return "[" + record.getStatus() +... |
f9890f06-6faa-4116-9f93-fb717dc840b8 | 0 | public void setDough(String dough) { this.dough = dough; } |
621ad786-c322-4f6a-b7b7-cc147e99dcae | 1 | public List<AstronomicalObject> getElementsAsList() {
List<AstronomicalObject> objectList = new ArrayList<AstronomicalObject>();
for (AstronomicalObject element : elements) {
objectList.add(element);
}
return objectList;
} |
77cfb3d2-4d41-4f22-83d3-2eabc3344db9 | 1 | protected JTextField getSampleTextField()
{
if (sampleText == null)
{
Border lowered = BorderFactory.createLoweredBevelBorder();
sampleText = new JTextField(("AaBbYyZz"));
sampleText.setBorder(lowered);
sampleText.setPreferredSize(new Dimension(300, 1... |
7b4819ed-a2fc-4801-b62f-e8c91ef5e973 | 6 | public static void traverseTree(ArrayList<String> r, TreeNode root) {
if(root.isLeaf()){
int key = Integer.parseInt(r.get(indexOfClassLabel));
if(key == Integer.parseInt(root.getLeafAttribute())){
count++;
if(!prediction.containsKey(key))
prediction.put(key, 1);
else
prediction.put(key,... |
1f2f4892-e503-4e95-87c0-280c77d214e6 | 2 | void sendError(String errorString){
try {
JSONObject errorMessage = new JSONObject().put("error", errorString);
sendMessage(errorMessage);
} catch (JSONException f){}
catch (IOException g){}
} |
9665649e-e1fc-4226-960a-3cd80606d850 | 2 | private void addProvenance(RepositoryConnection connection, Resource tempContext) throws RepositoryException, QueryEvaluationException, MalformedQueryException, DatatypeConfigurationException, Exception {
// Get all the subjects we've added to the temp context
List<URI> mergedUris = this.getUrisInConte... |
7d71bc74-6d52-4837-b6c8-918075c8e68b | 3 | public Color getColor(float[] components) {
// the function couldn't be initiated then use the alternative colour
// space. The alternate colour space can be any device or CIE-based
// colour space. However Separation is usually specified using only one
// component so we must generate ... |
e8a7712c-f9a7-440c-a5eb-80b954c89fbe | 8 | public void init() {
// Set look & feel
try {
if (System.getProperty("os.name").toLowerCase().indexOf("mac") != -1) {
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Diffusion");
System.setProperty("apple.laf.useScreenMenuBar", "true");
... |
50eb08f3-6d36-4132-9384-a5bdda871665 | 1 | private
AbstractPage readCacheChild(Element childRef) throws ProblemsReadingDocumentException {
AbstractPage child = null;
String u = childRef.getAttributeValue("url");
String className = childRef.getAttributeValue("class");
try {
child = bakeAPage(className, u, getChildrenSaveTo(),this);
} catch (Ille... |
739ba350-e75e-45a9-845d-9c10beef41fa | 5 | protected DatePeriod parseDatePeriod(String[] words, int code)
throws MalformedDateException {
int toOffset = 0;
Date date1 = null;
Date date2 = null;
if (code == FROM)
for (int i = 1; i < words.length; i++) {
if (words[i].equalsIgnoreCase("TO")) {
toOffset = i;
break;
}
}
int fla... |
f4f292f2-abd2-4338-9025-796d0e5c23c2 | 3 | @Test
public void cTest3() {
userInput.add("hi");
userInput.add("my name is meng meng");
userInput.add("cavideria");
userInput.add("the second");
this.runMainActivityWithTestInput(userInput);
assertTrue((nlgResults.get(2).contains("cavideria") || nlgResults.get(2).contains("cafeteria"))
&& (nlgRe... |
00fe2573-ce0b-45de-ba74-3321b4d33458 | 3 | public String getDescription() {
StringBuffer sb = new StringBuffer();
int t = this.tapes();
for (int i = 0; i < t; i++) {
if (i != 0)
sb.append(" | ");
sb.append((String) toRead.get(i));
if (!blockTransition) {
sb.append(" ; ");
sb.append((String) toWrite.get(i));
sb.append(" , ");
s... |
bb17fce6-f00f-41d8-a1b7-7d2f4be7ff29 | 8 | @EventHandler
public void onPlayerUse(PlayerInteractEvent event) {
if (event.getItem() != null) {
if ((event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) && HeroesHandler.compare(event.getPlayer(), EnumSkill.getSkillFromMaterial(event.getItem().getType()))) {
switch ... |
852304cf-d28d-46a7-84f5-36847c0c0f6d | 2 | public boolean isSelectedDrag()
{
for(int i=0;i<markers;i++)
{
if(marker[i].isSelectedDrag())
{
return true;
}
}
return false;
} |
24056d73-f54d-4f0d-acfb-e0d9f1886e98 | 2 | public Game readGameInformation()
{
Game currentGame = null;
String fileName = "saveFile.txt";
File currentSaveFile = new File(fileName);
Scanner fileReader;
int gameRanking = 0;
String gameTitle = "";
ArrayList<String> gameRules = new ArrayList<String>();
try
{
fileReader = new Scanner(currentSa... |
f3bb6694-1aee-45a1-b280-24511ec20719 | 9 | @Override
public int castingQuality(MOB mob, Physical target)
{
if((mob!=null)&&(target!=null))
{
if(!(target instanceof MOB))
return Ability.QUALITY_INDIFFERENT;
if(mob.isInCombat())
return Ability.QUALITY_INDIFFERENT;
if(CMLib.flags().canBeSeenBy(mob,(MOB)target))
return Ability.QUALITY_IND... |
9283d02f-9486-48f1-ac9a-e0ad12af0f17 | 5 | *
* @since 3.2
*/
public void setSortDirection (int direction) {
checkWidget ();
if (direction != SWT.UP && direction != SWT.DOWN && direction != SWT.NONE) return;
sortDirection = direction;
if (sortColumn == null || sortColumn.isDisposed ()) return;
sortColumn.setSortDirection (sortDirection);
} |
30803165-0688-49e5-9db4-633c78e1800b | 8 | public static Stella_Object accessQuerySolutionTableSlotValue(QuerySolutionTable self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Logic.SYM_STELLA_THE_MAP) {
if (setvalueP) {
self.theMap = ((KeyValueMap)(value));
}
else {
value = self.theMap;
}... |
7141f394-4e83-4426-bf05-d9b36e6a1b6e | 5 | public void checkFile() {
if (openedFile == false) {
if ((summaryFileName != null) && (fpath != null)) {
String fileName = fpath + "/" + summaryFileName;
System.out.println("Writing summary file to " + fileName);
summaryFile = new File(fil... |
7afb8708-40a0-400d-bf3a-174a9e76f01b | 3 | public double getCircumference() {
if (circumference == -1) {
circumference = ProjUtils.circumEllipse((w >= h) ? w/2 : h/2, (w >= h) ? h/2 : w/2);
}
return circumference;
} |
ab7c0d74-1a06-4dbf-9383-b353f6361e7a | 2 | private void addElement(String element, String contact) {
int indexOfItem = getItemIndexByElementName(element);
if (indexOfItem == -1) { // add a new element
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText(element);
if (!"-1".equals(contact))
{
... |
e4a743a5-734a-4079-9b27-897ac3c468ae | 1 | public static void setPropertyAsInt(PropertyContainer container, String key, int value) {
if (container != null) {
container.setProperty(key, new Integer(value));
} else {
throw new IllegalArgumentException("Provided PropertyContainer was null.");
}
} |
c4490db0-db22-4b02-859a-384839f403bb | 0 | public FieldQuestView() {
super();
setSize(PANEL_WIDTH, PANEL_HEIGHT);
googlePanel = new GoogleMapPanel(616, 329);
// GoogleMap Listeners, labels etc
googlePanel.addMouseListener(googlePanel);
googlePanel.addMouseMotionListener(googlePanel);
googlePanel.addMouseWheelListener(googlePanel);
googlePanel.a... |
9333fdf3-9d80-4eb0-ac77-8d29409bc333 | 0 | public void setErrors(List<String> errors) {
this.errors = errors;
} |
eabe6331-a699-4eca-911f-c763e31749e3 | 6 | static final void method121(int i, int i_6_, boolean bool, int i_7_,
int i_8_, int i_9_) {
if (i_6_ != -364570972)
anInt70 = -4;
anInt68++;
long l = (long) (i | (!bool ? 0 : -2147483648));
Class348_Sub13 class348_sub13
= ((Class348_Sub13)
Class348_Sub40.aClass356_7041.get(l));
if (class348_su... |
ba6fde80-96ce-43d4-81a6-88b3058810e4 | 3 | public Resolution updateCartQuantities() {
HttpServletRequest request = context.getRequest();
Iterator<CartItem> cartItems = getCart().getAllCartItems();
while (cartItems.hasNext()) {
CartItem cartItem = (CartItem) cartItems.next();
String itemId = cartItem.getItem().getItemId();
try {
... |
5e26d127-7568-47a4-b05c-7ec6b64ad2e5 | 5 | public void draw(Graphics g) {
//worldData.drawWorld(g, camera.getX(), camera.getY());
int camx = camera.getX();
int camy = camera.getY();
WorldTiles worldTiles = worldData.getWorldTiles();
Sprites sprites = entityData.getSprites();
for (int x = 0; x < worldData.getWorldD... |
c3ea2ebb-e6db-4417-8dbf-d7a8ea2ebf3a | 4 | public void archiveDepartingVehicles(int time, boolean force)
throws VehicleException, SimulationException {
ArrayList<Vehicle> departingVehicles = new ArrayList<Vehicle>();
for (int i = 0; i < spaces.size(); i++) {
// Check to make sure vehicle is parked, throw exception if not
if (spaces.get(i).isParked... |
e21679d1-f5b0-4bfb-bf48-35163cf8973f | 7 | public static Table parse(File input)
throws IOException
{
List<String> towns = new ArrayList<String>();
List<int[]> distances = new ArrayList<int[]>();
BufferedReader br = null;
try {
br = new BufferedReader(new InputStreamReader(
new FileInputStream(input), "UTF8"));
String line;
boolean part1... |
0e38cfb1-dd72-4491-a3eb-23c00e6bd8dc | 1 | private void jButton54ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton54ActionPerformed
isCtrl=!isCtrl;
if( isCtrl==true )
ctrlOn();
else
ctrlOff();
}//GEN-LAST:event_jButton54ActionPerformed |
6f029828-4a0e-4077-b952-05c50de9cd07 | 1 | public void addHighscore(final logic.Highscore score) {
// "Naam", "Prijzengeld", "Tijd over"
Element elHighscore = new Element("highscore");
elHighscore.addAttribute(new Attribute("naam", score.getSpelerNaam()));
elHighscore.addAttribute(new Attribute("score", score.getScore()));
elHighscore.addAttribute(new... |
4b669a23-f6f4-4762-a091-1645ae044dd8 | 1 | public void stop()
{
log.info("Stopping PostResult2Qc thread executor.....");
try {
postResult2QcThreadExecutor.interrupt();
postResult2QcThreadExecutor.join();
log.info("PostResult2Qc thread executor stopped successfully");
} catch (Exception ex) {
log.error("Go... |
4570f22f-940e-4dbd-b09f-fe3d373ae044 | 8 | private void printData(){
// Add all ages to List.
ArrayList<Integer> ages = new ArrayList<Integer>(myPers.size());
for(Person pers : myPers) {
ages.add(pers.getAge());
}
// Calculate average age
int ageSum = 0;
int ageAverage;
for(int i = 0; i < myPers.size(); i++) {
ageSum += ages.ge... |
25c92385-4c43-42c9-b8ef-829bea7186b3 | 6 | private double[] checkWeights(double[] weights){
// Make all weights positive and check if all zero
int nZeros = 0;
for(int i=0; i<this.nWeights; i++){
weights[i] = Math.abs(weights[i]);
if(weights[i]==0.0)nZeros++;
}
// if all zeros replace all by unity
... |
0f078e2d-b85a-4a5b-ad38-d78fd96938b4 | 9 | private void await() {
if (serverSocket == null) {
return;
}
// Loop waiting for a connection and a valid command
while (true) {
// Wait for the next connection
Socket socket = null;
InputStream stream = null;
try {
... |
c8f44281-4cd1-422c-af90-cbcc589383e9 | 4 | public String toMorse(String text)
{
String result = "";
int charToMorseLength = CHAR_TO_MORSE.length;
StringCharacterIterator iterator = new StringCharacterIterator(text);
char character = Character.toUpperCase(iterator.first());
while (character != StringCharacterIterator.DONE)
{
int... |
9445df06-345f-401b-ae1a-82a35c5aa2f5 | 1 | protected void createReaderWriter() throws JoeException {
// try to create an appropriate reader-writer
ourReaderWriter = new PdbReaderWriter() ;
// if we fail ...
if (ourReaderWriter == null) {
throw new JoeException(UNABLE_TO_CREATE_OBJECT) ;
} // end if
} // end protected method PdbReaderWriter |
a525aba9-b066-4962-bb9a-3c5cddcf486f | 4 | public int getBottomY(Container parent) {
int y = 0;
Component[] components = parent.getComponents();
for (int index = 0; index < components.length; index++) {
Component component = components[index];
if (!bottomComponents.contains(component) && !bottomCenter.contains(component)) {
if (y < component.get... |
87429f35-faff-4752-b682-e4da199e0868 | 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... |
0b2ff2ff-e332-4147-bd59-b3fad2d0aa78 | 7 | public static boolean searchMatrix(int[][] matrix, int target) {
if (matrix == null || matrix.length == 0 || matrix[0].length == 0)
return false;
if (target < matrix[0][0])
return false;
int row = search(matrix, target);
int i = 0;
int j = matrix[row].length - 1;
while (i <= j) {
... |
04ab8ff5-f377-4056-8ab2-e51cf5c7d188 | 4 | private void configure(Document mediaRendererXML) throws IOException, SAXException{
name = XMLTool.search(mediaRendererXML, "friendlyName").getFirstChild().getNodeValue();
Node serviceList = XMLTool.search(mediaRendererXML, "serviceList");
for(Node service = serviceList.getFirstCh... |
94ca9b4d-dd91-4b61-a279-41fa029067d9 | 9 | public SNMP_Request( SNMP_DataType dataType, SNMP_ReqType reqType,
String oid, String communityString, byte[] setData)
{
request_id ++;
reqId = request_id;
this.reqType = reqType;
this.dataType = dataType;
... |
fdbf4287-cd13-41ca-a50a-016e8f932d38 | 2 | public void Reserve(int isbn, int user_id) throws IOException {
int flag=0;
for(int i=1;i<=5;i++)
flag=B[i].Reserve(isbn,user_id);
if(flag==1)
System.out.println("\nThank You! Enjoy the book\n");
else
System.out.println("\nSorry we dont have that bo... |
9ee9cb83-2e8a-4327-920f-57bd794bb2d8 | 7 | public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
else
{
if (ForgeHooks.onUseHoe(par1Item... |
be4aef3a-4781-40bc-aabf-7e041b3c48da | 8 | @Override
public boolean validate(final ValidationContext ctx, final Object value) {
boolean validates = false;
if (this.numberType.contains(NumberType.ntInteger)) {
try {
Integer.parseInt((String) value);
validates = true;
} catch (final Exception e) {
}
}
if (this.numberType.contains(NumberT... |
1c2be93f-db3c-41dd-930d-75e5f60dd8cb | 4 | private static Items sequentialSearch(ItemList lm,
String target, Items[] items) {
Items retVal = null;
System.out.println("Searching for " + target + ".");
int counter = 0;
//Items currentItem = new Items();
Items currentItem = lm.g... |
866ad033-af69-4c6e-8eec-8fa454afa9a1 | 8 | public static boolean readEdges(String name) {
InputStream is = null;
int start;
int end;
float etx;
float rate;
float mtm;
float ett;
Tools.reevaluateConnections();
try {
is = new FileInputStream(name);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printSta... |
7ccca538-3cef-442b-a110-e60ed789cc58 | 1 | private boolean jj_3_21() {
if (jj_3R_38()) return true;
return false;
} |
d5b00327-6a1e-49c3-9036-54e4b07ea40c | 4 | public static byte menuprincipal(){
byte op=0;
do{
System.out.println("1 Abrir cuenta bancaria");
System.out.println("2. Consultar saldo cuenta bancaria");
System.out.println("3. Extraer dinero cuenta bancaria");
System.out.println("4. Ingresar dinero cuenta bancaria");
System.out.println("5. Salir");
... |
d75ac725-20c8-44fc-882f-c87b9bba3cb2 | 2 | public void sortConfectionBySugar() {
Collections.sort(confections, new Comparator() {
public int compare(Object ob1, Object ob2) {
Confections co1 = (Confections) ob1;
Confections co2 = (Confections) ob2;
if (co1.getSugar() > co2.getSugar()) {
... |
fcbd8bf1-46d9-48c4-9ae2-7374c0da1dd9 | 5 | @Override
protected boolean doFirstPhase(String query, Configuration conf, String outputPath, String[] table) {
try {
// global information
DistributedCache.addCacheFile(new URI(FULL_PATH_COLUMN), conf);
DistributedCache.addCacheFile(new URI(FULL_PATH_FILTER), conf);
DistributedCache.addCacheFile(new... |
c963a57d-ad89-470a-af56-2eb138e68ec9 | 8 | public FileCompress(String[] args) throws IOException, FileNotFoundException, Exception, NumberFormatException {
this.suspending = false;
this.finished = false;
File srcFile = new File(args[0]);
File dstFile = new File(args[1]);
if (!srcFile.exists()) {
System.out.println("\t\t\tFileComress():\tusage:\trun... |
a9ae375d-3d3a-47f9-8212-8dc41c567c81 | 7 | private void jButtonAddCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAddCustomerActionPerformed
//A lot of error handling, to prevent wrong information in the database.
if ("".equals(Fnamefield.getText()) || "".equals(Snamefield.getText()) || "".equals(Countryfield.ge... |
e47a8e91-7e40-4299-a607-27b44e1153cc | 7 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityDamage(EntityDamageEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player && ((Player)entity).isOnline()) { // player taking damage
xAuthPlayer xp = plyrMngr.getPlayer(((Player)entity).getName());
... |
7a8d3558-a960-4d3a-b8d8-cc85593ef783 | 9 | public void revealNearbyEmptyFields(final int row, final int column) {
final List<Position> positions = new ArrayList<Position>();
positions.add(new Position(row, column));
for (int i = 0; i < positions.size(); i++) {
final Position pos = positions.get(i);
/*
* add nearby hidden empty fields to queue... |
f7d79890-7f28-4f64-81e1-1cc3509115d1 | 5 | private void generateMarkerAndCode() {
final Messager messager = environment.getMessager();
final AnnotationTypeDeclaration annoDecl = (AnnotationTypeDeclaration) environment
.getTypeDeclaration(Cardinal.class.getName());
final Collection<Declaration> annotatedTypes = environm... |
ee0d57e7-bfcb-4603-b226-9aca1acdca71 | 5 | @EventHandler
public void onBlockBreak(BlockBreakEvent event){
Player eventPlayer = event.getPlayer();
if(eventPlayer.getItemInHand()!=null){
if(eventPlayer.getItemInHand().equals(plugin.tool)){
event.setCancelled(true);
return;
}
}
if(event.getBlock().getState() instanceof Sign){
Sign sign... |
71d38e3d-4b85-4b26-8430-ecb89010be7c | 9 | private String findKey(String word){
StringBuilder key = new StringBuilder();
String currentChar = "";
for(int i=0;i<word.length();i++){
currentChar = String.valueOf(word.charAt(i));
if(CommonConstants.NUMBER_2.contains(currentChar)){
key.append(2);
}
el... |
fe20f12e-11c1-4fe9-b149-7895b678d8c9 | 3 | public NetInterface() {
listeners = new ArrayList<NetListener>();
unicastStreams = new TreeMap<Address, ObjectOutputStream>();
unicastReceiver = new UnicastReceiver(this, UNICAST_PORT);
try {
Thread.sleep(LISTEN_DELAY);
} catch (InterruptedException e) {
e.printStackTrace();
}
broadcastReceiver = ne... |
4178b74d-3f0e-4b8f-be6a-b9378aa9f10a | 1 | public JSONArray optJSONArray(int index) {
Object o = this.opt(index);
return o instanceof JSONArray ? (JSONArray) o : null;
} |
0f4e95d3-cb45-4150-b25a-478677b7155e | 0 | private void ok() {
docSettings.setUseDocumentSettings(true);
applyChanges();
hide();
} |
8d53ef2f-642a-4b7d-8d23-b54a42bba33f | 3 | public static HashMap<String, Object> getStyleMap(String style, String asig)
{
HashMap<String, Object> styleMap = new HashMap<String, Object>();
String key = "";
String value = "";
int index = 0;
if (!style.equals(""))
{
String[] entries = style.split(";");
for (String entry : entries)
{
i... |
523bd3d6-c0d9-47a6-89d3-077f105525ae | 4 | public void encrypt(String plaintext){
List<BigInteger> plaintext_list = String2BigInteger(plaintext);
List<ElGamal_ciphertextblock> c = new ArrayList<ElGamal_ciphertextblock>();
for(BigInteger plainblock: plaintext_list){
// -------------------------
// -- Hier programmieren ---
// ---------------------... |
23794745-acb7-4ae5-9319-c87f4b0d45de | 5 | public byte[] getFileBytes(short fid) {
byte[] result = filesBytes.get(fid);
if (result != null) {
return result;
}
InputStream in = getInputStream(fid);
if (in == null) {
return null;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[256];
while (true) {
try {
... |
263f3599-c382-45dc-8b56-db104e3f6d10 | 8 | @Override
public void set(final LedColor... colors) {
int red = 0, yellow = 0, green = 0, blue = 0, white = 0;
for (final LedColor ledColor : colors) {
switch (ledColor) {
case RED:
red = 1;
break;
case YELLOW:
yello... |
a482dfb9-a6c7-408a-8384-eb7ac1d5a535 | 8 | final public void Class_extend() throws ParseException {
/*@bgen(jjtree) Class_extend */
SimpleNode jjtn000 = new SimpleNode(JJTCLASS_EXTEND);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(EXTENDS);
Class... |
c05f6fbe-2752-416c-9c17-170885595951 | 2 | public DetailsPanel(Canvas canvas) {
this.canvas = canvas;
ChooseLayerListener layerListener = new ChooseLayerListener(canvas);
for (int i = 0; i < 4; i++) {
layers[i] = new JButton(String.valueOf(i + 1));
layers[i].addActionListener(layerListener);
}
layers[0].setBackground(Color.GRAY);
chooseColor... |
f8266e40-37ed-453a-bd92-c1588f7d1083 | 9 | public static void multiplicatoria(TreeMap<Integer, Integer> raiz) {
TreeMap<Integer, Integer> casa = (TreeMap<Integer, Integer>) raiz
.clone();
for (Entry<Integer, Integer> entry : casa.entrySet()) {
if (entry.getKey() < 500 && !arr[entry.getKey()])
continue;
int i = 0;
for (i = 0; i < primos.leng... |
6c57f887-a164-4670-9776-1ba836829a7c | 1 | public static void main(String[] args) {
try{
IEncrypterDecryptor ed = EncrypDecryptFactory.getInstance(ALGORITHMS.TRIPLEDES);
String plainText = "This is testing ";
System.out.println("Before encryption : "+ plainText);
plainText = ed.encryptData(plainText);
System.out.println("after encryption : "... |
65f9a75d-3c9a-4198-b32b-3ed997bc1641 | 8 | private static User convertRowToUser(final Row row) {
final User u = new User();
if (row.getString("username") != null) {
u.setUsername(row.getString("username"));
}
if (row.getString("password") != null) {
u.setPassword(row.getString("password"));
}
if (row.getString("email") != null) {
u.setEmail... |
1a40fb9e-9c9f-4dc8-b2e8-0bd20b32e88c | 1 | private void unfoldFirst() {
TreeNodePageWrapper target = (TreeNodePageWrapper)tree.getModel().getRoot();
try {
target = (TreeNodePageWrapper) target.getFirstChild();
tree.expandPath(new TreePath(target.getPath()));
} catch (NoSuchElementException e) {
e.printStackTrace();
}
} |
e2d027f1-cc82-47ec-8971-e213df160937 | 5 | public void disconnectProxyUser()
throws SQLException {
if(mIsProxyConnectionActive || mIsSysDBAConnectionActive){
if(isTransactionActive()){
safelyRollback();
throw new ExFatalError("Attempted to disconnect from user " + currentUserName() + " but a transaction is still active");
... |
509272f6-7ad3-4049-8c74-da22b8d8cb80 | 4 | public int getBlue(int x, int y) {
int value = 0;
if ((x >= 0) && (y >= 0) && (x < im.getWidth()) && (y < im.getHeight())) {
value = ((im.getRGB(x, y) >> 0) & 255);
}
return value;
} |
9fd75021-0ebd-4cd4-b425-c0cbe7e61259 | 0 | public static Hand FourOfAKind(Rank quadsRank, Rank firstKicker) {
return new Hand(HandRank.FourOfAKind, null, quadsRank, firstKicker, Rank.Null, Rank.Null, Rank.Null);
} |
3f012fec-009f-4b93-b6e3-7fa563e021f9 | 4 | public String getActions() {
String actions = "{\"actions\":[";
Iterator<Action> iterator = this.actions.values().iterator();
while (iterator.hasNext()) {
Action action = iterator.next();
String sen = "{\"action\":\"" + action.getName() + "\", \"args\":[";
for (int i = 0; i < action.getArgs().length; i++... |
f21a185a-7b59-493c-8021-f328b9382641 | 7 | @SuppressWarnings("unchecked")
private void buildConstructorMap() {
for (Class<? extends IPlugin> p : pluginLoader.getPluginClasses()) {
Constructor<? extends ICreature> c = null;
try {
c = (Constructor<? extends ICreature>)
p.getDeclaredConstructor(IEnvironment.class, Point2D.class, double.class... |
0618d25a-e86f-4d4c-ad9d-77134bf3f3ca | 4 | public void setCurrentOption(int value){
if( value >= 0 && value < this.menuStr.length){
this.currentOption = value ;
}else if( value == this.menuStr.length){
this.currentOption = 0 ;
}else if( value < 0 ){
this.currentOption = this.menuStr.length - 1 ;
}
} |
326ca3bc-bdc2-430b-9bec-185d2e98999b | 2 | private void inv3ActionPerformed(java.awt.event.ActionEvent evt)
{
if(!game.getInBattle())
{
outputText.setText(game.useItem(2) + "\n" + game.getCurrentRoom().getExitString());
if(game.itemRemoved())
inv3.setText... |
bf543f7d-2295-4611-b145-d573f4ec97af | 4 | public void setSubmit(JButton button, final AddMediaDialog dialog) {
button.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt) {
@SuppressWarnings("rawtypes")
Hashtable table = dialog.getValues();
dialog.setVisible(false);
album = new Album("", "", "", 0);
movie = n... |
265efe7b-6960-4a63-a4ce-031c2e2696b3 | 3 | public static void processChunk(BlockState[] blocks){
for(BlockState b: blocks){
if(b instanceof DoubleChest){
addDoubleChest((DoubleChest)b);
}else
if(b instanceof Chest){
addChest((Chest)b);
}
}
} |
032473bd-6c80-4165-b37f-323f04f1198e | 6 | public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new FillLayout());
GLData data = new GLData();
data.doubleBuffer = true;
final GLCanvas can... |
b1e2b025-b2d5-4613-81d0-ac6f6e83a134 | 0 | public void setSoundNarration(int soundNarration)
{
this.soundNarration=soundNarration;
} |
ca61a357-61eb-49f7-9609-cfa74d84a32e | 7 | public boolean delete(Node n) {
// case 1
if (head == null)
return false;
if (head.equals(n)) {
// case 2
if (head.equals(tail)) {
head = null;
tail = null;
} else {
// case 3
Node newHead = head.next;
head.next = null;
head = newHead;
}
return true;
}
Node temp = he... |
92307a22-bfef-494e-8e2b-69d3baaecd3a | 2 | @Test
public void testGetGenes() {
List<Double> genom1=g1.getGenes();
List<Double> genom2=g2.getGenes();
List<Double> genom3=g3.getGenes();
for (int i=0; i<genom1.size(); i++)
{
assertTrue("One-parented genotype have different gene than it's parent", genom1.get(i)==genom2.get(i));
assertTrue("Two-paren... |
6957b151-bb3f-4d24-99b8-f5a09c4bde54 | 9 | @Override
public void spring(MOB target)
{
trapped=null;
if((target!=invoker())&&(target.location()!=null))
{
if((!invoker().mayIFight(target))
||(isLocalExempt(target))
||(CMLib.flags().isInFlight(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))
||(target==invoker())
... |
dafded24-cbb9-43ef-a6d1-9d3eba3bd43b | 8 | * @param tile a <code>Tile</code> value
* @param item a <code>TileItem</code> value
*/
private void drawItem(Graphics2D g, Tile tile, TileItem item) {
if (item instanceof Resource) {
Image bonusImage = lib.getBonusImage(((Resource) item).getType());
if (bonusImage != null)... |
6229f5bb-7376-438a-aa72-6b2611f08a38 | 9 | double calculatescore() {
total = 0;
for (int i = 0; i < seedlist.size(); i++) {
double score;
double chance = 0.0;
double totaldis = 0.0;
double difdis = 0.0;
for (int j = 0; j < seedlist.size(); j++) {
if (j != i) {
totaldis = totaldis
+ Math.pow(
distanceseed(seedlist.g... |
cc359d7d-5b9e-4c57-83a3-2c822cdd8e79 | 7 | public void miseEnEcoute()
{
SocketChannel client = null;
Selector selector = null;
try
{
selector = Selector.open();
serverChannel.register(selector, SelectionKey.OP_ACCEPT);
}
catch (IOException e1)
{
e1.printStackTrace();
}
while (true)
{
try
{
System.out.println("Attente ...... |
ee5f995d-8cf3-4a3b-9b87-9abed4b84990 | 2 | public void popularCbEncarregado() {
ArrayList<String> Encarregado = new ArrayList<>();
UsuarioBO EncarregadoBO = new UsuarioBO();
try {
Encarregado = EncarregadoBO.ComboBoxEncarregadoPorDepartamento(UserLogado.getDepartamento().getCodigo());
} catch (SQLException ex) {
... |
f0b2c499-5f0e-4936-85db-f55b338be72d | 8 | public HashedMap<ByteChars, java.util.ArrayList<ResourceData>> loadRootServers(com.grey.logging.Logger logger)
throws com.grey.base.ConfigException, javax.naming.NamingException, java.io.IOException
{
HashedMap<ByteChars, java.util.ArrayList<ResourceData>> roots = new HashedMap<ByteChars, java.util.ArrayList<Reso... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.