method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
eb4e5015-1aa2-4cb1-ac89-870ca9f861e0 | 3 | public void move(int dir, boolean didPlayerSend){
int[][] gameBoard= game.getBoard();
if (checkCell(dir))
moveToCell(dir, gameBoard);
else if (didPlayerSend)
this.savedDir= dir;
else {
if (this.savedDir != dir)
this.savedDir= dir;
else
this.savedDir= -1;
}
} |
86217d0f-034e-4517-a3a2-b07a7e8b6892 | 9 | public static void main(String[] args) {
BufferedReader reader = null;
String sql = "insert into location (location) values (?)";
Connection connection = null;
PreparedStatement statement = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection("jdbc:oracl... |
ee55b69d-8a6e-4516-99bd-2b2c1046c784 | 4 | public static boolean[] getSieve(int size) {
boolean[] isPrime = new boolean[size];
for(int i = 2; i < isPrime.length; i++)
isPrime[i] = true;
for(int i = 2; i < isPrime.length; i++)
if( isPrime[i] )
for(int j = 2; j*i < isPrime.length; j++)
isPrime[i*j] = false;
return isPrime;
} |
94fbdb6d-3b02-4b4a-bed5-82247899c6cf | 2 | public void test_10() {
int nmerSize = 32;
String seqStr[] = { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" //
, "caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaag" // Prepend 'c', append 'g'
};
SuffixIndexerNmer<DnaSequence> seqIndex = new SuffixIndexerNmer<DnaSequence>(new DnaSubsequenceCompara... |
6753eae7-7f37-4e03-a90e-8085ae714c9a | 8 | public int largestRectangleArea(int[] heights) {
Deque<Integer> deque = new LinkedList<>();
int maxArea = 0;
int i = 0;
while (i < heights.length) {
int height = heights[i];
if (deque.isEmpty() || height > heights[deque.peekLast()]) {
deque.add(i... |
15d6812a-d4e1-4dea-add1-661d3f0fde6e | 0 | @Override
public void Volum (double n) {
this.volume=Math.PI*rad*rad*hight*n;
this.hight = hight*Math.pow(n, 1/3);
this.rad = rad*Math.pow(n, 1/3);
} |
f2fa7812-60c2-4f15-ab54-7e412c77c4f4 | 8 | public ArrayList<ArrayList<Integer>> threeSumOverTimeLimit(int[] num) {
ArrayList<ArrayList<Integer>> result = new ArrayList<>();
Map<Integer, ArrayList<Pair<Integer, Integer>>> map = new HashMap<Integer, ArrayList<Pair<Integer,Integer>>>();
if(num.length < 3) return result;
//sort num fisrt:
Arrays.sort(num)... |
b33a4f11-1de0-4ca6-96cf-5c961aeb92f5 | 6 | public static HashMap<Integer, String> getNumericalAndNumericalUnderscoreFilenames_HashMap(
File directory,
String underscore) {
HashMap<Integer, String> result = new HashMap<Integer, String>();
int index = 0;
String[] list = directory.list();
int count = 0;
... |
50e9f85c-6b29-4f6d-8e46-3f0d08c2d4c3 | 6 | public static ArrayList<Television> getAllTelevision(int montoMin,int montoMax,char consumo)
{
ArrayList<Television> colElectrodomestico=new ArrayList<Television>();
String sqlFiltros="";
if(montoMin>0)
sqlFiltros=sqlFiltros.concat(" and preciobase>"+montoMin+" ");
if(montoMax>0)
sqlFiltros=sqlFiltros.co... |
ec990513-822b-4152-8d22-1d15e05a5e29 | 3 | public boolean isValid() {
if (root.isNil()) {
return true;
} else {
return getRoot().isBSTValid() &&
getRoot().isBlackValid() &&
getRoot().isRedValid();
}
} |
78af4fc6-88af-4ec6-8d76-753315ccc100 | 6 | private static Set<GridPacking<CatCage>> solve_aux(Sequence<CatCage> cagePlacementSequence, List<CatCage> catCageList, int rowCount, int columnCount)
{
assert isViable(cagePlacementSequence, rowCount, columnCount) : String.format("cagePlacementSequence is not viable! : cagePlacementSequence =\n %s", new GridPackingI... |
bc656bb2-6dc7-4148-ac07-dec2bed02443 | 2 | public void reset (int port)
throws IOException
{
if (port <= 0 || port > ports)
throw new IllegalArgumentException ();
ControlMessage.setFeature (dev,
ControlMessage.TYPE_CLASS | ControlMessage.RECIPIENT_OTHER,
PORT_RESET,
port
);
} |
1872dc54-cf9c-42d0-8b9c-2fdc36a836d2 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
f9e79714-0f56-483e-bf31-52ed19969bcd | 3 | @Override
public boolean equals( Object obj )
{
if(!(obj instanceof ChunkCoord))
return false;
return x == ((ChunkCoord)obj).x && z == ((ChunkCoord)obj).z && world.equals(((ChunkCoord)obj).world);
} |
7da595e3-26f9-49aa-89d7-f1c074bb2c2a | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
e1b13cb2-d071-4fa5-96ce-5056f885531a | 9 | public void Find(int k, HashSet<Integer> qp, HashSet<Integer> qm){
HashSet<Integer> gg = new HashSet();
int delt;
if (qp.isEmpty() && qm.isEmpty()){
HashSet<Integer> tmp = new HashSet();
for (int i = 0; i < k;i++)
tmp.add(ss[i]);
sets.add(tmp);... |
b996c2b4-2d1e-40d4-8339-5b7ffdb3b424 | 6 | public static void calculateAndControl(LocationData angles, Main main) {
int x1 = angles.picX;
int x2 = angles.picX2;
int y1 = angles.picY;
int y2 = angles.picY2;
int dx = Math.abs(x1 - x2);
int dy = Math.abs(y1 - y2);
if (dy != 0) {
int angle = (int) Math.toDegrees(Math.atan(dx / dy)) - 90;
if... |
d3bfae8d-1f6e-48c8-92ff-e90dda4b13a4 | 3 | public void receive_packet(DuplexLink link, Packet packet)
{
int enlace = this.links.get(link);
RouterBuffer buffer = this.buffers.get(enlace);
packet.decrease_ttl();
//dropando pacote: buffer lotado ou TTL == 0
if (buffer.is_full() || packet.getTTL() == 0)
{
if(buffer.is_full())
System.out.pri... |
63f704c5-303c-4bad-b32c-1ef400a25285 | 9 | public void Show(String uname)
{
//Instantiate classes
ASCII_Sound beep = new ASCII_Sound(false);
ASCII_Art welcome = new ASCII_Art();
Options o = new Options();
MehMurray mm = new MehMurray();
MainMenu m = new MainMenu();
PlayMenu p = new PlayMenu();
... |
80793310-57b1-407b-a93b-bf38be2bb6db | 8 | @Override
public boolean isAnyFieldDifferentFromDefault() {
boolean same = this.active.isSelected() && this.SKU.getText().isEmpty()
&& this.name.getText().isEmpty()
&& this.description.getText().isEmpty()
&& this.UOM.getText().isEmpty()
&& this.price.getText().equals("0.00")
&& this.stock.getText... |
6153c2b6-5f98-48e9-a86b-a8c65a47477c | 8 | public boolean skipAndClauseP(ControlFrame frame, Cons forbiddenvars) {
{ IncrementalPartialMatch self = this;
{ boolean forbiddenvarsP = !(forbiddenvars == Stella.NIL);
boolean failunconstrainedclausesP = Logic.$FAIL_UNBOUND_CLAUSESp$;
Stella_Object conjunct = (frame.proposition.arguments.th... |
c99a5c99-a6cc-4cef-9030-24f20b5c099d | 9 | public static List<Dependencia> listaDeDependencias() {
ResultSet tr = null;
String select = "SELECT * FROM dependencias";
ArrayList<Dependencia> listaDependencia = new ArrayList<Dependencia>();
Connection conexion = null;
Statement statement = null;
try {
co... |
a8f2d261-2f50-4a73-a329-acc845ae0974 | 1 | private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
} |
b64c35ec-6a66-466c-85f8-886ee8f04149 | 9 | public static void listDir(JFrame jframe, Collection<File> files, Collection<File> folders, int depth,
final List<Pattern> dangerousFolders) {
String frameTitle = jframe.getTitle();
try {
for (File folder : folders) {
Log.info("Folder to scan: '... |
a56d3f2d-ac0b-4755-9e86-d6be34fefb48 | 1 | private char validateGuessIsALetter(String guess) {
while (guess.length() > 1) {
System.out.println("Please only enter one character:");
guess = sc.next();
}
return guess.charAt(0);
} |
fbdb68c9-826c-4b40-870a-37e138b8b1b0 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BaseFractalAlgorithm other = (BaseFractalAlgorithm) obj;
if (Double.doubleToLongBits(... |
14819037-0f11-46fd-8074-112b6bb01d4c | 7 | public int[] getCubie(Point p) {
int cubieSize = squareSize / 3;
for (int f = 0; f < 6; f++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
Point l = getSideLocation(TileColor.get(f));
if (p.x >= l.x + 1 + cubieSize * x && p.x <= (l.x + 1 + cubieSize * x) + cubieSize && p.y >= l.y + ... |
6e089182-9040-44cf-be01-779ce1607daf | 4 | private void doWork() {
System.out.println("CopyWorker start to work!");
FileReaderUtils.copy(this.src, this.des);
long start = System.currentTimeMillis();
String name = des.getName();
String ext = name.substring(name.lastIndexOf("."), name.length());
String path = des.getAbsolutePath();
String size = Str... |
89c985e9-df70-45dd-a124-081013fd832e | 9 | public void createAbstractXxxVMethods(ClassGenerator classGen) {
if (returnVType().equals(owner)) {
JType xxxV = owner.jType(XxxV);
ImmutableList<VType> rest = isEndofunctionForOwner() ? skipOne(toVType(vParams))
: toVType(vParams);
boolean isAnyBasicInRest = isAnyBasic(rest);
boo... |
d9e0dd42-8d0d-4edd-a573-faf8d8ee46a8 | 5 | private void update() {
final int ASCII = getSkinnable().getCharacter().isEmpty() ? 20 : getSkinnable().getCharacter().toUpperCase().charAt(0);
final String ON_STYLE = getSkinnable().getSegmentStyle().ON_CLASS;
final String OFF_STYLE = getSkinnable().getSegmentStyle().OFF_CLASS;
... |
1cd2899a-0c45-4a9b-a527-b5b40a42f2fd | 7 | @EventHandler(ignoreCancelled = true)
public void onPlayerInteract(final PlayerInteractEvent event) {
final boolean leftClickCheckFire = this.protectFire && event.getAction() == Action.LEFT_CLICK_BLOCK;
if (!leftClickCheckFire && !this.rightClickTargetFace(event)) return;
final Location tar... |
34b88d4d-7295-4727-96c9-fdffff436750 | 7 | @Override
public void tick(InputHandler input, Level level)
{
boolean left = input.keys[KeyEvent.VK_LEFT];
boolean right = input.keys[KeyEvent.VK_RIGHT];
boolean up = input.keys[KeyEvent.VK_UP];
boolean down = input.keys[KeyEvent.VK_DOWN];
xx = 0;
yy = 0;
if (left)
xx--;
if (right)
xx++;
if ... |
455991c7-2fd1-4bae-a08d-be2143f443fa | 5 | public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) {
if (!(sender instanceof Player)) {
Language.IN_GAME_ONLY.bad(sender);
return;
}
if (args.length < 3) {
Language.CMD_CHUNKY_PERMISSION_HELP.bad(sender);
... |
7f3c0a52-11a0-45d0-9f24-ac7a6cf2f356 | 4 | public Element getElementWithAttribute(String attribute, String value, String tagName){
NodeList dbs=null;
if(this.current==null){
dbs = xmlFile.getElementsByTagName(tagName);
}
else{
dbs = current.getElementsByTagName(tagName);
}
Element element = null;
for(int i=0; i<dbs.getLength(); i++){
ele... |
04b5bc1e-a151-4b7b-a6bf-ba055f45267e | 2 | public ServerEnterFrame(int type){
super();
String sType;
switch (type) {
case ServerDataBaseManager.QUERY:
sType = "Query";
break;
case ServerDataBaseManager.UPDATE:
sType = "Update";
break;
default:
sType = "Default";
break;
}
setTitle("Enter " + sType);
setLayout(new BorderLayout(... |
c8482584-3cee-4d09-bbb8-834553da9a5c | 0 | public <TResult> Query<TResult> select(Selector<T, TResult> selector)
{
Iterable<TResult> rs = new SelectIterable<TResult>(this._source, selector);
return new Query<TResult>(rs);
} |
6e468247-482e-4a68-a64b-1131dc74960f | 3 | private Local getAvailableLocal(Local cls) {
// TODO Auto-generated method stub
for(Local l: b.getLocals()){
if(l.toString().equals(cls.toString()) && l.getType().equals(cls.getType()))
return l;
}
return null;
} |
ea1c6b70-bb6a-4235-8592-00ce921a1cdf | 6 | public boolean checkBeforeMove(int x, int y) {
String checkArray[][] = {{RowA.cell0, RowA.cell1, RowA.cell2},{RowB.cell0, RowB.cell1, RowB.cell2},{RowC.cell0, RowC.cell1, RowC.cell2}};
boolean output;
if (output = x < 0 || x > 3 || y < 0 || y > 2)
System.out.println("Неверный ход. Но... |
3041bea7-2321-4570-b99c-6f981fbf2ca6 | 9 | private void setup() {
this.imageData = new byte[this.tileWidth * this.tileWidth * 4];
this.watchIconImageData = new int[this.tileWidth * this.tileWidth];
this.dialImageData = new int[this.tileWidth * this.tileWidth];
this.tileImage = 1;
try {
BufferedImage ioexcepti... |
e4e0bfed-00fd-4d75-9061-d19104d183e2 | 0 | public static String getStringValue(String key){
return properties.getProperty(key);
} |
bea7b872-5d63-427a-82f3-04d8125eae6a | 6 | private Set<TKey<?, ?>> setupDataKeys() {
Set<TKey<?, ?>> dataKeys = new HashSet<>();
dataKeys.add(DatasetKeys.DIGITISATION_STATUS);
dataKeys.add(DatasetKeys.EXPECTED_RECORDS);
dataKeys.add(DatasetKeys.EXPECTED_DIGITAL_OBJECTS);
dataKeys.add(DatasetKeys.DATA_FORMAT);
va... |
199be6ef-4e69-40fc-922d-450902ec33b3 | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
1a4c872b-41d9-4d89-980a-20bc9be1d731 | 2 | public Editor(Composite parent, int style) {
super(parent, style);
if (fontSize == null) {
try {
FontData[] fD = this.getFont().getFontData();
fontSize = fD[0].getHeight();
System.out.println("Editor default font size detected = " + fontSize);
} catch (Exception ex) {
ex.printStackTrace... |
be61df6f-536f-4192-9801-593d32b045cc | 3 | public void loadProperties(File filename) {
try {
Properties prop = new Properties();
FileInputStream in = new FileInputStream(
filename);
prop.load(in);
setUsername(prop.getProperty(usernameProperty));
setHost(prop.getProperty(hostnameProperty));
setOpenID(prop.getProperty(openidProperty));
... |
74fe6f43-73a4-4fa5-89fa-6a68c0dae332 | 9 | public void jouerEnForteresseDeGlace(Dieu deus, GeantDeGivre gdg, De de, DomaineDesMorts ddm, DemeureDesElfes dde, JFrame page) {
int forcedieu = deus.getFORCEINITIALE();
partieRestanteAjouer--;
if (this.getNom().compareTo("Freyja") == 0) {
Freyja f = (Freyja) this;
f.se... |
37c73cb9-7e0a-4635-b12f-bc75e24b0939 | 1 | public GrammarViewer(Grammar grammar) {
setModel(new GrammarTableModel());
this.grammar = grammar;
// setLayout(new BorderLayout());
Production[] prods = grammar.getProductions();
data = new Object[prods.length][2];
Object[] columnNames = { "Production", "Created" };
for (int i = 0; i < prods.length; i++... |
b035b626-8219-4f4f-8fab-f111e0620b24 | 4 | public void bind() {
if(texture != null && !isBound) {
//Save the previous texture to set back, otherwise there's issues with fonts
prevTexture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID());
isBound = true;
}
else if(texture != null && ... |
87694734-6810-43ae-a9e2-55443ce6a3a3 | 7 | private void addToBucketMap(Map<Integer, List<Integer>> bucketMap, int ibucket, int element) {
List<Integer> list;
if (bucketMap.containsKey(ibucket)) {
list = bucketMap.get(ibucket);
} else {
list = new ArrayList<Integer>();
bucketMap.put(ibucket, list);
... |
d1b01579-a358-4f64-a63a-8d35d0f74212 | 4 | /* package */ static Request addScope(Request request, String[] scopes) {
if (scopes != null && scopes.length > 0) {
StringBuilder scope = new StringBuilder();
for (int i=0; i<scopes.length; i++) {
scope.append(scopes[i]);
if (i < scopes.length-1) scope.ap... |
c295b602-89da-4322-a5a3-384ec8e1e817 | 5 | @Override
public int compare(Object o1, Object o2) {
Map<Object, Integer> m1 = order.get(o1), m2 = order.get(o2);
if (m1 == null || m2 == null)
throw new IllegalArgumentException(o1 + " " + o2);
if (m1.containsKey(o2))
return m1.get(o2);
Set<Object> mutual = new HashSet<>(m1.keySet());
mutual.retainAll... |
052361dd-e848-436c-8c48-3787655aae7c | 4 | public double getNormalDistribution(double lowerLimit, double upperLimit, double standardDeviationSpread) {
if (standardDeviationSpread < 1.0 || standardDeviationSpread > 5.0) // if standardDeviationSpread is < 1.0 there is a risk of excessive iterations of the range-checking do-while() loop
throw new Illegal... |
5284a431-ca94-45ac-ae3a-c141c5a6fa35 | 3 | public boolean disjointBelow(RPChromosomeRegion testRegion) {
if (endChromID < testRegion.startChromID ||
endChromID == testRegion.startChromID && endBase <= testRegion.startBase)
return true;
else
return false;
} |
f2d8e183-3ed0-4cce-b91a-0e7b1c1196ec | 1 | public void addClassAnalyzer(ClassAnalyzer clazzAna) {
if (parent != null)
parent.addClassAnalyzer(clazzAna);
} |
81c3482a-6162-4946-926b-62f46659a692 | 9 | public void setOverlayPainter(Painter<? super JXMapViewer> overlay)
{
Painter<? super JXMapViewer> old = getOverlayPainter();
this.overlay = overlay;
PropertyChangeListener listener = new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getNewValu... |
96cfd6f7-7285-4515-86e7-d642cf3ac0d5 | 1 | public synchronized void removeStation(String alias) {
boolean contained = stations.remove(alias);
if(!contained) {
throw new IllegalStateException("The station with alias " + alias + " was not part of this network.");
}
} |
a15b2430-6e7a-4ee4-a632-e17b32727584 | 1 | public void unpauseDownload(final int gid) {
switch (downloads.get(gid).getStatus()) {
case PAUSED:
taskManager.unpause(gid);
break;
default:
break;
}
} |
e8f674f4-5c10-46e9-bc25-0dbb0da60d57 | 3 | @Override
public synchronized InputStream getInputStream() throws IOException
{
if(toAppStream == null) {
toAppStream = new ConnectionEndPointInputStream();
// if there is already some data, copy it to stream
// and delete buffer
if(toAppBuffer != null) {
for(Object obj : toAppBuffer) {
toA... |
09f58015-00ad-442b-a35b-926a600f4b0b | 2 | public GameController()
{
super("PACMAN BY Amador Navarro");
map = new Map();
player = new GamePlayer();
int rows = map.getRowLength();
int columns = map.getColumnLength();
int[][] cellValues = initCellValues(rows, columns);
... |
2f119e19-969a-4576-909f-c8d5710be209 | 8 | final public Expression StringExpression(int str_type) throws ParseException {
final Variable v;
final String s;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VARIABLE:
v = Variable();
{if (true) return new VariableExpression(v);}
break;
case STRING_END:
case ... |
d14d27a8-c87c-4a74-a385-bb687df2aaaf | 7 | public void visitIfZeroStmt(final IfZeroStmt stmt) {
print("if0 (");
stmt.expr().visit(this);
print(" ");
switch (stmt.comparison()) {
case IfStmt.EQ:
print("==");
break;
case IfStmt.NE:
print("!=");
break;
case IfStmt.GT:
print(">");
break;
case IfStmt.GE:
print(">=");
break;
... |
e41d7b20-eef3-43ee-ae8b-e2e01646b40b | 4 | public ArrayList<Card> chooseAttackers(ArrayList<Card> controlledCreatures) {
int playerIndex = 0;
ArrayList<Card> attackingCreatures = new ArrayList<Card>();
for (Card creature : controlledCreatures) {
if (!creature.hasSummoningSickness()) {
creature.setTapped(true);
creature.setAttacking(true);
a... |
4b6aff77-c5e9-4c32-9809-f53f171a0654 | 3 | public void store(OutputStream out) throws IOException {
PrintStream p = new PrintStream(out);
TreeMap tm = new TreeMap(omsParams);
int maxlen = -1;
for (Iterator it = tm.keySet().iterator(); it.hasNext();) {
String elem = (String) it.next();
... |
60a37e81-b757-44f2-8920-f95b93ce99ad | 0 | public List<Event> getEvents(){
//returns the list of all events
return manager.createQuery("FROM Event").getResultList();
} |
43060199-8baf-4274-8967-64805dbbac45 | 1 | public final <T> T getObject(Class<T> clazz, String name) {
// If we have a valid factory for this clazz and valid asset name
if (isValidAssetType(clazz, name)) {
return clazz.cast(factoryList.get(clazz).getObject(name, data.get(name)));
}
return null;
} |
851b9ace-aaca-4bd1-a2ac-dffae84c4862 | 6 | public static ArxFile readArxFile(File f) {
HashMap<String, String> result = new HashMap();
try {
BufferedReader br = new BufferedReader(new FileReader(f));
String line;
String tag;
String value;
while ((line = br.readLine()) != null) {
... |
fb09b7e2-0622-4f4c-bbee-ac5b858b87d1 | 2 | public void ocultarProcesos(){
//mbLog.setVisible(false);
NodosListaProceso aux = this.PrimerNodo;
int i = 0;
while (aux.siguiente!=null && i<cant) {
//aux.proceso.setVisible(false);
i++;
aux=aux.siguiente;
}
//aux.proceso.setVisible(false);
} |
b617d4e2-bc4b-496f-bfc4-643ccf51db0f | 2 | private InputStream getConnectionInputStream(HttpURLConnection conn) throws IOException {
if (conn.getHeaderField("Content-Encoding") != null) {
if (conn.getHeaderField("Content-Encoding").contains("gzip")) {
return new GZIPInputStream(conn.getInputStream());
}
}
return conn.getInputStream();
} |
9a282a2e-5b91-40f3-823a-31d031a50b7e | 0 | public Vector<String[]> getCachedData() {
return allPorts;
} |
ab668c2d-b3e3-439f-8873-5e2c3de3dd08 | 6 | public static String to(double input) throws ParseException {
if (input < 1 || input % 1 != .0D)
throw new ParseException(
new Diagnosis().append("diagnosis.roman-numeral-to-invalid-value", input),
ParseException.ParseType.GENERIC
);
int n... |
40d6f0da-a089-49e9-976c-8e04e9b8e137 | 5 | private void writeResults(List<Combo> combs, String infos, boolean noinfo) {
File out = new File("_out" + File.separator);
out.mkdirs();
if (combs == null || combs.size() < 1)
return;
try {
long time = System.currentTimeMillis();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
new F... |
ce2bc323-2ed0-4022-8fce-dc398658e287 | 6 | public LoadCDDDomainTask(CyNetwork net, CDDDomainManager manager) {
super();
this.domainManager = manager;
if (net != null)
this.network = net;
else
this.network = domainManager.getCurrentNetwork();
this.table = network.getDefaultNodeTable();
ArrayList<String> columns = new ArrayList<String>();
co... |
37591db3-3d19-4cfa-92d4-01ca87b5bec4 | 9 | public String addBinary(String a, String b) {
if (a.length() == 0)
return b;
if (b.length() == 0)
return a;
char[] charA = a.toCharArray();
char[] charB = b.toCharArray();
int lenA = charA.length - 1;
int lenB = charB.length - 1;
int carry = 0;
int sum = 0;
StringBuff... |
f8f35758-b6a9-4702-966e-73e7cdfceffc | 6 | private Map getPropertiesTree(Properties properties) {
Map<String, Object> tree = new LinkedHashMap<>();
for (String name : properties.stringPropertyNames()) {
String[] parts = name.split("\\.");
Map<String, Object> nextTree = tree;
for (int i = 0, partsLength = parts.length; i < partsLength; i++) {
S... |
8fe0189f-fa89-4f4f-bf9e-75dff22d409e | 9 | private static LinkedHashSet<EStructuralFeature> getAllEStructuralFeatures(
EClass eClass, LinkedHashSet<EStructuralFeature> eStructuralFeatures) {
for (EAttribute eAttribute : eClass.getEAllAttributes()) {
// System.out.println("\t\t\t" + eAttribute.getName());
eStructuralFeatures.add(eAttribute);
}
for... |
a3824476-a507-448a-8275-d977c292f510 | 7 | private void setupVault(boolean debug) {
if(debug) {
this.getLogger().info("Setting up with Vault");
}
// Check vault
if(getServer().getPluginManager().getPlugin("Vault") == null) {
if(debug) {
this.getLogger().info("Vault not found.");
}
return;
... |
c98c2158-155c-40f4-924b-bdccb841a198 | 6 | public void moveAnt(boolean advancingOnX, boolean advancingOnY,
int velocityX, int velocityY) {
this.setAge(this.getAge() + 1);
if (advancingOnX) {
if (!this.collisionX_MAX(terrainWidth, this.getX())) {
this.advanceX(velocityX);
} else {
advancingOnX = false;
}
} else {
if (!this.collisionX... |
34e754d4-6e77-4738-bb58-ff5e7c320702 | 4 | @EventHandler
public void onBlockPlace(BlockPlaceEvent event){
if(event.getBlock().getType().compareTo(Material.WOOL) == 0 && plugin.isPlacing()){
if(event.getBlock().getData() == 11){
plugin.getBlockMap().put(event.getBlock().getLocation(), "BLUE");
}
else if(event.getBl... |
72878d53-c920-4e82-8f1e-adf16251afad | 8 | public void visit_aload(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 1 > maxLocals) {
maxLocals = index + 1;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_aload);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... |
83a8ffce-cd9f-4ea1-b0a4-708160328ca0 | 7 | private void getPeers(TorrentHandler handler) throws IOException{
String ih_str = "";
for (int i = 0; i < info_hash.length; i++) {
if ((info_hash[i] & 0x80) == 0x80) { // if the byte data has the most
// significant byte set (e.g. it
// is negative)
ih_str += "%" + this.HEXCHARS[(inf... |
9868fb19-768a-4d84-b1e3-ffd3df6fc7de | 9 | public void run() {
byte[] buffer = new byte[1024];
int len = -1, i, temp;
try {
while (!end) {
if ((in.available()) > 0) {
if ((len = this.in.read(buffer)) > -1) {
for (i = 0; i < len; i++) {
temp = buffer[i];
// adjust from C-Byte to Java-Byte
if (temp < 0)
... |
383c118e-f46a-42f9-8821-826c3f0dc587 | 6 | public static JSGob[] objectIdList(int radius, Coord offset,
String... objects) {
ArrayList<Integer> objids = new ArrayList<Integer>();
Coord myCurrentCoord = MyCoord();
myCurrentCoord = MapView.tilify(myCurrentCoord);
Coord objectOffset = new Coord... |
5dc2a7b8-9df1-48fd-99b3-9d051952f740 | 7 | public void draw(Graphics g){
requestFocus();
if(b.getNumberOfLifes() != 0) {
g.setColor(Color.decode("#666666"));
g.fillOval(b.getBall().x, b.getBall().y, b.getBall().width, b.getBall().height);
drawPaddle(g, b.getP1().getId(), b.getP1().getPaddle());
if(... |
bff847f2-336b-4d67-80ef-59ee2d5859d7 | 0 | public JSplitPane getjSplitPane1() {
return jSplitPane1;
} |
320e9588-15e6-4ec2-9e76-c721de87379e | 4 | public static IntMatrix computeIntersectionMatrix(List<IIntervalsTimeDomain> domains) {
// create matrix
IntMatrix matrix = new IntMatrix(domains.size());
// for each pair test if intersecting
for (int i = 0; i < domains.size(); i++) {
matrix.set(i, i, 0);
... |
7dba2ad3-8906-4d04-8164-804efa99b8a7 | 1 | @Override
public void run() {
try {
new WordLengthCallable().call();
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
e6d3a01f-4d00-4548-a317-ca212e986530 | 3 | public void Clean(Person D1, ArrayList<PersonApplication> PersonApplications){
if(D1.isDuty()==true){
for(int i=0; i<PersonApplications.size(); i++){
if(PersonApplications.get(i).getPerson().getID().equals(D1.getID())){
PersonApplications.remove(i);
}
}
}
} |
91c004b4-357f-4e4d-baab-4c8e4744e757 | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 164
v_1 = limit - cursor;
// tomark, line 164
if (cursor < I_pV)
{
... |
e93c0c77-78ff-4aa5-90a4-93db79743f66 | 7 | public static boolean addfriend(Connection conn, String loggedas, String friendlogin)
{
ResultSet resultSet = null;
Statement statement = null;
String query1 = "select `ID` from 8306_traffii1.user Where `Login` = (?)";
PreparedStatement preparedStmt1;
PreparedStatement preparedStmt2;
PreparedStateme... |
4c3b960c-b187-4149-8aea-fc935c01fc45 | 3 | * @param String fieldName 値を設定したいフィールドの名前
* @param Object value フィールドに設定したい値
*/
public static void setField(Object o, String fieldName, Object value) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException{
Field field;
try{
field = o.getClass().getField(fieldName);
... |
036cb114-b2da-4717-bb23-1fba568a3117 | 8 | private void makeOrderButtonActionPerformed(java.awt.event.ActionEvent evt) {
request.setService(Constants.ClientService.buyTicket);
if (orderFromUser.getFirstName() == null || orderFromUser.getFirstName().equals("")) {
JOptionPane.showMessageDialog(null, "Некорректно введено имя. Повторите... |
325aeff4-6d9e-4209-96bb-298c88cab059 | 2 | public Integer getCategoryObjectID (String name) {
Integer data = null;
for (int i = 0; i < this.arr_data.size(); i++) {
if (name.equals(this.arr_data.get(i).getDescr()))
data = this.arr_data.get(i).getID();
}
return data;
... |
1dc9983d-a6e7-4f83-9d6a-16d253b047ff | 3 | public void codageNRZ() {
for (int i = 0; i < informationRecue.nbElements(); i++) {
for (int j = 0; j < nbEchantillon; j++) {
if (informationRecue.iemeElement(i))
informationEmise.add(max);
else
informationEmise.add(min);
}
}
} |
04b59953-5f29-4dad-8ee7-9b96cad1fed4 | 2 | private static void initGrid() {
grid = new Site[xSize][ySize];
for(int x = 0; x < xSize; x++) {
for(int y = 0; y < ySize; y++) {
grid[x][y] = new Site(x, y);
}
}
} |
3d04e0d8-3e04-4b90-a376-fb25611ebcf6 | 6 | private void runTest() {
int i, min, max;
TesterThread tester;
// Get the min and max rows to be processed by each TesterThread
int[] ranges = getRanges();
if (ranges == null) {
return;
}
if (ranges[0] == -1) {
System.err.println("No test records found in target table.");
return;
}
// Get f... |
542a39f1-1412-4f79-bfb9-7c3218db4d5f | 6 | @EventHandler
public void onTimeUnbanEvent(TimeBanUnbanEvent event) {
String admin;
if (event.getSender() != null && event.isSenderPlayer()) {
admin = event.getSender().getDisplayName();
} else {
admin = "console";
}
// get ban
Ban ban = event... |
756e771b-da79-4938-846d-8367bc308cc1 | 7 | @Override
public void setToolTip(ToolTip tt) {
tt.setX(this.x * SIZE + SIZE);
tt.setY(this.y * SIZE + SIZE);
ArrayList<String> message = new ArrayList<>();
message.add(territory.getName());
switch (id % 6){
case 0: message.add( "\nPlains territory"); break;
case 1: message.add( "\nForest terr... |
e235b085-ceb8-4d7a-9204-6f6e3659106e | 4 | private void writeCHRM() throws IOException
{
if (param.isChromaticitySet() || param.isSRGBIntentSet())
{
ChunkStream cs = new ChunkStream("cHRM");
float[] chroma;
if (!param.isSRGBIntentSet())
{
chroma = param.getChromaticity();
}
else
{
chroma = srgbChroma; // SRGB chromaticities
... |
be30ff2d-e1ca-4c00-80bb-be24eba65d53 | 5 | public boolean contains(final Point point) {
Point[] bounds = {new Point(0.0, 0.0), new Point(0.0, 10.0), new Point(10.0, 0.0), new Point(10.0, 10.0)};
boolean intersected;
for (int i = 0; i < bounds.length; i++) {
intersected = false;
//This loop checks that a line... |
807ff189-18d1-4cad-b923-0b44f3129185 | 0 | public void setManaged(boolean managed) {
this.managed = managed;
} |
3dc45f8e-ffaa-4885-b338-36f01599feca | 9 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("device")) {
devices.add(device);
} else if (qName.equals("origin")) {
device.setOrigin(content);
} else if (qName.equals("price")) {
device... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.