method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
66686b94-f7ba-48b2-95d0-a14aff911424 | 2 | private Regla buscarReglaQueProduzca(String productoABuscar) {
Regla reglaARegresar = null;
for (Regla r : conjuntoDeReglas) {
String productoDeRegla = r.getProducto();
if (productoABuscar.equals(productoDeRegla)) {
reglaARegresar = r;
break;
... |
2340f3a0-b736-4787-9005-8e4b14319029 | 7 | public Human bornBaby(Family family, Human target, String firstName, String middleName){
Human baby;
if (this.getIdentity().getGender() == Gender.FEMALE){
if (target != null && firstName != null && middleName != null){
if (!target.getIsSterile() && !this.getIsSterile()){
// The humans to have the ... |
a75b5df2-ca1e-4342-bef4-01ddbcb38851 | 3 | public BSplainAlgorithm(int N){
_X = new ArrayList<Integer>();
_Y = new ArrayList<Integer>();
double step =(double) 1/N;
int x, y;
double a3, a2, a1, a0;
double b3, b2, b1, b0;
int countSegments = Coordinates.xSegment.size() - 3;
int i = 1;
while(countSegments>0){
a3 = (double)((-1)*Coordi... |
e3de18ac-560f-4b49-95f1-1451fee108ee | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Piece other = (Piece) obj;
if (color != other.color)
return false;
if (position == null) {
if (other.position != null)
return false;
... |
1ec0fc6c-6ad5-4bf6-86cc-64e4ce8f8ae2 | 0 | public double getPrecio() {
return precio;
} |
96c51673-815f-4f47-a01d-3f282e874999 | 2 | @Before
public void setUp() throws Exception
{
SimpleCommandDescriptor desc = new SimpleCommandDescriptor();
desc.setName("Base Dispatcher");
desc.setUsageGenerator(new ParameterUsageGenerator());
scm = new SimpleCommandManager(desc);
ParametricBuilder builder = new Param... |
990523f5-fd59-4c32-8630-f179bb535439 | 7 | private boolean hasEveryPlayerStartPositionAreaIdentityDisc(Grid grid) {
final int areaToCover = 7;
for (Player player : grid.getAllPlayersOnGrid()) {
boolean identityDiscFoundNearPlayer = false;
for (int i = 0; i < (areaToCover * 2 + 1); i++) {
for (int j = 0; j < (areaToCover * 2 + 1); j++) {
... |
85f69a10-bf4c-425f-9282-cb78e40aa912 | 6 | public void show(int ans[]){
int i=ans[0];
int k=1;
int j=i+1;
ansText.setText("");
while(j<i*2){
ansText.append(("No."+ans[j]+" :"+node[ans[k++]].getName()+"->"));
j++;
while(ans[j]==ans[j-1]&&j<i*2){ansText.append(node[ans[k]].getName()+"->");j++;k++;}
if(j<i*2||k<=i)ansText.append(""+node[ans[k... |
07fe7c9b-0ba9-4657-b50e-212c20e1aac4 | 4 | public static void main(String[] args) {
try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} c... |
c7f999f6-d7d9-4c76-b6a0-711e653a4930 | 3 | private void documentChanged()
{
// View of the component has not been updated at the time
// the DocumentEvent is fired
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
try
{
int endPos = component.getDocument().getLength();
Rectangle rect = component.mod... |
29f509dc-d583-4928-836c-13636ac64810 | 6 | public BigInteger[] getBNOID(byte type) throws ASN1DecoderFail {
if(data[offset]!=type) throw new ASN1DecoderFail("OCTET STR: "+type+" != "+data[offset]);
byte[] b_value = new byte[contentLength()];
Encoder.copyBytes(b_value, 0, data, contentLength(),offset+typeLen()+lenLen());
int len=2;
for(int k=1;k<b_valu... |
4f6e57a1-f25d-408c-bffb-7a80a9098188 | 0 | public void setEventId(int eventId) {
this.eventId = eventId;
} |
6bf9a603-632e-4746-a78d-e0c1c8a25444 | 8 | public int findTimeForDepartureFromU(Node u, Node v, Edge edge, int departureTimeFromU, int arrivalAtV)
{
//find time at which people can go from u to v
int delay = 0;
boolean change = true;
while(change)
{
change = false;
while(u.getNodeCapacityAtTime().size() < (departureTimeFromU + 1))
u.get... |
b16cee61-f6d6-46cb-820a-d49bae8c5773 | 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... |
5b0cb442-08c5-4240-9232-c5e24164080a | 9 | public byte compose8bit(int t) {
byte rtn = (byte) 0;
switch (bitNumber) {
case 0 :
rtn = (byte) (((t >> 5 & t) - (t >> 5) + (t >> 5 & t)) + (t * ((t >> 14) & 14)));
break;
case 1 :
rtn = (byte) ((t >> 5) | (t << 4) | ((t & 1023) ^ 1981) | ((t - 67)... |
8acf4dda-b7b8-4c8b-9988-2389be097746 | 1 | public boolean isVaultPluginEnabled() {
return hasVaultPlugin() && manager.isPluginEnabled("Vault");
} |
51157a46-0ee5-4402-823a-8b86be894fcb | 4 | public static void unpackJar(String jarFile, String destDir) {
DownloadScreen.unpackStart(new File(jarFile).getName().toString());
try {
java.util.jar.JarFile jar = new java.util.jar.JarFile(jarFile);
Enumeration<JarEntry> enumi = jar.entries();
while (enumi.hasMoreElements()) {
java.util.jar.JarEnt... |
9a9d8fb3-a457-412d-a02d-e9df96744b7e | 8 | private void getPatternSquare3x3(int x, int y, double neigh[]) {
if (x >= 1)
if (y >= 1)
if (x < nx-1)
if (y < ny-1) {
int index = (y-1)*nx + (x-1);
neigh[0] = pixels[index++];
neigh[1] = pixels[index++];
neigh[2] = pixels[index];
index += (nx - 2);
neigh[3] = pixels[index++];
neigh[4]... |
8c27fa8c-df7f-46c9-a2d0-7026101d95bf | 2 | public int getMinimum(final String callName) {
int min = Integer.MAX_VALUE;
final List<CallData> callDataList = getCallData(callName);
for (final CallData callDataEntry : callDataList) {
if (callDataEntry.getDuration() < min) {
min = callDataEntry.getDuration();
}
}
return min;
} |
0e8f955a-6ace-46be-9a9b-ea6b88d543b0 | 5 | private boolean colDectRIGHT() {
if (Controler.right) {
colBox.x += Game.pSpeed;
xPrev -= Game.pSpeed / 4;
}
colBox.setBounds(colBox.x, colBox.y, colBox.width, colBox.height);
for (int i = 0; i < world.tiles.length; i++) {
for (int j = 0; j < world.tiles[0].length; j++) {
if (colBox.intersects(w... |
788f703a-daa9-42ea-960f-e4e8788a8f2b | 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('... |
d22b584f-c51e-4bc2-97fd-1e09562e7b6b | 9 | public void init(Screen s){
this.loadContent(s, "redirector");
String id = s.getParameter("id");
String exists = s.getParameter("_escaped_fragment_");
if (exists!=null) {
//System.out.println("GOOGLE EXISTS1");
s.putMsg("redirector", "", "jumpGoogle(" + id + ")");
}
else{
loadStyleSheet(s,"boots... |
05e46086-18ef-4752-9fa0-70399d9e3617 | 9 | public void level3()
{
wave++;
if ( wave < 3 )
{
for ( int k = 0; k < 4; k++ )
{
for ( int j = 0; j < 3; j++ )
{
enemies.add( new Enemy2( 50 + ( 200 * k ), 10 + ( 100 * j ), bullets, images.get( EnemyImages.ENEMY2 ) ... |
05a7d4f2-714b-4985-9d0c-4b996a6d9ccc | 9 | @Test
public void TestMultiVariateNormalEstimator() throws Exception
{
// model 1 is a zero mean unit variance gaussian
MultivariateNormalEstimator model1 = new MultivariateNormalEstimator();
model1.setMean(new DoubleVector(4, 0.0));
model1.setVariance(Matrix.identity(4, 4));
DoubleVector train1 [] = new... |
6795159b-1f87-47a6-958d-737161867a3b | 0 | public int GetMinimumPassenger()
{
return minimumPassenger;
} |
c900598e-d853-4d9c-8efb-347149cf0b7c | 2 | private void push(JSONObject jo) throws JSONException {
if (this.top >= maxdepth) {
throw new JSONException("Nesting too deep.");
}
this.stack[this.top] = jo;
this.mode = jo == null ? 'a' : 'k';
this.top += 1;
} |
74e622d0-7d1f-46e6-9bea-a0e075ac039b | 2 | public void salvarOuAtualizarLista(List<T> ts) throws ValidacaoException {
try {
transacao = session.beginTransaction();
session.clear();
for (T t : ts) {
session.merge(t);
}
transacao.commit();
} catch (HibernateException e) {
... |
3dbe189a-555a-4994-8d83-7fca868a4c18 | 5 | private boolean readFile(String fileName)
{
boolean success = false;
BufferedReader reader = null;
try
{
FileInputStream file = new FileInputStream(fileName);
reader = new BufferedReader(new InputStreamReader(file));
// read one line at the time
... |
fc0d2503-db43-4437-a6fd-0789b237bb18 | 5 | private final long method712(boolean flag) {
long l = JagMisc.nanoTime();
long l1 = -aLong3092 + l;
long l2 = 0L;
aLong3092 = l;
if (l1 > 0xfffffffed5fa0e00L && ~l1 > 0xfffffffed5fa0dffL) {
aLongArray3091[anInt3093] = l1;
anInt3093 = (1 + anInt3093) % 10;
... |
1bb66598-05cb-49b2-bddc-851bb899412f | 5 | static void doTheTest(File infile, File outfile) throws IOException {
try (BTXParser parse = new BTXParser(infile); BTXPusher push = new BTXPusher(outfile)) {
l:
while (true) {
switch (parse.next()) {
case ATTRIBUTE :
BTXAttribute attr = parse.getEventData().getAttribute();
byte[] buf = new... |
8c4bb387-211e-436d-a77e-c7f3b87399ef | 2 | private void markMinimap(Sprite sprite, int x, int y) {
int k = cameraX + minimapInt2 & 0x7ff;
int l = x * x + y * y;
if (l > 6400) {
return;
}
int i1 = Model.modelIntArray1[k];
int j1 = Model.modelIntArray2[k];
i1 = i1 * 256 / (minimapInt3 + 256);
... |
620ecc12-cdb8-45f6-a9f4-d5d4793fca12 | 6 | public static String writeTruthTable(TruthTable tb, int nombreVars,
String ordrVars) {
StringBuffer s = new StringBuffer("");
int width = nombreVars * 50;
s.append("<div id=\"cent\" align=\"center\">");
s.append("<h3 class =\"subsubTitle2\">"
+ Tools.getLocalizedString("TRUTH_TABLE.Name") + " :" + "</h3>... |
d4141d98-8281-4ada-9b9f-cbf2e4f24803 | 3 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
36bff27c-3955-49e2-8dc6-061ebd04dee8 | 9 | @Override
public boolean handle(NotEmpty notEmpty, Object value) {
if (notEmpty != null) {
boolean bool = false;
if (value == null) {
bool = true;
} else if (value instanceof Collection) {
bool = ((Collection<?>) value).isEmpty();
} else if (value instanceof Map) {
bool = ((Map<?, ?>) value)... |
1aafc0cb-2f1c-4c1d-9cbb-a22c24cd211f | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
3ac5c796-29de-4547-9c59-1036d5168689 | 7 | protected void printData(Data data) {
if(data.isPlain()) {
try {
/* Kommentar aus der Konfiguration zu diesem Datum */
String comment = data.asTextValue().getSuffixText();
/* Name dieses Datums */
String name = data.getName();
/* Der konkrete Wert dieses Datums */
String value = d... |
8f83b481-508f-408a-8429-ad61f76b9cc5 | 4 | public void gameOverUpdate(double deltaTime, int keycode)
{
double scrollDistance = world.update(deltaTime);
updateObjectList(world.getObjectList(), deltaTime, scrollDistance);
if (currentUser.isLogging()) log.update(null, timeCurrent);
if (keycode == KeyEvent.VK_ENTER) startGame(currentUser, fa... |
43f92887-9f2d-49d5-b3a4-aabf781cb53d | 0 | public void setPlayerScores(){
playerScores++;
} |
feeabe04-f265-4838-9ae7-83838fe9eb1c | 0 | private void calculateEuclidean() {
grid.calculateEuclidean(speed);
} |
ba2a379b-1c18-4073-90cd-2c8b3626a769 | 5 | protected static String formatFileSize(double length) {
if (length < 1024) {
return Math.round(length) + " B";
}
length /= 1024;
if (length < 1024) {
return Math.round(length) + " KiB";
}
length /= 1024;
if (length < 1024) {
return Math.round(length) + " MiB";
}
length /= 1024;
if (length <... |
93844f9c-5b14-4681-85b2-9684ed6379f3 | 6 | private float computeTempObj(List<JstatItem> subList, JvmModel fRedMax, Reducer fReducer) {
float tempObj = 0;
//float inMemSegBytesAfterSortMB = (float) ((double)fReducer.getSort().getMixSortMerge().getInMemorySegmentsSize() / 1024 / 1024);
JstatItem lastJstat = subList.get(subList.size() - 1);
if(lastJsta... |
8b5dbb7d-d8aa-48ad-af2a-34fca66e3697 | 7 | public void repartirCartas(Jugador jug){
Random rm;
int n,m,maximoendeck,cartasrepartidas;
maximoendeck=(jug.Deck.MAXDECK- Mano.MAXMANOCARDS - Barrera.MAXBARRERACARDS);
for(int i=0;i<cartaselegidas.length;i++){
for(int j=0;j<cartaselegidas[i].length;j++){
cartaselegidas[i][j]=false;
}
}
c... |
83c07067-5b5f-463b-8c3e-d9d8dd9e5381 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Edge other = (Edge) obj;
// Edge is undirected. So edge A-B is same as edge B-A
if(
(from == other.from && to == other.to) ||
(from ... |
153c152e-d2a7-48de-8589-a7073d5c4885 | 3 | private boolean func_886_c(int var1, int var2, int var3, int var4) {
for(int var5 = var1; var5 < var3; ++var5) {
for(int var6 = var2; var6 < var4; ++var6) {
int var7 = this.imageData[var5 + var6 * this.imageWidth];
if((var7 >> 24 & 255) < 128) {
return true;
... |
093d1a9a-da76-4ea7-ac8a-4a77396c9b53 | 1 | public static void pauseTime(){
if(timer.isRunning()){
Compteur.timer.stop();
tempsEcouleSecondes=secondes;
tempsEcouleMinutes=minutes;
}
} |
d511b23a-0111-4857-8b7f-15dbf6e3eef3 | 6 | public static void comMenu(Room comRoom)
{
Scanner key = new Scanner(System.in);
int input=0;
Monster mon = comRoom.getMonster();
//while(mon.isAlive() && Main.player.isAlive())
//{
System.out.println("There's a " + mon.getName()+ "(HP:"+mon.printHP()+") in the room! What do you do?");
System.out.pr... |
f9d20eae-e5a2-4fb0-861e-ec1609fbea18 | 2 | @Override
public void paint (Graphics g)
{
super.paint(g);
Graphics2D g2 = (Graphics2D) g;
g2.setPaint(Color.blue);
g2.draw(new Line2D.Double(0, 100, 700, 100));
g2.setPaint(Color.black);
//DRAW VERTICAL
for(int i = 100; i < 800; i = i + 100)
{
g2.draw(new Line2D.Double(i,100,i,700));
}... |
59a968a8-c7ee-4ab8-a92c-6b5954a4fc0b | 2 | public void atualizaDisplay(String texto) {
if(display.getText().equalsIgnoreCase("") || display.getText()==null){
display.setText(texto);
}else{
display.setText(display.getText()+texto);
}
} |
103ca3a9-4e80-499c-a392-706f0ffbb86f | 5 | @Override
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
if (o == reset) {
} else if (o == load) {
} else if (o == exit) {
System.exit(0);
} else if (o == help) {
} else if (o == about) {
}
} |
920d512a-c5ff-4e4d-869b-f0c21f4edf09 | 8 | boolean isConnected(int[][] graph, int[] node) {
int start = 0;
while (node[start] == 0) {
start++;
}
boolean[] visited = new boolean[node.length];
LinkedList<Integer> list = new LinkedList<Integer>();
list.addLast(start);
while (list.isEmpty() == false) {
Integer first = list.re... |
9e723d19-222a-4c1f-8a7e-eb956bde4200 | 8 | public static boolean deleteDirectory(File directory) {
if (directory == null) {
return false;
}
if (!directory.exists()) {
return true;
}
if (!directory.isDirectory()) {
return false;
}
String[] list = directory.list();
// Some JVMs return null for File.list() when the
// directory is empty.... |
f7dadcf2-d4aa-43e9-a81e-be63ad591225 | 9 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 75
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 75
// [, line 77
bra = cursor;
... |
a41894ab-d8a4-4d66-979c-dd75c6e13917 | 1 | public Object getObject(){
Object obj = new Object();
try{
obj = h.readObject();
}catch(Exception e){
System.out.println("Notification: A client has left");
}
return obj;
} |
6fdbbe73-f0e6-4183-9846-0456a7774f9f | 2 | @Override
protected void shutdownInput () throws IOException {
if ( !this.closed && this.fd.valid() ) {
NativeUnixSocket.shutdown(this.fd, SHUT_RD);
}
} |
bdb77498-97dd-4124-aabc-eb0e43bf01d7 | 8 | public static List<Movie> simpleSearch(String category, String keyword) throws SQLException, Exception{
String stmtToCall = null;
SearchCategory c = Enum.valueOf(SearchCategory.class, category);
switch(c){
case MOVIE_TITLE:
stmtToCall = searchByTitle;
keyword = ad... |
5c528886-b444-415c-be28-306e71278d4c | 3 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
StringBuilder out = new StringBuilder();
int n = in.nextInt();
for (int i = 0; i < n; i++) {
char[] w = in.next().trim().toCharArray();
long sum = 0;
int acum = 0;
for (int j = 0; j < w.length; j++) {
... |
574ead7c-0e90-4584-8608-d967cc975fcf | 8 | @Override
public Auction[] search(String criteria) {
Predicate<Auction> cp = null;
ArrayList<Auction> theSearch = new ArrayList<Auction>();
//for(Auction auction : searches.values()) {
//if(criteria.contains(auction.getName()) || criteria.contains(auction.getDescription())) {
Stack<Predicate<Auction>> ... |
e6d6716f-6678-4e9e-bfe4-b1ece755b16b | 4 | public void increaseResources() {
// gold is increased every turn
player.increaseGold(100);
// soldier is increased every turn
// increase soldiers code goes here
// food is increased every season
if (month == 3 || month == 6 || month == 9 || month == 12... |
dd4f4bfa-b4ce-4d99-b97a-97fa8a2180e1 | 3 | public static String convertPolygon(final Polygon POLYGON) {
final StringBuilder fxPath = new StringBuilder();
final int size = POLYGON.getPoints().size();
if (size % 2 == 0) {
List<Double> coordinates = POLYGON.getPoints();
for (int i = 0 ; i < size ; i +... |
b3d47393-052c-43ff-87ff-6638f23738e2 | 4 | public ImageHandle getImage( String imagename ) throws ImageNotFoundException
{
for( int t = 0; t < getNumWorkSheets(); t++ )
{
try
{
ImageHandle[] r = getWorkSheet( t ).getImages();
for( ImageHandle aR : r )
{
if( aR.getName().equals( imagename ) )
{
return aR;
}
}
}
... |
89f97cbc-abd8-4ead-a18b-8d487ab17f19 | 5 | private static Map<String, String> getMapping(String filename) {
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(filename));
// read headline
in.readLine();
// load the mapping of Meketre- and Pelagio-places
Map<String, String> mapping = new TreeMap<String, String>();
Str... |
80a7a852-b03b-4d82-a477-a98e12750790 | 9 | public void tick() {
if (atPl && (x - Game.p.x > -256 && x - Game.p.x < 256) && (y - Game.p.y > -256 && y - Game.p.y < 256)) {
}
if (!getColison()) {
y += vec.y;
x += vec.x;
}
if (dirChose.Ring()) {
vec.x = r.nextFloat() - r.nextFloat();
vec.y = r.nextFloat() - r.nextFloat();
dirChose.reset... |
4f14a6b1-e2e7-4a16-8b01-ffe88d1e1ebc | 4 | public boolean validatePassword(String password) throws IllegalAccessError, SocketTimeoutException {
boolean answer = false;
try {
clientSocket.Escribir("CLAVE " + password + '\n');
serverAnswer = clientSocket.Leer();
} catch (IOException e) {
throw new SocketTimeoutException();
}
if(serverAnswer != ... |
96becd9d-d3e4-4934-9286-153752152928 | 2 | public int getBit() throws IOException {
// If the buffer is empty, read more bits from the file.
if (numBits == 0) {
int returnVal = in.read();
if (returnVal == -1) {
return -1; // eof has been reached
} else {
buff... |
52657640-5187-491d-a465-1e15a4eac3bc | 0 | public void setTintedGlass(boolean tintedGlass) {
this.tintedGlass = tintedGlass;
} |
65de08f0-72d5-481a-9562-3313005dd09c | 8 | private static void printActions(boolean shell) {
StringBuilder b = new StringBuilder();
ActionType[] act = shell ? ActionType.CSHELL : ActionType.CNORM;
for (ActionType a : act) {
if (b.length() > 0) b.append(", "); //$NON-NLS-1$
b.append(a.code());
}
b.insert(0, Messages.getString("Hel... |
d43c1be4-81a5-4139-87b8-dbdc3be34a0c | 7 | public void actionPerformed(ActionEvent ev){
fen.comptnombre=0;
System.out.println("Veuillez placer un " +fen.liste.getSelectedItem());
for(int i=0;i<5;i++){
if(fen.liste.getSelectedItem()==fen.items[i]) {
compt=i;
if(compt==0){
fen.compFin=5;
}
if(compt==1){
fen.compFin=4;
}
... |
f9bb1e02-4092-4c12-8ab0-18c1d9ef732f | 3 | public void makePhysics(GameLevel level, double frameTimeLeft) {
_lastCollision = null;
LevelSegment currentCollision = null;
// obliczenie jakie sily dzialaja na kulke, update wektorow ruchu i
// pozycji
calculateForces(level, frameTimeLeft);
move(level.getBall(), frameTimeLeft);
frameTimeLeft = 0;
// ... |
b4b04949-2cef-4eb0-b9de-f23472176103 | 4 | public static State[] getClosure(State state, Automaton automaton) {
List list = new ArrayList();
list.add(state);
for (int i = 0; i < list.size(); i++) {
state = (State) list.get(i);
Transition transitions[] = automaton.getTransitionsFromState(state);
for (int k = 0; k < transitions.length; k++) {
T... |
50b1ac04-1c77-4690-8b67-1d0276ceef0d | 8 | public static String signTopRequest(RequestParametersHolder requestHolder, String secret)
throws IOException {
// 第一步:把字典按Key的字母顺序排序
Map<String, String> sortedParams = new TreeMap<String, String>();
TaobaoHashMap appParams = requestHolder.getApplicationParams();
if(appParams != null && appParams.size() > 0){... |
087e6777-3007-43c2-af33-5897fbdd37f5 | 1 | public boolean canReceive() {
boolean isAvailable = inputAvailable.tryAcquire();
if(isAvailable) {
inputAvailable.release();
return true;
} else {
return false;
}
} |
38c9beeb-c899-452a-b907-383fc8c1bf25 | 2 | public boolean fire() {
if(readyToFire && weapon.ready()) {
charging = true;
return true;
}
return false;
} |
db209d1c-47cd-4a18-a8c7-a92797596639 | 4 | public void deleteFolder(FolderDTO folderDTO) throws DataProcessingException {
if (folderDTO.getFolderName().equals("Inbox")
|| folderDTO.getFolderName().equals("Outbox")
|| folderDTO.getFolderName().equals("Draft")) {
throw new DataProcessingException(ExceptionType.systemFolderDeletion);
}
Folder fol... |
4a39d3ef-cf28-4f7a-841d-4fb989e27a17 | 0 | public void setFunClave(Integer funClave) {
this.funClave = funClave;
} |
d2d3415b-b7f2-41b5-ac64-4a3b8b55c37c | 3 | public static void pipe(InputStream istream, OutputStream ostream) throws IOException {
if(ostream != null && istream != null) {
/*
* This is the fastest method I know for reading from an
* indeterminate stream. So fast in fact, that it pars fairly well
* with FileChannel stuff in test cases.
*
... |
9ba88c50-8c43-4667-bb29-9ad97be0c212 | 2 | public void drawAutomaton(Graphics g2) {
if (!valid)
refreshArrowMap();
Graphics2D g = (Graphics2D) g2.create();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setFont(g.getFont().deriveFont(12.0f));
// Draw transitions between states.
g.setColor(Color.bla... |
4158858b-d7bc-431c-9a94-1162778ecc63 | 0 | public void setName(String name) {
this.name = name;
} |
f7bfdee4-aed4-49c2-aa58-d6fae9b18a97 | 3 | private void generarTabla(int columna, int fila, int[] datos, String operacion) {
switch (getOperacion(operacion)) {
case 0:
tableHtml += "<h1>Funcion no implementado</h1>";
break;
case 1:
tableHtml = "<table border=2><tr><th colspan=" + co... |
b057db59-de7f-4e73-ba45-fca1a89edbb0 | 9 | public LinkedList<interval> FindDuring (Node node, interval interval, long minStart, long maxStart, long minEnd, long maxEnd, LinkedList<interval> list){
//LinkedList<interval> list = new LinkedList<interval>();
if (node.CurrentInterval != null)
{
if (node.During(interval, minStart, ... |
d9a92fe3-ed5a-44fd-9761-df5da7e237d9 | 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 Gcmdevice)) {
return false;
}
Gcmdevice other = (Gcmdevice) object;
if ((this.gcmdeviceID == null && other.gcmd... |
66b074bd-0e10-4f86-9ef8-39450b47bdfe | 8 | protected String getAction(String xml) {
if (xml == null) return null;
Document document;
try {
document = DocumentBuilderFactory
.newInstance()
.newDocumentBuilder()
.parse(new ByteArrayInputStream(xml.getBytes()));
... |
cd829d58-6b08-4fa9-a851-c6fb9e2bad1d | 4 | public void process() {
for (int i = 2; i <= N; i++) {
switch (checkNumber(i)) {
case 1:
// Broj je prim broj
suma= suma.add(getSumAll(i));
break;
case 2:
// broj ima parni broj prim djelitelja
suma = suma.subtract(getSumAll(i));
break;
case 3:
// broj ima neparni broj prim dj... |
d2f72a29-adbb-49ef-8bd2-a7f6a7b214f9 | 2 | public void printInventory(String context){
if(items.size() == 0){
System.out.println(context + " there is nothing");
} else {
System.out.println(context +" there is: ");
for(Item i : items){
System.out.println("- " + Phraser.addDeterminer(i.getName())... |
275e7014-695e-486d-b792-b67d610d2b18 | 0 | public int[] getLoopTimes()
{
return loopTimeArray;
} |
137f6230-77b4-4fb6-98e0-b4af3e76a77c | 2 | public ArrayList<Location> getOccupiedAdjacentLocations(Location loc)
{
ArrayList<Location> locs = new ArrayList<Location>();
for (Location neighborLoc : getValidAdjacentLocations(loc))
{
if (get(neighborLoc) != null)
locs.add(neighborLoc);
}
retur... |
7612d629-0fd9-4ecc-8ab0-8263a8dbfe45 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
20ce3c80-64be-4c6d-b062-7cbfbc6cbac8 | 9 | public void doCipherOperation(InputStream in, OutputStream out, long nrOfBytesToCipher, int cipherMode, ProgressInfo progress) throws Exception {
if (nrOfBytesToCipher > 0) {
try {
// If the nr of bytes to read is smaller than readBufferSize
// use the nr of bytes as the max buffer size.
int maxBuffe... |
1006e6cd-d142-4f0b-987d-1dc22443ec11 | 4 | public boolean isAllDone(int turnNumber) {
for (List<PlayerCommands> commandList : playerCommands) {
boolean found = false;
for (PlayerCommands commands : commandList) {
if (commands.turnNumber == turnNumber) {
found = true;
break;
}
}
if (!found) {
return false;
}
}
return tr... |
5fda56d8-44c4-4146-86e4-eb99daf8ff15 | 2 | public boolean isCorrect() {
for (ItemID i : this)
if (i.getType() == ItemID.TYPE_UNKNOWN)
return false;
return true;
} |
87a2e442-9494-4817-9cec-52904c684b7d | 4 | public void lireDonnees( boolean affErr ) throws Exception {
try {
chargerFichier();
}
// S'il y a eu une erreur, on l'affiche
catch (IOException e) {
if (affErr)
JOptionPane.showMessageDialog(null,
"Impossible d'ouvrir le f... |
60a16ece-e18b-4210-bb73-d86dea1d37df | 1 | public void addRow(Object[] array) {
//data[rowIndex][columnIndex] = (String) aValue;
// add row to database
EntityTransaction userTransaction = manager.getTransaction();
userTransaction.begin();
Files newRecord = fileService.createFile((String) array[0], (String) array[1], (String) array[2], (String... |
14342fd6-a4e5-4a3f-b62b-8c6d5aaf8415 | 0 | public boolean isInitialized() {
return this.initialized;
} |
891e0412-c745-41b5-8a89-90528b771cf3 | 0 | public String getName() {
return name;
} |
2c382e90-b4d9-4cfe-af8f-c5de3f6484ef | 4 | private void draw() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
gfx.clearScreen();
render();
for (int k = 0; k < pixels.length; k++)
pixels[k] = gfx.getPixel(k);
... |
69074fb5-1207-4516-a22f-f9a3af8619ab | 5 | @Override
public void showResult() {
if (garden != null
&& CollectionUtils.isNotEmpty(garden.getLawnmowers())) {
for (Lawnmower lawnmower : garden.getLawnmowers()) {
if (lawnmower != null && lawnmower.getCoordinate() != null) {
System.out.println(lawnmower.getCoordinate().getX() + " "
+ lawnmo... |
5ae81649-3c72-4ff4-9a1c-1d1e377d5eb5 | 2 | private static void method494(char arg0[][], Stream buffer) {
for (int chars = 0; chars < arg0.length; chars++) {
char ac[] = new char[buffer.getUnsignedByte()];
for (int i = 0; i < ac.length; i++) {
ac[i] = (char) buffer.getUnsignedByte();
}
arg0[chars] = ac;
}
} |
c4fefb9c-659a-4052-aa59-333736ebac67 | 3 | protected synchronized void handleRecieveBlock(Block block) {
System.out.println("block recieved!");
// here goes the code to handle the block broadcast
// get the block , add it to the tree
SignedBlock sb = (SignedBlock)block;
try {
this.blockTree.addBlock(sb);
// generate a diag... |
c164e6a3-3638-4098-8837-f1446c089f46 | 8 | public Set<Map.Entry<Float,Short>> entrySet() {
return new AbstractSet<Map.Entry<Float,Short>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TFloatShortMapDecorator.this.isEmpty();
}
p... |
c8c609dc-b990-4d83-8b44-606505b1f2d9 | 1 | private TreeMap<Float, Float> makeListFromPointInArray(
TreeMap<Float, float[]> coData, int id) {
TreeMap<Float, Float> pts = new TreeMap<Float, Float>();
for (Entry<Float, float[]> data : coData.entrySet()) {
pts.put(data.getKey(), data.getValue()[id]);
}
return pts;
} |
be2273c6-609b-428e-baf8-029dc2d96cd1 | 1 | public void listarAtividadesGETSAO() {
AtividadeBO atividade = new AtividadeBO();
try {
tblAtividades.setModel(DbUtils.resultSetToTableModel(atividade.preencherTabelaAtividadeGESTAO(UserLogado.getDepartamento().getCodigo())));
} catch (SQLException ex) {
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.