method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
41cfa971-6617-40fd-8ca0-3d3cde05effe | 2 | public void performAction(final ActionEntity actionEntity) {
for (Entity e : entities) {
if (e instanceof ActionListenerEntity)
((ActionListenerEntity) e).actionPerformed();
}
} |
3dbdee16-0b93-4ddf-aa13-fd2782a7522b | 4 | protected String encode_matrix(String[][] matrix)
{
int row=matrix.length;
// int col=matrix[0].length;
int cur_index=1;
int col_index;
StringBuilder s=new StringBuilder();
Integer[] tk=new Integer[this.key.length];
for(int i=0;i<tk.length;i++)
{
tk[i]=Integer.valueOf(this.key[i]);
}
while(cur_in... |
2574c9be-a3c3-46d6-a83d-d00fc496d172 | 8 | private boolean execCreateFtrSimilarities(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) {
try {
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
Statement stmt = dbAccess.getConnection().createStat... |
68d28270-b9b0-4faa-8c4b-98336dda39b3 | 6 | public void keyPressed(KeyEvent e){
int keyCode = e.getKeyCode();
switch(id){
default: System.out.println("Please enter valid id fpr paddle"); break;
case 1:
if(keyCode == e.VK_W){
setYDirection(-1);
}
if(keyCode == e.VK_S){
setYDirection(+1);
}
break;
case 2:
if(keyCode ==... |
ad8be710-4f5b-4ddd-ad47-c9dce9e0499f | 0 | public void setId(int id) {
this.id = id;
} |
17d3b834-8a95-4359-8373-dc69a125a9cd | 9 | private void flipX(WritableRaster raster) {
int minX = raster.getMinX();
int minY = raster.getMinY();
int height = raster.getHeight();
int width = raster.getWidth();
int maxX = minX + width - 1; // Inclusive
int numBands = raster.getNumBands();
switch (raster.get... |
b2ea5589-99a3-4ded-b9cf-d519e9bb456b | 2 | static public void getMapImage(String imageUrl)
{
try {
// String imageUrl = "http://maps.google.com/staticmap?center=51.110851,17.029839&zoom=15&size=800x600&maptype=satellite&key=AIzaSyD9KVTMcGRQ37C0vVq5h2mq0S6N_GU6vCk
//&format=jpg";
System.out.println("Url:"+imageUrl);
... |
489a87b1-5912-4bc4-9440-a10bd97c1116 | 4 | @Override
public List<Double> dataToSignal(Integer input) {
List<Double> signal = cache.get(input);
if (signal == null) {
signal = new ArrayList<>();
// Fill the array with input's digits:
int digits = Math.abs(input.intValue());
int sign = input.intValue() > 0 ? 1 : -1;
while (digits > 0) {
sig... |
0f0e8184-fc51-4f02-9ab4-149c42440898 | 4 | protected void decodeChild(mxCodec dec, Node child, Object obj)
{
String fieldname = getFieldName(((Element) child).getAttribute("as"));
if (fieldname == null || !isExcluded(obj, fieldname, child, false))
{
Object template = getFieldTemplate(obj, fieldname, child);
Object value = null;
if (child.getNo... |
e4e21330-bef9-40d6-9f3d-9cd6aa525d1e | 1 | @SuppressWarnings("static-access")
public static void Call(final String num) {
CallFrame CallFrame = new CallFrame();
CallFrame.HoldIfNotActive();
Redial = num;
PrintWriter writer = MainFrame.TelnetWriter();
writer.print("Action: Originate\r\n");
writer.print("Channel: SIP/" + MainExtension + "\r\n");
... |
92c35de7-4eea-43e7-8f6e-2d12dfdaed30 | 9 | void createBuffers(int width, int height, String options) {
if (g != null)
g.dispose();
if (frontImageBuffer != null)
frontImageBuffer.flush();
if (backImageBuffer != null)
backImageBuffer.flush();
options = options != null ? options.toLowerCase() : "";
bufferSize = new Dimension(width, heigh... |
9a3c84b3-3544-4075-9603-39d5d29ffbf1 | 0 | public int getGenerationNumber() {
return this.genNumber;
} |
12466cf4-a652-4b66-879c-24a4f1981100 | 8 | public Location getLocation(Shape from, Shape to){
Location type = null;
Rectangle recFrom,recTo;
recFrom = from.getBounds();
recTo = to.getBounds();
if(recFrom.x == recTo.x){
if(recFrom.y < recTo.y){
type = Location.SOUTH;
}else{
type = Location.NORTH;
}
}
if(recFrom.y == recTo.y){
if... |
1c6b5a1b-4c99-4df6-a48a-81c5d595738b | 9 | public Edge applyFilterEdgeDirection(Edge current_edge, Node current_node){
if(this.edge_direction.isEmpty()){
return current_edge;
}else if(this.edge_direction.get(current_edge.getName()) == null){
return current_edge;
}else{
if(current_edge.getDirection() ==... |
5043ef15-0aff-4101-8b61-a9e5aae444d5 | 0 | @Override
public void setNationality(String nationality) {
super.setNationality(nationality);
} |
4a1cc0cb-00ad-456b-bb95-2cfbe5b67c65 | 8 | public Set<Map.Entry<Integer,Short>> entrySet() {
return new AbstractSet<Map.Entry<Integer,Short>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TIntShortMapDecorator.this.isEmpty();
}
... |
56a4a85e-8318-47c0-8fb6-78b859faa2ea | 9 | final int[][] method3047(int i, int i_5_) {
if (i_5_ != -1564599039)
anInt9091 = 64;
anInt9093++;
int[][] is
= ((Class348_Sub40) this).aClass322_7033.method2557(-127, i);
if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) {
int[][] is_6_ = this.method3039((byte) 62, i, 0);
int... |
9f4152b7-43d7-44f3-acd7-ec867519ecb3 | 8 | public Position getNextMove(Board board, Pieces piece) {
Position currentPos = board.getPos(piece);
Position endPos = board.getEndPos();
List<Position> possibleMoves = piece.getValidMove(currentPos);
for (Position pm : possibleMoves) {
/**
* get the distance between next possible position and target po... |
7a5923dd-f67e-41b9-a961-0a8ff87df3dd | 5 | @Override
public void render(Graphics2D graphics) {
int startPointGridXCoordinate = 150;
int startPointGridYCoordinate = 20;
for (PlayerInfo p : objectTron.getPlayers()) {
final int playerNr = p.getPlayerNumber();
final Position playerPos = p.getPlayerPosition();
Image playerToRender = playerBlue;
... |
0c5e1832-85fe-4c1f-8628-8fef7bf14275 | 8 | * @param target - looking for where to insert
* @return index i such that sarray[i] <= target, sarray[i] >= target
*/
private <T extends Comparable<? super T>>
int binSearch(ArrayList<T> sarray, T target)
{
int left = 0, right = sarray.size() - 1 ;
int mid = 0;
int loc = mid;
if (right == -1) ret... |
0e8a153c-961d-42ac-a5cb-81c2d5657150 | 4 | public Grid(int row, int column,Random rand) {
rows = row;
columns = column;
cells = new Entity[rows*columns];
//Fill the grid with death cells
int cellID = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
System.out.pri... |
d6a435a0-33f6-4baa-ace1-cdf2c3ffd222 | 8 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "you must be logged on to use these commands");
return false;
}
else if (command.getName().equalsIgnoreCase("inventoryBlock") && sender.hasPer... |
7495685f-c5bb-41ba-b953-75cdc7318d66 | 0 | public int getRandomNumber(int min, int max) {
return (int) Math.floor(Math.random() * (max - min + 1)) + min;
} |
361005c8-fea1-4026-b3a2-be42b9ffca5f | 3 | public JSONWriter array() throws JSONException {
if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') {
this.push(null);
this.append("[");
this.comma = false;
return this;
}
throw new JSONException("Misplaced array.");
} |
8a9c011f-37eb-4ef1-853d-1a11f264734b | 8 | @SuppressWarnings({"RedundantIfStatement"})
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Change change = (Change) o;
if (type != change.type) return false;
if (!filePath.equals(change.filePath)) return false;
if (!fileP... |
f5122810-c5f0-47e8-af10-1451bea8b64e | 5 | public final void setBottomRightButtonImage(BufferedImage image)
{
if (bottomRight == null)
bottomRight = new TButton(x + (isVertical ? 0 : width - scrollBarThickness), y + (isVertical ? height - scrollBarThickness : 0), scrollBarThickness, scrollBarThickness, "");
if (image == null)
{
if (pa... |
76e2baa5-15fd-4736-bfb2-e370e14f058c | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((msg.amITarget(mob))
&&(msg.targetMinor()==CMMsg.TYP_WEAPONATTACK)
&&(mob!=msg.source()))
{
if(numberOfImages <= 0)
{
unInvoke();
... |
b045a58c-e418-4ca2-8657-d20c7267dc57 | 1 | public String getWord()
{
//if more than 90% of the word occurrences are capital,
//then use capital style
if ((mFreq * 0.90) < mCapitalFreq)
return Character.toUpperCase(mWord.charAt(0))+mWord.substring(1);
else
return mWord;
} |
b285d190-a004-4ba8-b24b-60c55f542f84 | 4 | @Override
public ParserResult specialCheckAndGetParserResult(ParserResult result,
SyntaxAnalyser analyser) throws GrammarCheckException {
result = this.replaceNick(result, analyser);
boolean conditionIsOk = this.checkCondtionAmount(result);
if (!conditionIsOk) {
this.throwException(result.getOperationName(... |
944fe248-56b7-4fbf-8a1b-1c7b4efa5ebe | 4 | public CustomerDAOInterface getCustomerDAO(TypeTable typeTable) throws SQLException {
try {
//Let's ensure our connection is open
if (this.connect == null || this.connect.isClosed()) {
this.open();
}
} catch (SQLException e) {
throw e;
... |
1b20105c-db91-41e8-8dd1-dc88f99ee849 | 5 | public static void checkPath() {
File f = new File(path + "userData/");
if(!f.exists()) {
f.mkdirs();
}
f = new File(path + "AutoBroadcast/");
if(!f.exists()) {
f.mkdirs();
}
f = new File(path + "AutoSave/");
if(!f.exists()) {
f.mkdirs();
}
f = new File(path + "JumpPads/");
if(!f.exists()... |
81834654-7ef6-4e0f-98ff-ca83713b53d8 | 8 | public int getSearchArticleCount(String search,String val, int area) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
Statement stmt = null;
ResultSet rs = null;
int x = 0;
try{
conn = getConnection();
val = new String(val.getBytes("iso_8859-1"),"utf-8");
String sql = "sele... |
4030ff0d-a8ff-4fb6-848f-026b868099a8 | 6 | public static void initCraftableStats() {
if (blockStatsInitialized && itemStatsInitialized) {
HashSet var0 = new HashSet();
Iterator var1 = CraftingManager.getInstance().getRecipeList().iterator();
while (var1.hasNext()) {
IRecipe var2 = (IRecipe) var1.next(... |
835a9587-197d-492c-8673-ec4e21cb14bc | 6 | public void setCombinedShdAcc_Position(Position position) {
if (position == null) {
this.combineShdAcc_Position = UIPositionInits.COMBINEDACCSHD.getPosition();
} else {
if (!position.equals(Position.LEFT) && !position.equals(Position.RIGHT) && !position.equals(Position.NONE)
... |
8c64b9d9-f024-4d71-8d82-617da2b7b936 | 0 | public void collideHorizontal() {
setVelocityX(-getVelocityX());
} |
9bc01938-4e66-4801-b2c8-5544c1df706a | 5 | public void setSAM(AlberoMosse oam, int i){
if(am==null) am = new AlberoMosse[4];
//Inserisco l'albero
am[i] = oam;
//Aggiorno il valore del mio albero comparandolo con l'albero appena inserito
if(am[i]!=null && am[i].getValue()>valore-1) valore = am[i].getValue()+1;
//Aggiorno il numero di dame che posso m... |
80557b97-8ea7-459d-b3d0-8d7e8536c6a0 | 1 | public void waitTillElementLoad(By findElementBy) {
try {
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver).withTimeout(10, TimeUnit.SECONDS).pollingEvery(2, TimeUnit.MILLISECONDS).ignoring(NoSuchElementException.class);
wait.until(ExpectedConditions.visibilityOfElementLocated(fin... |
6b988da0-a339-4813-9152-4ccccc98a3cf | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
5eb7d0b5-7b5b-466c-adb1-fa430aec3cdc | 9 | @Override
public boolean wanderCheckedAway(MOB M, boolean mindPCs, boolean andGoHome)
{
if(M==null)
return false;
final Room R=M.location();
if(R==null)
return false;
int tries=0;
while((M.location()==R)&&((++tries)<10)&&((!mindPCs)||(R.numPCInhabitants()>0)))
beMobile(M,true,true,false,false,fal... |
5102a984-9bd0-41db-ab00-d0603950b390 | 9 | public static int threeSumClosest(int[] num, int target) {
if(num.length < 3) return 0;
Arrays.sort(num);
int s = 0, e = num.length - 1;
int closes = num[0] + num[1] + num[2];
while (e > 0) {
while (s < e) {
int sum = num[s] + num[e];
for (int i = s + 1; i < e; i++) ... |
8787c000-f593-4bc0-8551-d386a00fc113 | 2 | public int attack(Character target){
int damage = (int) (5 * Math.random()) + (int) (attack * multiplier) - target.getDefense();
if (damage <= 0){
damage = 1;
}
if ( ((int) (100 * Math.random()) + 1) < target.getEvasiveness()){
damage = 0;
}
target.lowerHP(damage);
return damage;
} |
33320f2f-aa22-454c-928f-d69a461854c0 | 1 | private void newFolder_fileManagerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newFolder_fileManagerButtonActionPerformed
try {
selectedDevice.getFileSystem().touch(directoryLabel_fileManagerLabel.getText(),
JOptionPane.sh... |
79e06911-b439-48c9-a258-08d9f21da8c5 | 9 | public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String op = "";
Usuario usuarios[] = new Usuario[10];
usuarios[0] = new Usuario();
usuarios[0].nome = "João Henrique";
usuarios[0].login = "joao";
usuarios[0].senha = "w12r";
usua... |
948f380d-2f31-4aab-bec0-0b06dd0ae592 | 9 | public static boolean readTopology(String fileName,int nodeID){
System.out.println("Reading config for"+nodeID);
BufferedReader bReader = null;
int nodesCount=0;
try {
bReader = new BufferedReader(new FileReader(fileName));
String line = bReader.readLine();
boolean firstLine=true;
while(line!=null){... |
037d4a19-e12b-42cc-a3c5-3225ec144485 | 6 | @SuppressWarnings("deprecation")
@EventHandler
public void onBlockDestroy(BlockBreakEvent event){
if(event.getBlock().getTypeId() != 0){
plates = plugin.getPlates();
for(int i = 0; i< plates.size(); i++){
Location loc = new Location(event.getPlayer().getWorld(),event.getBlock().getLocation().getBlockX(), ... |
f4072ae1-f93a-47a5-a267-6e62b7e8d5f2 | 0 | @Override
public void setWarmerState(int warmerState) {
this.warmerState = warmerState;
} |
cbe2fdd5-a4bf-4ab2-9bfa-3ce7d448087b | 9 | public boolean isDirectory(String filename) {
String localFileName = (java.io.File.separatorChar != '/') ? filename
.replace('/', java.io.File.separatorChar) : filename;
for (int i = 0; i < dirs.length; i++) {
if (dirs[i] == null)
continue;
if (zips[i] != null && zipEntries[i] == null)
fillZipEntr... |
7d85add1-7624-40c3-91a6-ea21da161452 | 0 | public int getInventory() {
return inventory;
} |
21d4cd7b-ee17-4dba-abb9-47f333b9a567 | 2 | public void sendSubtitle(String subtitle){
JSONObject o = new JSONObject();
try {
o.put("message", "subtitle");
o.put("text", subtitle);
sendMessage(o);
}
catch(JSONException e){}
catch(IOException e){}
} |
d4535842-1163-42f0-850c-3a1f5a90582c | 6 | public ArrayList<Double> run(){
for(int i = 0; i<connections.size(); i++){
if(connections.get(i).getGiveNeuron()==null) System.out.println("Error 1:: NeuralNetwork 368");
if(connections.get(i).getRecieveNeuron()==null) System.out.println("Error 2:: NeuralNetwork 369");
if(con... |
ceafd959-2ef0-48da-99b3-20ca8e5e2e96 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
8f83fac9-49c2-411e-9310-2e6099e3cb1e | 7 | private final int jjMoveStringLiteralDfa4_12(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_12(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_12(3, active0);
return 4;
}
switch(curChar)
{
... |
b1c11368-4e60-4308-a426-c4bc9afe1fce | 6 | public EulerianPath(Graph<?> G) {
this.hasPath = false;
this.marked = new ListOrderedMap<>();
int count = 0;
for (Object x : G.getAllVertices()) if (G.getDegree(x) % 2 != 0) count++;
if (count == 0)
//Use Hierholzer
this.hasPath = false;
else if... |
ad349d95-d5a3-4c9f-8255-ff955bcb6c5d | 5 | @Override
public boolean setChartOption( String op, String val )
{
boolean bHandled = false;
if( op.equalsIgnoreCase( "BubbleSizeRatio" ) )
{
pcBubbleSizeRatio = Short.parseShort( val );
bHandled = true;
}
else if( op.equalsIgnoreCase( "BubbleSize" ) )
{
wBubbleSize = Short.parseShort( val );
... |
546e58cf-d811-4794-adb6-cf1daced024a | 4 | public static TreeNode getInOrderNextNode(TreeNode e){
if(e==null){
return null;
}
if(e.right != null){
return mostLeftChild(e.right);
}else{
TreeNode parent = e.parent;
TreeNode children = e;
while(parent != null){
if(parent.left == children)
break;
children = parent;
parent = p... |
6692ff96-5064-4156-8d2b-aa848ceeb239 | 5 | public int calculateStepPrice(XY xy0, XY xy1) {
int step = XY.distance(xy1, xy0);
if (step > XY.DiagonalLong) {
return -1;
}
if (step == XY.DiagonalLong) {
Set<MyObject> objects = new HashSet<MyObject>();
objects.add(model.getBoard().get(new XY(xy0.get... |
3ad657cd-6d71-4021-b3ed-e6c31fac9f2b | 6 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
... |
abdea0da-edda-4aed-88e1-c429e8ee40d5 | 9 | @SuppressWarnings("rawtypes")
private Collection<ParserAccount> parse1(Properties properties) throws ConfigurationException {
Map<String, ParserAccount> account = new HashMap<String, ParserAccount>();
int sequence = 0;
for (Entry entry : properties.entrySet()) {
Matcher matcher = PATTERN.matcher((String) entr... |
ea4b5b88-3c87-4032-9133-bef9af9ad8ee | 3 | public List<VariableAppearance> getAltAppearances(ParsingContext context) {
List<VariableAppearance> result = new ArrayList<VariableAppearance>();
for (String variableName : detectedVariableNames) {
for (int i = 0; i < altPrefixRegexps.size(); i++) {
String completeRegexp = altPrefixRegexps.get(i) + variable... |
77f562cc-09d4-4594-bcb4-9e5b35a27a16 | 7 | public static void main(String[] args) throws Exception{
/*
* Method 1: With the FastaReaderHelper
*/
//Try with the FastaReaderHelper
LinkedHashMap<String, ProteinSequence> a = FastaReaderHelper.readFastaProteinSequence(new File(args[0]));
//FastaReaderHelper.readFastaDNASequence for DNA seque... |
99074f45-a92e-4989-b5b0-cc138775e287 | 4 | public Position getTreasurePos() {
List<Row> rows = getRow();
List<CardType> cols;
Row row;
CardType card;
TreasureType cardTreasure;
for (int i = 0; i < rows.size(); i++) {
row = rows.get(i);
cols = row.getCol();
for (int j = 0; j < cols.size(); j++) {
card = cols.get(j);
cardTreasure = c... |
ccb57070-a229-49c1-9cc2-d03ca9dee008 | 6 | public void setWeight(String gender) {
if (gender == "Male") {
weightBox.removeAllItems();
for (String mWeight : maleWeight) {
weightBox.addItem(mWeight);
}
}
if (gender == "Female") {
weightBox.removeAllItems();
for (String fWeight : femaleWeight) {
weightBox.addItem(fWeight);
}
}
i... |
7b77deb9-a951-4c40-8c9e-928c066c74c2 | 3 | Entry extractMinimum() {
Entry t;
Entry w;
// ++
access += 1;
Entry z = minimum;
// ++ ++
access += 2;
if (z.child != null) {
// Usuwamy referencje do rodzicow wszystkich synow "z"
// ++ ++ ++
access += 3;
... |
70e2a952-da8b-4a4a-882f-388a5a29176b | 3 | public static void main(String[] args) throws RollbackFailureException, Exception{
LenguajeJpaController LC=new LenguajeJpaController();// declaramos un controlador de la entidad Lenguaje
//hacemos un select de todos los lenguajes
List<Lenguaje> AllLenguajes = LC.findLenguajeEn... |
9beab843-8aad-42da-852f-3dba2c42a9d4 | 7 | public String performSlyDeal(List<Card> discarded, List<Card> hand) {
String result = "";
String disc = null;
for(Card discCard : discarded) {
if(discCard instanceof PropertyCard) {
disc = discCard.toString();
}
for(Card handCard : hand) {
if(handCard instanceof PropertyCard) {
if(dis... |
752abea2-728c-46d8-b360-953dcfe82046 | 8 | private void login() {
LoginPanel.this.setStatusText(null);
Player player = new Player();
player.setUsername(LoginPanel.this.getUsername());
player.setPassword(LoginPanel.this.getPassword());
if (this.areLoginCredentialsValid(player)) {
LoginPanel.this.setStatusText(TextResources.LOGIN_PANEL_STATUS_WHI... |
bbcfc472-1feb-4862-9a84-a77d17ba1ca5 | 1 | public void addEndereco(Endereco e){
if(!enderecos.contains(e)){
this.enderecos.add(e);
}
} |
66a4937d-d64e-4e66-8963-630d689a8342 | 0 | public TooltipAction(String name, String tooltip) {
super(name);
putValue(SHORT_DESCRIPTION, tooltip);
} |
bb22e863-bc24-453a-b82f-eb140cbc2250 | 1 | public PlainEditor(){
JMenu jMenu1 = new JMenu("File");
jMenu1.add(jmiSave);
JMenuBar jMenuBar1 = new JMenuBar();
jMenuBar1.add(jMenu1);
setJMenuBar(jMenuBar1);
jmiSave.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try{
BufferedOutputStream in =
... |
d7ce31e8-0bb3-42c8-888f-7586f03f31c6 | 5 | public static Image dynamicCompression(Image original) {
if (original == null) {
return null;
}
double L = Image.MAX_VAL;
double RRed = 0, RGreen = 0, RBlue = 0;
for (int x = 0; x < original.getWidth(); x++) {
for (int y = 0; y < original.getHeight(); y++) {
RRed = Math.max(RRed, original.getPixel(x... |
dedf0b0b-d9df-43cc-b355-0591517a472a | 2 | private final short clip(float sample)
{
return ((sample > 32767.0f) ? 32767 :
((sample < -32768.0f) ? -32768 :
(short) sample));
} |
587ea426-0c6a-4e97-825f-9617b6214db6 | 6 | public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final java... |
a480f9c3-c459-4ebc-8f5d-a197296ba18a | 1 | public Tile getTile(int x, int y)
{
try {
return grid[x][y];
} catch (ArrayIndexOutOfBoundsException e) {
return null; //Let the caller handle this.
}
} |
5c6e4d38-97ab-4046-8dd4-f42e63dfb520 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
8dea49a8-abf8-448c-811c-a5dce4029620 | 6 | public void LetsGame(boolean Online)
{
Utils.LogPrintConsoleHead("Запускаю игру");
ArrayList<String> params = ParseGameArguments();
File log = new File(ClientFolderPath+"game.log");
ProcessBuilder pb = new ProcessBuilder(params);
pb.environment().clear();
if(Utils.get... |
b9dc7f3c-db60-4cb0-a234-a83fe5c0a0a6 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Pruefungslevel)) {
return false;
}
Pruefungslevel other = (Pruefungslevel) object;
if ((this.id == null && othe... |
38609ee0-f836-41f5-a2ce-961ee32934a0 | 3 | public void visitJsrStmt(final JsrStmt stmt) {
if (stmt.sub().entry() == oldDst) {
if (FlowGraph.DEBUG) {
System.out.print(" replacing " + stmt);
}
stmt.block().graph().setSubEntry(stmt.sub(), newDst);
if (FlowGraph.DEBUG) {
System.out.println(" with " + stmt);
}
}
} |
1e0d251c-569f-44e0-91c1-a0f738075d7e | 8 | void endLayer(Layer lay) {
// time += lay.getTime();
timeaccel += lay.getTimeAccel();
distance += lay.getDistance();
traveldistance += lay.getTraveldistance();
// Count layers which are visited only
if (!lay.isPrinted()) {
notprintedLayers++;
// lay.setLayerheight(0); // Layer not printed
} el... |
6af18d1b-df36-4e41-80bf-1049c968cf2a | 0 | public void addParts(String parts){
this.parts.add(parts);
} |
eea5e767-49dd-45da-985b-a7252cd8a1b4 | 9 | public static String wagnerFischer(String s1, String s2) {
int m = s1.length();
int n = s2.length();
int[][] L = new int[m+1][n+1];
int maxLen = 0;
int iMax = 0;
int jMax = 0;
/* Initialize the first column. */
for (int i = 0; i <= m; ++i) {
L[i][0] = 0;
}
/* Initialize the first ... |
74704c6c-77b7-4096-985c-9e254e3fe7bb | 8 | public void dbReadList(Connection aconn)
{
synchronized(aconn)
{
try
{
String qstr = "";
// if master table and field are defined, join the description table
if (mastfld.length() > 0 && masttbl.length() > 0)
{
qstr = "Select a." + mastfld + ",... |
80a45fe5-4656-4708-b4e9-e0da647427f0 | 4 | public FieldVisitor visitField(final int access, final String name,
final String desc, final String signature, final Object value) {
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
cp.newUTF8("Synthetic");
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
cp.newUTF8("Deprecated");
}
cp.newUTF8(name);
cp... |
694dbd66-0ffd-4662-a240-93784499ab44 | 2 | private void saveToDevice_buildPropButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveToDevice_buildPropButtonActionPerformed
try {
BuildProp bProp = selectedDevice.getBuildProp();
BufferedReader reader = new BufferedReader(new StringReader(jTextArea1.getText())... |
b4e0a747-d837-4120-8b16-0efda4feeccc | 7 | public static boolean mutateRouteBy2_Opt(Individual individual, int period, int vehicle)
{
ProblemInstance problemInstance = individual.problemInstance;
ArrayList<Integer> route;
boolean retry = true;
boolean exit = false;
while(retry)
{
exit = false;
route = individual.routes.get(period).get(veh... |
01ddaa09-f5ef-40e3-ac39-3fbbeac9d3cc | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String version = this.plugin.getDescription().getVersion();
if (title.split(" v").length == 2) {
final String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ... |
9ff4d71d-8659-4ef7-9b63-987637b01b57 | 3 | @Override
public void run() {
try {
//objectOut.writeObject(this.serverKey.getPublic());
this.clientKey = (PublicKey) objectIn.readObject();
objectOut.writeObject(this.verschluesseleRSA(this.aesKey.getEncoded()));
server.bearbeiteVerbindungsaufba... |
4efb0523-d14c-447b-8339-cb65d7faecf5 | 4 | private void loadData() {
try {
String name = DB.fetchSingle("select namn from anstalld where aid=" + selectedAnstalld);
lblAddPerson.setText("Lägg till " + name + " i spelprojekt:");
} catch (InfException e) {
e.getMessage();
}
try {
Arra... |
7b3beed9-9b94-4d5e-8728-8af2fb53e762 | 6 | private void buildMap() {
nodes = new Node[xs.size()][ys.size()];
Cord.maxI = xs.size() - 1;
Cord.maxJ = ys.size() - 1;
int i = 0, j = 0;
for (int x : xs) {
j = 0;
for (int y : ys) {
Point p = new Point(x, y);
if (!(cpFrom.contains(p) || cpTo.contains(p))) {
Node nd = new Node(p);
nd... |
b38d1d12-cd83-44d2-9590-95ea692280f3 | 8 | public static boolean isBST(int[] array, int begin, int end) {
int left = begin;
int right = end - 1;
if(end - begin <= 1)
return true;
while (left < end && array[end] > array[left])
left++;
while (right > begin && array[end] < array[right])
right--;
if(left - 1 == right || left == right)
return... |
256f1956-dec0-487b-91ff-722995b0e11b | 8 | static void generate_adpcm(ADPCMVoice voice, ShortPtr buffer, int samples) {
/* if this voice is active */
if (voice.playing != 0) {
UBytePtr _base = voice._base;
int sample = (int) voice.sample;
int signal = (int) voice.signal;
int count = (int) voice.cou... |
b349867c-ad99-4ce5-9444-8e8b16518e30 | 0 | public static FontMetrics getFontMetrics(Font font) {
JComponent jc = new JLabel();
return jc.getFontMetrics(font);
} |
ab16a301-db85-4d43-9351-d28c7d6450c1 | 0 | public void setjComboBoxSearch(JComboBox jComboBoxSearch) {
this.jComboBoxSearch = jComboBoxSearch;
} |
63ecb359-cd6b-4e3a-843b-32d40e8d38b7 | 5 | public static void main(String [] args) {
// instantiate some elements
IntSeq i1 = new IntSeq();
IntSeq i2 = new IntSeq();
IntSeq i3 = new IntSeq(88);
IntSeq i4 = new IntSeq(97, 55);
IntSeq i5 = new IntSeq(102, 103, 101, 107, 109);
IntSeq i6 = new IntSeq(41, 42, 43, 44);
IntSeq i9 = new... |
1f94687e-ac13-47b0-b96b-ca0a957a5053 | 4 | @SuppressWarnings("unused")
private static SourceDataLine getSourceDataLine(String strMixerName,
AudioFormat audioFormat,
int nBufferSize) {
/*
* Asking for a line is a rather tricky thing.
* We have to construct an Info object that specifies
* the desired properties for the line.
* First, we have ... |
2f33ba8d-6921-42ae-b630-2e2588dc2bc6 | 4 | @Override
public boolean addResources(Path tmpSystemfile, List<ResourceVO> resource) throws IOException, InterruptedException {
if (!FileUtil.control(tmpSystemfile) || (resource == null) || (resource.size() <= 0)) {
IllegalArgumentException iae = new IllegalArgumentException("The Systemfile is n... |
bc57200e-e06a-43e1-9467-ac82c92fe707 | 5 | public void playSound(String type) {
if (type.equals("zombieaggro")) {
Game.playSound("zombie/growl_" + random.nextInt(9) + ".wav", false);
}
if (type.equals("zombiehit")) {
Game.playSound("zombie/hit_" + random.nextInt(8) + ".wav", false);
}
if (type.equals("zombieplayerhit")) {
Game.playSound("zomb... |
fbf67677-01dc-4ae3-a7fa-40f91c19af3d | 1 | private Component getFooter() {
final JTextField jtfSeparator = new JTextField(";");
jtfSeparator.setMaximumSize(new Dimension(30, 30));
JButton jbCopyToClipboard = new JButton("Copy to clipboard");
jbCopyToClipboard.addActionListener(new ActionListener() {
public void actio... |
0acbb773-b661-4cb3-bcdd-6c54720565fc | 8 | public static boolean dfs(Node arbol, long sum) {
if (res)
return true;
if ((arbol.izq == null || arbol.izq.date == Integer.MIN_VALUE)
&& (arbol.der.date == Integer.MIN_VALUE)) {
if (sum == search) {
res = true;
return true;
}
} else {
if (arbol.izq.date != Integer.MIN_VALUE) {
dfs(ar... |
60890db9-10a4-4978-982e-83f4c42fffd6 | 9 | public boolean canMoveLeft(){
int [][] temp = BlockInControl.getBlock();
int tempPosX = BlockPosX;
int tempPosY = BlockPosY;
for(int r = 0; r <4; r++){
for(int c = 0; c < 4;c++){
if(temp[r][c] == 1){
if(c ==0){
if(tempPosX-1 < 0)
return false;
if(board[tempPosY][tempPosX-1]==1)
r... |
c3a2bc06-b05f-400e-ac91-69b7298b4e30 | 4 | public static void main(String[] args) throws Exception {
System.out.println("hello, world!");
DataSource testingSource = new DataSource("test2.arff");
Instances testingData = testingSource.getDataSet();
DataSource trainingSource = new DataSource("train2.arff");
Instances trainingData = trainingSource.getData... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.